Page 107 - TrackpadV5.1_class8
P. 107

c.   Name the statement that skips the rest of the statement of the current block and moves to the next
                        iteration of the loop.

                         (i)  continue                                    (ii)  break
                        (iii)   pass                                     (iv)  return

                    d.   In a for loop, which function is commonly used to generate a sequence of numbers?
                         (i)   list()                                     (ii)  tuple()
                        (iii)  range()                                   (iv)  set()

                    e.   Identify the statement that is used in loops to terminate the loop.
                         (i)  if                                          (ii)  continue

                        (iii)   break                                    (iv)  None of these
                 2.  Fill in the blanks using the words from the help box.


                                                    for, else, if, continue, elif


                    a.   The _____________ statement is used to control the flow of execution based on a condition.
                    b.   The _____________ block is executed when the condition in an if statement is false.
                    c.   The _____________ loop is used when the number of iterations is known.

                    d.   The _____________ keyword is used to check multiple expressions for true and execute a block of
                        code as soon as one of the conditions is true.

                    e.   The _____________ statement is used to skip the rest of the current iteration of a loop and move to
                        the next iteration.

                 3.  Answer in one or two words.
                    a.   Name the type of control structure that repeats a block of code based on a
                        condition.                                                                     ____________
                    b.  What is the term for writing an if statement inside another if statement?      ____________

                    c.   Which statement is used to evaluate multiple scenarios in a programming
                        language?                                                                      ____________
                    d.   What is the programming construct that affects the flow of execution in a
                        program?                                                                       ____________

                 4.  Think and answer.

                    a.   What is a control structure?
                        _____________________________________________________________________________
                        ______________________________________________________________________________

                        ______________________________________________________________________________

                    b.  Explain the difference between the if and if-else statements in Python.
                        ______________________________________________________________________________

                        ______________________________________________________________________________
                        ______________________________________________________________________________



                                                                                        Control Structures in Python  105
   102   103   104   105   106   107   108   109   110   111   112