K. K. WAGH POLYTECHNIC, NASHIK - 3. Department of Computer and Information Technology Class Test – I (Feb – 2008) CLASS: FYIF / FYCM TIME: 1 hr. SUB: PROGRAMMING in C (CPR - 9017) MARKS: 20. = = = = = = = = = = = = = = = = = = = = = = = == = = = = = = = = Note: All the questions are compulsory.
Q.1 Attempt any two.
(2*2)
4
1. Define: Variable and Keyword with example. 2. Explain difference between pre-decrement and post decrement operator with an example. 3. Write the syntax of do-while loop.
Q.2 Attempt any two.
(4*2)
8
1. Explain the rules for creating variable’s name. 2. Write a program using ‘for’ loop to print following output.
* * * *
* * *
* *
*
3. Explain the use of ‘continue’ statement with appropriate example.
Q.3 Attempt any two.
(4*2)
8
1. Write the output of following program code and justify your answer. int x = 10; switch ( x ) { default: printf(“\n Welcome”); case 1: printf(“\n to”); case 2: printf(“\n C”); break; case 3: printf(“\n Programming”); } 2. Modify following program to use the ‘for’ loop for getting the same output. int a = 0,sum = 0; while (a<10) { sum = sum + a; a++; } printf(“\n Addition is : %d”, sum); 3. Write a program to find whether entered number is prime or not? Take input from user.
CPR (FYIF) by Mr. Kute T. B. (Lecturer in IT, KK Wagh Polytechnic, Nashik 2007-2008)