0% found this document useful (0 votes)
9 views2 pages

C Control Instructions MCQ Question Paper

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

C Control Instructions MCQ Question Paper

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Chapter 2: Control Instructions - Question Paper

Section A: Multiple Choice Questions (MCQs) [1 Mark Each]


1. Which of the following is a control instruction in C?
a) if-else
b) switch
c) for loop
d) All of the above

2. What will be the output of the following code?


int x = 5;
if (x = 0)
printf("Zero");
else
printf("Non-zero");
a) Zero
b) Non-zero
c) Compilation error
d) Undefined behavior

3. How many times will the following loop execute?


for(int i = 0; i < 10; i++);
a) 9 times
b) 10 times
c) 0 times
d) Infinite loop

4. Which of the following is NOT a looping statement in C?


a) for
b) while
c) do-while
d) switch

5. The break statement is used to:


a) Exit from a loop or switch statement
b) Continue to the next iteration
c) Skip the next statement
d) Restart the loop

Section B: Fill in the Blanks [1 Mark Each]


6. The ______ loop guarantees execution of the loop body at least once.
7. A switch statement uses ______ to compare values.
8. The keyword used to skip an iteration of a loop is ______.
9. The ______ statement is used to exit a loop immediately.
10. The default section in a switch statement is executed when ______.

Section C: True or False [1 Mark Each]


11. The condition in an if statement must be enclosed in curly braces.
12. The else part of an if-else statement is mandatory.
13. A switch case statement can have duplicate cases with the same value.
14. The continue statement terminates a loop completely.
15. A for loop can be written without an initialization, condition, or increment part.

Section D: Short Answer Questions [2 Marks Each]


16. What is the difference between while and do-while loops?
17. How does the break statement work inside a switch case?
18. Explain the difference between continue and break statements in loops.
19. Write a C program that prints all even numbers between 1 and 50 using a for loop.
20. What will be the output of a loop with an empty body?

Section E: Coding Questions [5 Marks Each]


21. Write a C program to find the factorial of a number using a while loop.
22. Write a C program to check if a number is prime using a for loop.
23. Implement a switch case program that takes a number (1-7) and prints the corresponding day of
the week.
24. Write a program to print Fibonacci series up to N terms using a loop.
25. Create a menu-driven program using switch-case to perform basic arithmetic operations.

You might also like