Page 106 - Trackpad_V2.1_class8
P. 106

21 st   #Critical Thinking
                  5.  Application-based questions.                                              Century
                                                                                                 Skills  #Technology Literacy
                      a.   Shweta was writing a program in which she wanted to execute a particular set of
                         statements depending upon a particular test condition. Which type of statements can
                         she use for this?

                      b.   Swara 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.

                      c.   Manvi 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. Which statement should she use
                         for this?
                  6.  Write the output of the following codes in Python:

                      a.  l = 29

                        m = 29
                        if m > l:
                            print("m is greater than l")

                        elif l == m:
                            print("l and m are equal")
                         _______________________________________________________________________________

                         _______________________________________________________________________________

                      b.  Sum1=0

                        n = int(input("Please enter a number"))
                        for i in range(1, n+1, 1):

                            Sum1 += i

                        print("Sum is: ", Sum1)
                         _______________________________________________________________________________

                         _______________________________________________________________________________

                      c.  num = 24894

                        count = 0
                        while num != 0:

                             num //=10
                             count+= 1

                        print("Total digits are : ", count)
                         _______________________________________________________________________________

                         _______________________________________________________________________________










                  104   Trackpad (V2.1)-VIII
   101   102   103   104   105   106   107   108   109   110   111