Question Bank: Chapter No. 02
Programming in ‘C’ (9017) Class: FYIF Decision making and Branching
Summer 2007: Marks = 36 1. State the use of ‘continue’ statement. 2 2. Describe if-else statement. 2 3. Write a program to display even numbers from 1 to n. Where n is accepted from user. 4 4. In what way does switch statement differ from an if statement 4 5. The following is the program segment: 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? 4 6. Write a program in ‘C’ to reverse the entered integer number as input through keyboard. 4 7. Compare while and do-while loop. 4 8. Explain nested if-else statement execution with its flowchart. 4 9. Write a program to print factorial of a number (W-07) 4 10. Write a program to find whether a given number is prime or not. 4 Winter 2007: Marks = 36 1. State difference between while and do-while loop 2 2. Write syntax for nested if-else statement. 2 3. Give syntax and example of switch-case statement 4 4. Explain importance of ‘break’ statement with switch-case. Give proper example. 4 5. Write a program to enter values of a and b variables. Calculate addition, division, multiplication, subtraction of a and b and display results. 4 6. Explain ‘continue’ statement with example. 4 7. Debug following program and write only errors if any: #include<stdio.h> main( ) { char X; while(X=0;X<=255;X++) printf(“\n character is %c”, X); } 8. Write a program to display series of 11 to 30 numbers in reverse order as 30,29,28,……..2,1. Also calculate sum of 11 to 30 numbers and display it. 9. Write a menu driven program for the following options: i. To find whether entered no. is even or odd. ii. To display sum of two entered numbers. CPR (FYIF) by Mr. Kute T. B. (Lecturer in IT, KK Wagh Polytechnic, Nashik 2007-2008)