2nd Year Computer Science Chapter 12 Loop Constructs Notes MCQs Bank

computer 12th notes chapter No 12

1. ___can be used to terminate the loop : : 

 
 
 
 

2. What does a compound condition use to join two conditions?

 
 
 
 

3. Which statement is used to move the control to the start of loop body?

 
 
 
 

4. Graphical representation of a program is called:

 
 
 
 

5. The _____________ of for loop executed only once in the first iteration  

 
 
 
 

6. One execution of the body of loop is called : 

 
 
 
 

7. What will be value of c after the execution of following statements :  c =-8; do{c++;}while(c> =5);

 
 
 
 

8. Loop with in a loop is called 

 
 
 
 

9. ___is called counter loop : 

 
 
 
 

10. Which of the following loop is available in C language?

 
 
 
 

11. Which operator in C is called a ternary operator?

 
 
 
 

12. What will be the output of the following code segment : 
 int n = 5; 
 while (n > 5) 
 n * = 10; 
 printf(“%d”, n );

 
 
 
 

13. The do-while loop ends with a ____ 

 
 
 
 

14. The while loop is also called : 

 
 
 
 

15. Semi colon is placed at the end of condition in:

 
 
 
 

16. This loop is a good choice when you know how many times you want the loop iterate in advance of entering the loop?

 
 
 
 

17. What is the final value of x when the code intx; for(x =0; x<10; x++) is run : 

 
 
 
 

18. Which is an example of multiple branches from single expression?

 
 
 
 

19. Which for loop will counts from 0 to 5 : 

 
 
 
 

20. What will be the value of ‘x’ after executing the following code : 
int x = 5; 
 while (++x > 5)
 break;
 printf(“%d”,x);

 
 
 
 

21. The loop which never ends is called : 

 
 
 
 

22. In which loop the condition comes after the body of the loop?

 
 
 
 

23. ___is used to move the control to the start of loop body : 

 
 
 
 

24. The body of while loop with multiple statements ends with

 
 
 
 

25. A for statement contains three expressions initialization, test and

 
 
 
 

26. A special value that terminates the loop is called :

 
 
 
 

27. ___is a loop statement :

 
 
 
 

28. What is the final value of x when the code int x; for(x =0;x<10;x++){} is run 

 
 
 
 

29. What will be the value of ‘x’ after executing for(x =1 ; x<15;x++);  : 

 
 
 
 

30. How many types of loop structures are in C : 

 
 
 
 

31. Conditional operator is an alternative of 

 
 
 
 

32. Refer to group of statements enclosed in opening and closing braces.

 
 
 
 

33. A loop within a loop is called:

 
 
 
 

34. This means to increase a value by one:

 
 
 
 

35. Examine the following code and tell output  int count =-2; while(count<3){ printf(“%d”,count); count+ = 1;} 

 
 
 
 

36. A variable whose value controls the number of iterations is known as _________. 

 
 
 
 

37. Which loop structure always executes at least once 

 
 
 
 

38. How many times does the loop get iterated :
for(i =0;i =10;i+ =2) printf(“Hi\\n”);

 
 
 
 

39. The _____ loop will execute at least even the condition is false 

 
 
 
 

40. The body of loop comes before the test condition in : 

 
 
 
 

41. Examine the following code and tell output  int count =1; while(count<5){ printf(“%d”,count); } 

 
 
 
 

42. ___structure executes the body of loop at least once :

 
 
 
 

43. The body of for loop with single statement ends with:

 
 
 
 

44. What will be the output of the following code segment : 
int n = 0 
 for (;;)
 { 
 if (n = = 10) break;
 n++;
 } 
 printf(“%d”, n );

 
 
 
 

45. Another term for a conditional operator is:

 
 
 
 

46. In while loop, the loop control variable always initialized _________. 

 
 
 
 

47. Semicolon is placed at the end of condition in : 

 
 
 
 

48. What will be the output of the following code segment : 
int x = 0; 
 for (x = 100; x = = 200; x ++); 
 printf(“%d”, x );

 
 
 
 

49. One execution of a loop is known as a(n):

 
 
 
 

50. In while loop, the increment / decrement statement are placed _________. 

 
 
 
 

51. When is for loop more appropriate than while loop?

 
 
 
 

52. While loop is also called

 
 
 
 

53. The for loop contains three expressions : initialization, test, and :

 
 
 
 

54. What will be the output of the following code segment : 
 int m = 10, n = 100; 
 do 
 { 
 m = m + (n ++);
 m ++ ;
 }while (m < 10);   printf(“%d”, m );

 
 
 
 

55. ___ is related to loop structures : 

 
 
 
 

56. A counter can be defined as:

 
 
 
 

57. How many times is the test expression of a switch statement evaluated?

 
 
 
 

58. ___ loop structures are available in C language :

 
 
 
 

59. The body of loop comes after the test condition in : 

 
 
 
 

60. What will be the output of following code : 
int x =5,c =0; If(x%2 = =1){for(;c< =5;c++) printf(“%d”,c);}

 
 
 
 

61. Which one is not a loop structure 

 
 
 
 

62. ___structure is used when programmer does not know is advance the  number of repetition of loop : 

 
 
 
 

63. In a group of nested loops, which loop is executed the most number of times : 

 
 
 
 

Short Questions

1. Define do while loop?
2. Define infinite loop.
3. Define loop.
4. Define the keyword “do” of the do-while statement?
5. Differentiate between sentinel-controlled loop and counter-controlled loop.
6. Differentiate between while and do-while loop?
7. Distinguish between break and continue statements used in loops.
8. How are instructions executed in repetition structure?
9. How does a programmer decide to use a while loop versus a for loop?
10. How many times the following loop will execute?
11. In nested repetition, which loop will execute a smaller number of times?
12. What are different types of loops available in C language?
13. What do you know about do-while loop?
14. What is “for” loop?
15. What is “while” loop?
16. What is a condition?
17. What is a counter loop?
18. What is a loop?
19. What is a sentinel-controlled loop?
20. What is counter-controlled loop?
21. What is do-while loop?
22. What is for loop?
23. What is go to statement?
24. What is iteration (loop or repetition)?
25. What is loop control variable?
26. What is nested loop?
27. What is nested loop? How does it work?
28. What is sentinel value?
29. What is the difference between while and do-while loop?
30. What is the goto statement?
31. What is the use of “goto” statement?
32. What is while loop?
33. What is while statement?
34. Which part of the loop contains the statements to be repeated?
35. Which program control statements are used to control iterations?
36. Which three steps must be done using loop control variable?
37. Why is the sentinel value used in loops?
38. Why loops are used?
39. Write a program for the following output?
40. Write the output for the following code?
41. Write three situations in which sentinel-controlled loop can be used.
42. Write two uses or advantages of loops.

Long Questions

1. What is a loop? Also write its different types.
2. What is while loop? Explain with the help of example and flow chart.
3. Write a program in C language that display numbers from 1 to 5 square and cube of each number using while loop.
4. What is a do-while loop? Explain with the help of example and flow chart.
5. What are the differences and similarities of while and do-while loop?
6. What is for loop? Explain with the help of example and flow chart.
7. What is nested loop? Explain with the help of example and flow chart.
8. What is sentinel control loop? Explain with the help of example.
9. What is goto statement? Explain with the help of an example.
10. What is an array? Explain with the help of an example.
11. Explain the purpose of “continue” statement.

Leave a Reply

Your email address will not be published. Required fields are marked *