Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 138 - 2626_South Point_C-7
P. 138

    test Your skiLLs

                      1.  Tick ( ) the correct option.
                         a.  Which of the following conditional statements is used to test multiple conditions?

                            (i)  if                                         (ii)  if…else

                            (iii)  if…elif…else                             (iv)  All of these
                         b.  What will be the output of the following code?

                         if(True):
                              print(“Hello”)
                         else:

                              print(“Hi”)
                            (i)  Hello                                      (ii)  Hi

                            (iii)  Hello Hi                                 (iv)  Nothing will print
                         c.   Which of the following is not the conditional statement in Python?

                            (i)  if Statement                               (ii)   if…else Statement
                            (iii)  if...elif...else Statement               (iv)  None of these

                         d.  What is the answer of the expression, 2**2**2?

                            (i)  2                                          (ii)  16
                            (iii)  4                                        (iv)  8

                         e.  If a = 20 and b = 10, then what will be the output of the following code:

                         if (false):
                              print(a + b)
                         else:
                              print(a – b)
                            (i)  30                                         (ii)  20

                            (iii)  10                                       (iv)  Nothing will print
                      2.  Write 'T' for true and 'F' for false.

                         a.  The if…else statement is the simplest conditional statement.                   ____________
                         b.   Python does not allow nested if statement.                                    ____________

                         c.  The if…elif…else ladder is not a conditional statement in Python.              ____________
                         d.    The if statement executes a command if the provided condition evaluates
                            to true.                                                                        ____________
                         e.  The if...elif...else statement allows you to test multiple conditions.         ____________

                      136   Premium Edition-VII

| 133 134 135 136 137 138 139 140 141 142 143 |