Page 54 - tp_Modula_v2.0
P. 54

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



                                                        infinite, break, while, continue


                      1.   The …………………… statement executes a set of statements repeatedly, until the logical expression
                          remains true.

                      2.  The …………………… loop never ends.

                      3.  The …………………… and …………………… are the jump statements in Python.
                  D.  Short answer type questions.
                      1.  What is looping?
                      2.  Write the syntax of the for loop.
                      3.   What is the use of Jump statement?

                  E.  Long answer type questions.
                      1.  Draw the flowchart of the for loop.
                      2.   Define the use of while statement with the help of an example and flowchart.
                      3.   Distinguish between continue and break statements.
                  F.  Write the output of the following programs.                                 Critical Thinking

                      1.  x=1
                           sum=0
                           while(x<=10):
                               sum=sum+x
                                x=x+1
                           print(sum)

                      2.   fruits = ["apple", "banana", "cherry"]
                           for x in fruits:
                          print(x)

                      3.  i = 2
                           while True:
                               if i%3 == 0:
                                   break
                               print(i)
                               i += 2


                      4.  i = 0
                           while i < 5:
                                print(i)
                                i += 1
                               if i == 3:
                                 break
                           else:
                                print(0)



                   52     Touchpad MODULAR (Version 2.0)
   49   50   51   52   53   54   55   56   57   58   59