Page 107 - TP_V5.1_C7_fb
P. 107

REVISIT



                   ▶   A control structure is a programming language construct which affects the flow of the execution of a
                      program.
                   ▶   The statements that are executed in sequential order, i.e. one after the other without any jumps, are called
                      sequential statements.











                 1.  Tick ( ) the correct option.
                    a.  Which of the following is a selective structure?
                        (i)  Identifiers                            (ii)  if-else

                       (iii)  Operators                             (iv)  None of these
                    b.   Which of the following is a decision-making statement?

                        (i)  if                                     (ii)  for
                       (iii)  while                                 (iv)  All of these
                    c.  What is the output of the following Python code?

                      flag = True
                      if flag==False:
                          print("Hello")

                          print("From")
                      print("Orange")
                        (i)  Orange                                 (ii)  Hello
                                                                         From
                       (iii)  Hello From Orange                     (iv)  Hello

                    d.  What will be the final value of num  that is printed when we execute the following Python code?
                      num = 10

                      num += 5
                      num = 6
                      if num >=20:
                          print(num)
                      else:
                          print(num+2)
                        (i)  15                                     (ii)  21

                       (iii)  8                                     (iv)  Nothing will be printed





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