Computer Science 12th Chapter 12 - Loop Constructs Questions Bank

Computer Science 12th Chapter 12 - Loop Constructs Questions Bank
Computer Science 12th Chapter 12 - Loop Constructs Questions Bank

Computer Science 2nd Year Chapter 12 - Loop Constructs Solved MCQs, Important Short Questions and Long Questions Bank

MCQs

Please select the right answer.

1. ___ is related to loop structures : 






2. ___ loop structures are available in C language :






3. ___can be used to terminate the loop : : 





4. ___is a loop statement :





5. ___is called counter loop : 





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





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





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






9. A counter can be defined as:






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





11. A loop within a loop is called:





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





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






14. Another term for a conditional operator is:





15. Conditional operator is an alternative of 





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





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






18. Graphical representation of a program is called:





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






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





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





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





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





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





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





26. Loop with in a loop is called 






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





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





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





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





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





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





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





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






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






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





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





38. The do-while loop ends with a ____ 






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





40. The loop which never ends is called : 





41. The while loop is also called : 





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





43. This means to increase a value by one:





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





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





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





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





48. 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 );






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





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





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





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






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





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





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





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





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





58. Which loop structure always executes at least once 





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





60. Which one is not a loop structure 





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





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





63. While loop is also called






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.

Post a Comment (0)
Previous Post Next Post