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?
- 3
- 2
- 4
- 5
2. is a loop statement choose which one is correct:
- if
- while
- if-else
- switch
3. The loop which never ends is called choose which one is correct:
- for loop
- nested loop
- infinite loop
- All
4. loop structures are available in C language choose which one is correct:
- do-while
- while
- for
- All of these
5. is called counter loop choose which one is correct:
- do-while
- while
- for
- Both (a) & (b)
6. Which one is not a loop structure
- switch
- for
- while
- do-while
7. A variable whose value controls the number of iterations is known as _________.
- Variable
- Control Variable
- Loop Variable
- Loop Control Variable
8. In while loop, the loop control variable always initialized _________.
- Before the loop starts
- Inside the loop body
- After the loop ends
- Outside the program
9. In while loop, the increment / decrement statement are placed _________.
- Before the loop starts
- Inside the loop body
- After the loop ends
- Outside the program
10. structure executes the body of loop at least once choose which one is correct:
- do-while
- while
- for
- None
11. The body of loop comes after the test condition in choose which one is correct:
- do-while
- while
- for
- Both (b) and (c)
12. The while loop is also called choose which one is correct:
- conditional loop
- wend loop
- counter loop
- Attribute
13. The body of loop comes before the test condition in choose which one is correct:
- do-while
- while
- for
- None
14. Semicolon is placed at the end of condition in choose which one is correct:
- while loop
- do-while loop
- switch
- All of these
15. The do-while loop ends with a ____
- }
- )
- ,
- ;
16. The _____ loop will execute at least even the condition is false
- while
- do-while
- for
- All of above
17. The _____________ of for loop executed only once in the first iteration
- Loop condition
- Increment / decrement
- Initialization expression
- All of above
18. is related to loop structures choose which one is correct:
- Body of loop
- Loop control variable
- Condition
- 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?
- do-while
- for
- while
- Both (a) and (c)
20. Loop with in a loop is called
- Loops
- Multiple Loops
- Many Loops
- Nested Loops
21. What is the final value of x when the code int x; for(x=0;x<10;x++){} is run
- 10
- 9
- 1
- 0
22. Examine the following code and tell output int count=1; while(count<5){ printf(“%d”,count); }
- 1234
- 12345
- 111111…..
- 234
23. Examine the following code and tell output int count=-2; while(count<3){ printf(“%d”,count); count+ = 1;}
- -2-11234
- -2-1123
- -3-4-5-6-7
- -2-1012
24. One execution of the body of loop is called choose which one is correct:
- iteration
- duration
- cycle
- Text
25. What will be the value of ‘x’ after executing for(x=1 ; x<15;x++); choose which one is correct?
- 14
- 1
- 16
- 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”);
- 10
- 2
- 5
- None of Above
27. In a group of nested loops, which loop is executed the most number of times choose which one is correct?
- The outermost loop
- The innermost loop
- All loops at the same number of times
- 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);
- -8
- -6
- -7
- -9
29. is used to move the control to the start of loop body choose which one is correct:
- continue
- break
- switch
- None
30. can be used to terminate the loop choose which one is correct: choose which one is correct:
- terminate
- break
- stop
- exit
31. A special value that terminates the loop is called choose which one is correct:
- terminate value
- sentinel value
- control value
- end value
32. The for loop contains three expressions choose which one is correct: initialization, test, and choose which one is correct:
- Character
- Float
- increment/decrement
- 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);}
- 0123456
- 012345
- 6
- Error Message
34. Which for loop will counts from 0 to 5 choose which one is correct?
- for(int c=0; c<=6;c++)
- for(c=0; c<5; c++);
- for(c=0; c<=5; c++)
- 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);
- 5
- 6
- 0
- 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 );
- 5
- 10
- 50
- 0
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 );
- 10
- 110
- 111
- 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 );
- 101
- 100
- 201
- 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 );
- 0
- 10
- 11
- 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?
- 10
- 9
- 0
- 1