Page 112 - TP_Play_V2.2_Class8
P. 112

Scratch Your Brain.                                                Century   #Critical Thinking
                                                                                          21 st
                                                                                          Skills
                      1.  Write the output of the following programs:

                         a.  x=1
                             sum=0
                             while(x<=10):
                                 sum=sum+x
                                 x=x+1
                             print (sum)
                         b.   start = 1

                             end = 10
                             for number in range(start, end + 1):
                                 square = number ** 2
                                 print("The square of", number, "is", square)
                         c.  i = 2

                             while True:
                                 if i%3 == 0:
                                     break
                                 print(i)
                                 i += 2
                         d.  i = 0

                             while i < 5:
                                 print(i)
                                 i += 1
                                 if i == 3:
                                     break
                                 else:
                                     print(0)
                         e.  numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
                                for number in numbers:
                                  if number % 2 == 0:
                                     print(number, "is even")
                                 else:
                                     print(number, "is odd")
                      2.  Competency-based/Application-based questions:

                         a.   Aahana wants to repeat a block of statements for a given number of times, until the control
                            condition is false. Which type of construct can she use for this? Write its syntax.

                         b.   Your brother Atharv wants to write a statement which will cause the program to skip the rest of
                            the statement of the current block and to move to the next iteration of the loop. But he is unable
                            to do it. Suggest the statement he should use for this.










                  110  Plus (Ver. 4.0)-VIII
   107   108   109   110   111   112   113   114   115   116   117