You are on page 1of 2

K. K.

Wagh Polytechnic, Nashik

Question Bank: Programming in ‘C’ (9017) Class: FYIF


Chapter No. 02 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 – Question Bank Chapter 02 -1-


K. K. Wagh Polytechnic, Nashik

Summer 2008: Marks = 32

a) What is difference between while and do-while? 2


b) Describe nested if-else statement. 2
c) Write a program to display table up to 30. Use for loop. 4
d) Give any four forms of nested if-else statement. 4
e) Explain switch statement with suitable example. 4
f) Using while loop, write a program to print all Armstrong numbers between
1 and 500. If sum of cubes of each digit of the numbers is equal to the
number itself, then number is called Armstrong number.
For example: 153 = (1*1*1) + (5*5*5) + (3*3*3) 4
g) State use of continue statement over break statement using suitable
example. 4
h) Write a program to print first 10 odd numbers using while loop. 4
i) Write a program which will print largest of three numbers using
if-else. 4

Winter 2008: Marks = 32

a) State the use of break statement. 2


b) Explain conditional operator. 2
c) Write a program to display the sum of all even numbers from one to ‘n’.
Accept ‘n’ from user. 4
d) Explain else – if ladder with example. 4
e) Explain switch statement with flowchart. 4
f) Explain the working of do – while loop with example. 4
g) Differentiate between do-while and while loop. 4
h) Write a program to find sum of digits of five digit integer number. 4
i) Write a program to find out largest number among 3 integer nos. 4

CPR – Question Bank Chapter 02 -2-

You might also like