12th Class Class Computer Mcqs Chapter No 12 | 2nd Year Computer Mcqs Chapter Wise Pdf

Chapter No 12

Loop Constructors

1. How many types of loop structures are in C choose which one is correct? 

  1. 3
  2. 4

2.          is a loop statement choose which one is correct:

  1. if
  2. while
  3. if-else
  4. switch

3. The loop which never ends is called choose which one is correct: 

  1. for loop
  2. nested loop 
  3. infinite loop
  4. All

4.            loop structures are available in C language choose which one is correct:

  1. do-while
  2. while
  3. for
  4. All of these

5.          is called counter loop choose which one is correct: 

  1. do-while
  2. while
  3. for
  4. Both (a) & (b)

6. Which one is not a loop structure 

  1. switch
  2. for
  3. while
  4. do-while

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

  1.  Variable
  2. Control Variable 
  3. Loop Variable
  4. Loop Control Variable

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

  1. Before the loop starts
  2. Inside the loop body 
  3. After the loop ends
  4. Outside the program 

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

  1. Before the loop starts
  2. Inside the loop body 
  3. After the loop ends
  4. Outside the program 

10.           structure executes the body of loop at least once choose which one is correct:

  1. do-while
  2. while
  3. for
  4. None 

11. The body of loop comes after the test condition in choose which one is correct: 

  1. do-while
  2. while
  3. for
  4. Both (b) and (c)

12. The while loop is also called choose which one is correct: 

  1. conditional loop
  2. wend loop 
  3. counter loop
  4. Attribute

13. The body of loop comes before the test condition in choose which one is correct: 

  1. do-while
  2. while
  3. for
  4. None 

14. Semicolon is placed at the end of condition in choose which one is correct: 

  1. while loop
  2. do-while loop
  3. switch
  4. All of these

15. The do-while loop ends with a ____ 

  1.  }
  2.  ) 
  3. ,
  4.  ;

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

  1.  while
  2. do-while 
  3. for
  4. All of above

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

  1. Loop condition
  2. Increment / decrement 
  3. Initialization expression
  4. All of above 

18.            is related to loop structures choose which one is correct: 

  1. Body of loop
  2. Loop control variable 
  3. Condition
  4. All of these

19.           structure is used when programmer does not know is advance the  number of repetition of loop choose which one is correct? 

  1. do-while
  2.  for
  3. while
  4. Both (a) and (c)

20. Loop with in a loop is called 

  1. Loops
  2. Multiple Loops 
  3. Many Loops
  4. Nested Loops

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

  1. 10
  2. 1

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

  1. 1234
  2. 12345 
  3. 111111…..
  4. 234 

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

  1. -2-11234
  2.  -2-1123 
  3. -3-4-5-6-7
  4. -2-1012 

24. One execution of the body of loop is called choose which one is correct: 

  1. iteration
  2. duration 
  3. cycle
  4. Text

25. What will be the value of ‘x’ after executing for(x=1 ; x<15;x++);  choose which one is correct? 

  1. 14
  2.  1 
  3. 16
  4. 15 

26. How many times does the loop get iterated choose which one is correct?

for(i=0;i=10;i+=2) printf(“Hi\\n”);

  1. 10
  2. 5
  3. None of Above

27. In a group of nested loops, which loop is executed the most number of times choose which one is correct? 

  1. The outermost loop
  2. The innermost loop 
  3. All loops at the same number of times
  4. Cannot be determined 

28. What will be value of c after the execution of following statements choose which one is correct?  c=-8; do{c++;}while(c>=5);

  1. -8
  2.  -6 
  3. -7
  4.  -9 

29.         is used to move the control to the start of loop body choose which one is correct: 

  1. continue
  2. break
  3. switch
  4. None 

30.         can be used to terminate the loop choose which one is correct: choose which one is correct: 

  1. terminate
  2. break
  3. stop
  4. exit

31. A special value that terminates the loop is called choose which one is correct:

  1. terminate value
  2. sentinel value
  3. control value
  4. end value 

32. The for loop contains three expressions choose which one is correct: initialization, test, and choose which one is correct:

  1. Character
  2. Float
  3. increment/decrement
  4. All

33. What will be the output of following code choose which one is correct? 

int x=5,c=0; If(x%2==1){for(;c<=5;c++) printf(“%d”,c);}

  1. 0123456
  2. 012345 
  3. 6
  4. Error Message

34. Which for loop will counts from 0 to 5 choose which one is correct? 

  1. for(int c=0; c<=6;c++)
  2.  for(c=0; c<5; c++); 
  3. for(c=0; c<=5; c++)
  4. for(int c=0; c<7; c++)

35. What will be the value of ‘x’ after executing the following code choose which one is correct? 

int x = 5; 

 while (++x > 5)

 break;

 printf(“%d”,x);

  1. 5
  2. 0
  3. None

36. What will be the output of the following code segment choose which one is correct? 

 int n = 5; 

 while (n > 5) 

 n * = 10; 

 printf(“%d”, n );

  1. 5
  2. 10 
  3. 50

37. What will be the output of the following code segment choose which one is correct? 

 int m = 10, n = 100; 

 do 

 { 

 m = m + (n ++);

 m ++ ;

 }while (m < 10); 

 printf(“%d”, m );

  1. 10
  2. 110 
  3. 111
  4. 112 

38. What will be the output of the following code segment choose which one is correct? 

 int x = 0; 

 for (x = 100; x = = 200; x ++); 

 printf(“%d”, x );

  1. 101
  2. 100 
  3. 201
  4. 200 

39. What will be the output of the following code segment choose which one is correct? 

 int n = 0 

 for (;;)

 { 

 if (n = = 10) break;

 n++;

 } 

 printf(“%d”, n );

  1. 0
  2. 10
  3. 11
  4. 12 

40. What is the final value of x when the code intx; for(x=0; x<10; x++) is run choose which one is correct? 

  1. 10
  2. 0