BBA Iind SEMESTER EXAMINATION 2008-09 s8
Total Page:16
File Type:pdf, Size:1020Kb
B.Sc. (Hons) Maths/Physics V (Fifth) Semester Examination 2013-14
Course Code: BCS501 Paper ID: S985214
‘C’ Programming
Time: 3 Hours Max. Marks: 70
Max Marks: 75
Note: Attempt six questions in all. Q. No. 1 is compulsory.
1. Answer any five of the following (limit your answer to 50 words). (4x5=20) a) Explain different types of data types available in C language with their range. b) Write down the associatively and precedence of different operators available in C. c) Write down the rules for constructing variable names in C with suitable examples. d) Write a recursive function for finding the factorial of a number. e) Given three variables x, y, z write a function to circularly shift their value to right using pointers (call by reference). f) WAP to read the age of 100 persons and count the number of persons having age group 50 to 75 and no of persons of age group 76 to 100. g) WAP to read 10 integers in an array. Find the largest and smallest number. h) Describe the output of the following C programs. i) void main () { int k = 0, x = 0; while (k < 25) { if (k % 5 == 0) { 6. Differentiate between the following with examples. (3+3+4) x += k; a) Global and Local Variables printf(“%d ”, x); b) Union and Structures } c) Macros and Functions ++k; 7. What is meant by storage class of a variable? Compare } different storage classes with suitable examples. (2+8) printf(“\nx=%d “, x +k);
} 8. Explain the different type of modes for opening the files in C ii) void main() language. WAP for copying the contents of one file to { another. (2+8) int k , num=30;
k= (num>5? (num<=10? 100:200):500); printf ( “%d”, k); }
2. What are arrays and what are the advantages of using arrays. Explain in how many ways a Two Dimensional Character array is stored in the memory with suitable example. (10)
3. a) Explain the differences between call by value and call by reference with suitable example. (7) b) Write down the macro definition for test whether a character entered is an upper case letter or not. (3)
4. a) WAP for performing the matrix addition of two matrices of order m*n and p*q. (6) b) Write an algorithm to find the value of xn where n is a positive integer greater than 1. (4)
5. a) Write a function int palindrome (char *) that will return one if the passed string is palindrome else zero. (6) b) Explain the following in-built string handling functions: i) Strcmp( ) ii) Strcat( ) iii) Strlen( ) iv) Strcpy( ) (4)