Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 107 - 2607_Trackpad_Pro_5.1_flipbook_C7
P. 107

    2.  Fill in the blanks using the words from the help box.

                                    sequential, control structure, selection, 20 22, straight line, nested if

                         a.   A _____________ is a programming construct which affects the flow of the execution of a program.
                         b.   The statements which are executed one after the other without any jumps are called
                            _____________ statements.
                         c.   When programmers are required  to  execute  a particular  set  of statements  depending  upon  a
                            particular test condition, a _____________ statement is required.
                         d.   If a = 20, then the code if(a//2 == 10): print(a, a+2) will print _____________ .
                         e.  A sequential structure is also known as a _____________ path.

                         f.  The if statement inside if-else statement is an example of _____________ statement.

                      3.  Answer in one or two words.
                         a.  What is the final value printed when we execute the following Python code?

                            a = 3
                            b = 4
                            if(a>b):
                                a = a ** 2 + 5 - 1
                                print(a/2)
                            else:
                                b = b + a + 3 - 4
                                print(b/2)
                            ______________________________________________________________________________________

                         b.  What is returned by the conditional expression used in the if statement?
                            ______________________________________________________________________________________
                            ______________________________________________________________________________________

                         c.  If a  = 10, then what is the output of the following code?

                            if(a%4 == 0):
                                print("Hello")

                            else:
                                print("Bye")
                            ______________________________________________________________________________________

                      4.  Think and answer.
                         a.   What do you understand by control structure?
                            ______________________________________________________________________________________

                         b.  What is the use of if-elif-else statement? Write its syntax.

                            ______________________________________________________________________________________
                            ______________________________________________________________________________________

                      106   Premium Edition-VII

| 102 103 104 105 106 107 108 109 110 111 112 |