Page 108 - TP-Play_V-2.0_Book-8
P. 108

Exercise



            A.  Tick ( ) the correct option.

                1.  Which of the following statements is used to repeat a set of instructions until
                   a condition evaluates to true?
                   a.  while                                      b.  else

                   c.  if                                         d.  None of these
                2.  Which of the following is a looping statement in Python?

                   a.  while                                      b.  if
                   c.  break                                      d.  All of these

                3.  Which of the following statements allows to repeat a task for a fixed number of times?
                   a.  for                                        b.  if…else

                   c.  continue                                   d.  All of these

                4.  Which of the following is used for bringing the program control out of the loop?
                   a.  if                                         b.  for

                   c.  break                                      d.  None of these


            B.  Fill in the blanks using the words from the help box.


                                            infinite, break, one, continue, non-zero, false


                1.  A single break statement will break out of only ............................... loop.
                2.   Any ............................... value in the while loop indicates an always true condition whereas zero
                   indicates ............................... condition.

                3.  The ............................... loop never ends.
                4.  The ............................... and ............................... are the jump statements in Python.

            C.  Write 'T' for true and 'F' for false.

                1.  We cannot use do-while loop in Python.                                               ...............

                2.  The continue statement breaks the loops one by one.                                  ...............

                3.   To come out of the infinite loop, we can either close the program window

                   or press Ctrl + C.                                                                    ...............
                4.  A sequence is a succession of values bound together by a single name.                ...............

                5.  The while statement is the looping statement.                                        ...............






            108       Play (Ver. 2.0)-VIII
   103   104   105   106   107   108   109   110   111   112   113