Mumbai University Previous year question papers Computer Programming II June 2004

Mumbai University Previous year question papers

I Year Examination June 2004

Computer Programming-II

N B.:(1) Question Nos. 1 is compulsory.

2) Attempt any four questions, out of remaining six questions.

Section I

i) What are the security rights associated with files and directories in UNIX ?

ii) Write range of long signed int, double and unsigned char. 

iii) Explain any three bitwise operators in C.’

iv) Explain four types of files in UNIX. 

v) What is modular programming ? What are the characteristics and advantages of modular programming ? 

vi) What will be the output of following program :-

main ( ){ floaty =24.5874; printf(“% 7.4f”,y); printf(“% 7.2 f\y); printf(“% -7.2f”,y); printf(“% 10.2e”,y); printf(“% 11.4e”, -y); }

2(a) Write commands at UNIX prompt $ for the following: (any six):- 

i) To print information about active process.

ii) To search for a pattern in a file.

iii) To sort the contents of a file in reverse order.

iv) To change current ‘$’ prompt to ‘#’ prompt.

v) To display date and time.

vi) Tomove’yourfile”.

vii) To, list the processes which are running.

2(b) i) What is recursive function? Explain with suitable examples. 

(ii) Write a recursive function ? ‘Rev’ to reverse a number entered by the user. (7)

3(a) The following set of numbers is popularly known as ‘Pascal’s triangle. (10)

1 11 2 11 3 3 11 4 6 4 11 5 10 10 5 1 If we denote rows by i and columns by j , then any element (except the boundary elements) in the triangle is given by – Pij =Pi-1,j-1 +Pi-1 , j Write a program to calculate the elements of the Pascal triangle of 06 ‘ rows and print the results.

3(b) i) A square matrix that is, one having the same number of rows and columns, is called a diagonal matrix if its only non-zero elements are on the diagonal from upper left to lower right. Write a program that reads a matrix and checks if it is diagonal matrix. (5) Write a program to find GCD and LCM for two numbers entered by user. (5)

4.(a) i) Explain different operators in C. Also explain precedence and associativity of operators. (8)

ii) Write the C Program to count and to display total no of vowels contained in user input string. (8)

5. (a) Explain different storage classes in C. (8)

(b) What will be the output of following programs? (12) i) main ( ) iii) main ( ){ intx- 10,y,z; {floata = 0.5, b = 0.9 ; z=y=x; if(a&&b>0.9)y- = x–; printf(“IFPART”); x- = –x-x–; printf(” ELSE PART”);printf(“y=%dz=%dx=%d”y,z,) }} ii) main ( ) . iv) main ( ) { inta = b=c = d = e = 40; . { inti = 0; printf(“%d%d%d%d%d”>a,b>c,d,e); for (; i < 100; i ++); } printf (“This will printf hello 100 times”)}

6. (a) What will be the output of following program ?main ( ){ staticinta[] = {0, 1,2,3,4}; static int *p [ ] = {a, a + 1, a + 2, a + 3, a + 4}; int * * ptr = p ; printf(“%d%d”,a,**p); .printf (” % d % d”, p, * ptr);}

(b) Explain the followingwith suitable example (any four):- (16) i) Call by value ii) Break and continue iii) Preprocessor directives. iv) Call by addressEnumerated data types

7. (a) Define a structure called cricket that will describe the following information:- (10) Player name Team name Batting average using cricket”, declare an array player with 50 elements and write a program to read the information about all 50 players. Sort the structure on there batting average and print the results.

(b) (i) Explain following library functions :- (5)

i) getche ( )

iii) isalnum ( )

ii) puts ( )

iv) toupper ( )

v) stcmp(S1,S2).

(ii) What is a union ? How does a union differ from a structure ? Explain with suitable example.

Leave a Comment