Page 158 - 2620_Birla Open Mind C-7
P. 158

E.     Brain Boost.                                                                   21 st
                                                                                                  Century   #Critical Thinking
                                                                                                    Skills
                     1.  What will be the output of the following programs?
                         a.  a = 200

                            b = 33
                            if (b > a):

                              print("b is greater than a")

                            else:
                              print("b is not greater than a")

                         b.  x = 10

                           y = 5
                           if (x > 5):

                               print("x is greater than 5")
                               if (y > 2):

                                   print("y is greater than 2")
                               else:

                                   print("y is not greater than 2")
                          else:

                               print("x is not greater than 5")
                         c.  num = 3.4

                            if (num > 0):
                                print("Positive number")

                            elif (num == 0):

                                print(“Zero”)
                            else:

                                print("Negative number")

                         d.  x = 31
                            if (x > 10):

                              print("Above ten")

                              if (x > 20):
                                print("and also above 20!")

                              else:
                                print("but not above 20.")







                  156  Premium Edition-VII
   153   154   155   156   157   158   159   160   161   162   163