Page 294 - Computer Science V2.0 Class 11
P. 294

3.  A conditional expression yields  either True or False.                                    ________
                4. if statement is a compound statement.                                                       ________
                 5.  A suite appears at the next level of indentation from the header clause.                  ________
              C.  Fill in the blanks.
                 1.  In the case of ______________ flow of a program, the order of execution of statements is the same as given in the
                    program.
                 2.  The sequential execution of the program begins with the __________ statement of the program.
                 3.  In the case of ______________ flow, the execution of the statements depends upon the value of a conditional expression.
                 4.  A header clause in a conditional statement always ends with a _________.
              D.  Answer the following questions:
                 1.  Why do we use a pass statement?
                 2.  Differentiate between the following:
                    a.  Simple and compound statements.
                    b.  Simple statement and pass statement
                    c.  if statement and if-else statement

                 3.  When do we use an elif clause in an if-else statement?
                 4.  Write logical expressions for the following:
                    a.  name is "Gaurav" or marks are between 50 and 90
                    b.  Either P is greater than 78 or Q is less than or equal to 60
                    c.  city is "Delhi" and qualification is "Graduate"

                 5.  Correct the following code. Underline all the corrections made.
                    if num1 = num2
                    print("Equal")
                    else:
                        print("Unequal");
                 6.  Give an example to illustrate the use of nested if statement.
                 7.  What will be the output produced on execution of the following code snippet.
                    (i)  When the input provided by user is
                      (a) 15 (b) 21.
                        num = int(input("Enter a number "))
                        if num%5 == 0:
                            print("Multiple of 5")
                        else:
                            print("Not Multiple of 5")
                    (ii)  result = 10
                        if result:
                            print("Success")
                        else:
                            print("Failure")
                    (iii)  When the input provided by user is
                        (a) 60 (b) 16 (c) 6 (d) 17
                        num = int(input('Enter an integer'))

                        if num%5 == 0:
                            num = num + 4
                            if num %4 == 0:
                                num = num +2


               280   Touchpad Computer Science (Ver. 2.0)-XI
   289   290   291   292   293   294   295   296   297   298   299