Page 79 - Digicode_AI_class_8
P. 79

B.  What will be the output of the following programs?
                  1.  A=12

                     B=14
                     C=18

                     if (A+B>C) and (B+C>A) and (C+A>B):
                     print(“Yes! Triangle can be drawn”)

                  2.  for number in range(0, 10):
                     if number % 3 == 0:

                          print(number)
                  3.  number = 63

                     if number % 3 == 0:
                          if number % 7 == 0:

                          game.splash ("Number is divisible by both 3 and 7")
                          else:
                          game.splash ("Number is divisible by 3 only")

                     elif number % 7 == 0:

                          if number % 3 == 0:
                          game.splash ("Number is divisible by 7 and 3")
                          else:

                          game.splash("Number is divisible by both 7 and 3")
                     else:

                          game.splash ("Number is divisible by neither 7 nor 3")
                  4.  int age = 18:
                     if (age>=18)

                          print(“You are Adult”):

                     else
                          print(“You are Minor”):




                                                                                   Experiential Learning
               Competency-based/Application-based questions                        Information Literacy

              1.   Ayaan has created a program in which he declared an array with variables of the integer data type.
                 He needs to remove an item from the array. Which function will he use to do so?

              2.   Pranjal needs to check if a number is even or odd. Which conditional statement can be used by
                 Pranjal to do so?




                                                                           Advanced MakeCode Arcade       77
   74   75   76   77   78   79   80   81   82   83   84