Page 80 - TP_V5.1_C8_fb
P. 80

On running the above program, we get the following output:

                      Output

                   Number of digits: 6






                       REVISIT


                    ▶   Iterative statements refer to the statements that are used to repeat a task based on a given condition.
                    ▶   These statements are used to exit the loop or current iteration even if the condition has not become false.






                                                                                                       Life Skills & Values
                                                           Self Reflection

                    A computer program is made up of a set of instructions. It blindly follows all the instructions that are given
                                                           Self Reflection
                    to it to perform a set of desired actions. Do you think humans work the same way, or do they sometimes
                    question the instructions given to them? Elaborate.






                         Hashtag

                       #Indented: Refers to the spaces at the beginning of a code line
                       #Iteration: Repetition of an action











                  1.  Tick ( ) the correct option.
                     a.  Which of the following loops is used when the number of iterations is known?

                         (i)  for                                     (ii)  while

                        (iii)  range                                 (iv)  None of these
                     b.  Which statement is used in loops to terminate the loop?

                         (i)  if                                      (ii)  continue

                        (iii)  break                                 (iv)  All of these
                     c.   Which of the following statements is used to repeat a block of code?

                         (i)  for                                     (ii)  while

                        (iii)  Both (i) and (ii)                     (iv)  if-else



                   78   Premium Edition-VIII
   75   76   77   78   79   80   81   82   83   84   85