Page 74 - Modular_V2.0_C++_Flikpbook
P. 74

Exercise



                  A.   Tick ( ) the correct option.
                       1.  Which of the following is a looping statement in C++?

                           a.  for statement                            b.  do-while
                           c.  while statement                          d.  All of these
                       2.  Which of the following statements is correct about the while loop?
                           a.  Repeat a block of code a given number of times

                           b.  Repeat a block of code until a condition is true
                           c.  Repeat a block of code until a condition is false
                           d.  Repeat a block of code indefinitely

                       3.  Which of the following statements is used to repeat a task for a fixed number of times?
                           a.  for statement                            b.  continue statement
                           c.  while statement                          d.  break statement

                       4.  Which statement is used to transfer the control to a specific location in the program.
                           a.  goto                                     b.  do-while
                           c.  while                                    d.  break

                       5.  Which of the following is not a jump statement in C++?
                           a.  goto                                     b.  continue
                           c.  for                                      d.  break

                  B.   Write ‘T’ for true and ‘F’ for false.

                       1.  There is no difference between do-while and while loops.                      ……………………
                       2.  Continue statement breaks the loop.                                           ……………………
                       3.  Break statement can break out of multiple loops at a time.                    ……………………

                       4.  Do-while loop checks the condition at the end.                                ……………………

                       5.  Continue statement skips the current iteration of the loop.                   ……………………
                  C.   Fill in the blanks using the words given below:



                                                     do-while, infinite, Iteration, nested, three


                       1.  C++ provides ……………….....…… types of loops.

                       2.  The body of the ……………….....…… loop executes at least once.
                       3.  ……………….....…… is the process of running a loop one time.

                       4.  If a loop executes inside another loop, it is known as ……………….....…… loop.

                       5.  A loop that never ends is called an ……………….....…… loop.


                   72
                          Touchpad MODULAR (Ver. 2.0)
   69   70   71   72   73   74   75   76   77   78   79