Maharashtra State Board of Technical Education Summer Examination 2007 Subject: Programming in ‘C’ Subject Code: 9017 Total Marks: 80
Class: FYIF Time: 3 Hrs.
Q.1 Attempt any EIGHT of the following 16 a) Declare and define a structure employee having member variables as emp-id, emp-name and salary. a) State different data types supported by ‘C’ language. c) Justify the following statements: int a = 10; int *b = &a; int *c = b; int d = *b + *c; d) Define and declare two dimensional array. e) Write a ‘C’ statement for each of the following: (1) Relational operator (2) Assignment operator f) What is pointer? g) Define function prototype. h) State use of continue statement. i) State use and syntax of strcmp ( ) function. j) Describe if-else statement. Q.2 Attempt any THREE of the following: 12 a) Write a program to display even numbers from 1to n. where n is accepted by user. b) Distinguish between call-by-value and call-by-reference. c) In what ways does a switch statement differ from an if statement. d) State the use of increment and decrement operator and give its precedence and associativity. Q.3 Attempt any THREE of the following: 12 a) The following is a segment of a program: x = 1; y = 1; if ( n > 0 ) x = x + 1; else y = y – 1; printf ( “%d %d”, x , y ); What will be the values of x and y if n assumes a value of 1 and if n = 0? -1-
CPR – (S’2007)
b) State the use of %d and %f and write the print statement of ‘C’ using above mentioned symbols. c) Write a program using pointers to compute sum of all elements stored in an array? d) Explain the need for array variables. Q.4 Attempt any FOUR of the following: 16 a) Write a program in ‘C’ to reverse the entered integer number as input through keyboard. b) What will be the output of following? #include<stdio.h> void main () { float a = 135; float *b , *c ; b = &a; c= b; /* suppose address of a is 1006 */ printf(“%u %u %f %f”, &a , b, *(&a) , *b); } c) Explain strcpy () function in detail. d) Explain the use of pointers and arrays. e) Compare while and do-while loop. f) Write a program to accept a string and display a list of ASCII codes which represent accepted string. Q.5 Attempt any THREE of the following: a) Define and following: 1) Expressions 2) Data types 3) Bitwise operators 4) Logical operators. b) Explain nested if-else statement execution with its flowchart. c) Write a program to print factorial of number n. (i.e n!) d) Explain with example structure initialization and declaration.
12
Q.5 Attempt any THREE of the following: 12 a) Write a program to find whether the given number is prime or not. b) Write a program to declare the structure student having member variables roll-no and name. Accept the data for 3 students and display it. c) Explain the concept of pointers arithmetic operations with example. a) How pointer is initialized?
-2-
CPR – (S’2007)