Page 134 - Touchpad_Plus_V3.2_Class 8
P. 134

2.  Repeat 6 times                 start
                         (
                            Put a cross
                            Move 1 right
                            Move 1 down
                          )






                        .....................................................................................................................................................................................................

                        .....................................................................................................................................................................................................

                        .....................................................................................................................................................................................................

                        .....................................................................................................................................................................................................



                                                         Mind Boggler



                                                                                                 21 st   #Critical Thinking
                  A.  Competency-based/Application-based questions.                            Century
                                                                                                Skills  #Technology Literacy
                      1.   Lokesh has created a program in which he has written blocks of code multiple times
                         to cover the path ten times if a given condition is true. What can he used to reduce
                         the lines of code in his program?

                      2.   Your sister Vidhya wants to display “Yes” or “No” for a year to be both a leap year
                         and a century year. But she is unable to do so. Write the program for her.

                  B.  What will be the output of the following codes?

                     1.  def f(x):
                          y = x**x
                          return y
                      print ("testing...")
                      print ("passing the value 4")
                      z = f(2)
                               print ("the function returns", z)
                     2.  def power(x, n):
                               result = 1
                         for i in range (n):
                                   result *=x
                               return result
                      a = int (input ("Enter number"))
                      b = int (input ("Raise to power"))
                      pw = power (a, b)
                      print(a, "raise to power", b, "is", pw)


               132      Plus (Ver. 3.2)-VIII
   129   130   131   132   133   134   135   136   137   138   139