Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 144 - 2612_Digimind
P. 144

    Hashtag

                           #Indented: The way you follow to organise and document your source code
                           #Iteration: Repetition of an action

                            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.
                            When programmers are required to execute a particular set of statements depending upon a particular test
                          condition, a branching statement is required.

                      1.  Tick ( ) the correct option.

                          a.   A student writes a Python program to display their name, class and roll number one after another
                             without any condition. Which control structure is being used?

                              (i)  Selection structure                         (ii)  Iterative structure

                             (iii)  Sequential structure                       (iv)  Nested structure

                          b.   Riya writes a program where marks are checked and a message is printed only if marks are greater
                             than 40. Which statement should she use?

                              (i)  if-else statement                           (ii)  if statement

                             (iii)  if-elif-else statement                     (iv)  Nested if statement

                          c.   A student wants to control the flow of execution in a program based on conditions. What should
                             they use?

                              (i)  Control structures                          (ii)  Variables
                             (iii)  Data types                                 (iv)  Comments

                          d.   A  student  writes  a program  where if the  condition  is  false, another  block  of code  is  executed
                             automatically. Which statement is used?
                              (i)  if                                          (ii)  elif

                             (iii)  Nested if                                  (iv)  if-else

                      142   Premium Edition-VII

| 139 140 141 142 143 144 145 146 147 148 149 |