Page 100 - TP_Modular_V2.1_Class7
P. 100

else:

                           print("x is odd")
                        a.  x is even                                     b.  x is odd

                        c.  Both a and b                                  d.  None of these

                      3. Which of the following is the result of a conditional expression?

                        a.  Always True                                   b.  Always False

                        c.  Both a and b                                  d.  Either True or False
                      4. Which of the following statement is true about nested if statement?

                        a.   The second nested if indented block will run only when the first if condition evaluates
                           to be True.
                        b.   The second nested if indented block will run only when the first if condition evaluates
                           to be False.

                        c.  The if statement inside other if statement is called nested if.
                        d.  Both a and c


                      5.  Ravi wants to create a program in Python that assigns grades (A, B, C, and D) to the students
                        according to their percentage of marks. Which of the following is the best suitable option to
                        achieve this?
                        a.  Simple if statement                           b.  The if…else statement

                        c.  The if…elif…else statement                    d.  None of these


                  B.  Fill in the blanks using the words given below:


                                                           True, Top-down, elif, False


                     1.  If a conditional expression return ................................., statements inside the if block are executed.

                     2.  The else part is executed only when the condition specified with if returns ..................................
                     3.  The if…elif…else ladder follows a ................................. approach.

                     4.  There can be multiple ................................. blocks with the if block.

                  C.  Short answer type questions.
                     1.  What will be the output of the following code, if x = -10:


                       if (x > 10):
                           print("x is greater than 10")

                       elif (x < 10):

                           print("x is less than or equal to 10")



                   98       Modular (Ver. 2.1)-VII
   95   96   97   98   99   100   101   102   103   104   105