Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 40 - 2501_KVS_C-7
P. 40

    4.      A ________________ is a condition that evaluates to True or False in if…else
                                   statement.
                              5.    The if…else statement is also known as ________________ .

                        C.   Tick (ü) the correct option.

                              1.    What is output of this code?
                                   spam=9

                                   if spam>6:
                                         print("Nine")
                                   if spam>17:
                                         print("Seventeen")
                                   a. Nine                  b. Seventeen         c. Six                d. Nothing
                              2.    What signifies the end of a statement block?
                                   a. A comment             b. }
                                   c. end                   d. A line that is indented less than the previous line
                              3.    Following code will return:

                                         if False:
                                             print("Audi")
                                         else:
                                             print("Mercedez")
                                   a. Audi                  b. Mercedez          c. True               d. False

                              4.    Following code will return:
                                         if 1:
                                             print("Honest")
                                         else:
                                             print("Biased")
                                   a. Honest                b. Biased            c. Nothing            d. Syntax Error
                              5.    Following code will return:
                                         if 5==15%3:

                                             print("5")
                                            else:
                                             print(15%3")
                                   a. 5                     b. 0                 c. 15%3               d. Syntax Error

                                 Something to Do

                        1.      Write a Python program to accept two integers and check whether these are equal or not.

                        2.    Write a Python program to check whether the inputted number is even or odd.
                        3.    Write a Python program to accept two integers and display maximum between them.
                        4.    Write a Python program to accept two integers and display minimum between them.

                        5.      Write a Python program to accept the percentage of marks and display "Pass" if marks is
                              greater than  40 percent otherwise display "Fail".

                    38                         KVS DELHI REGION 2025

| 35 36 37 38 39 40 41 42 43 44 45 |