0% found this document useful (0 votes)
42 views4 pages

Flow of Control1

The document contains a worksheet with 20 multiple choice questions about Python flow control statements like if, else if, for loops, break, continue etc. It tests the understanding of basic Python conditional and looping constructs through different code snippets.

Uploaded by

VK CREATION
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views4 pages

Flow of Control1

The document contains a worksheet with 20 multiple choice questions about Python flow control statements like if, else if, for loops, break, continue etc. It tests the understanding of basic Python conditional and looping constructs through different code snippets.

Uploaded by

VK CREATION
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

AKT MEMORIAL VIDYA SAAKET SENIOR SECONDARY SCHOOL

Worksheet 1 ( FLOW OF CONTROL)

CLASS : XI SUB : COMPUTER SCIENCE(083)

1. Which one of the following is a valid Python if statement :


a) if a>=2 : b) if (a >= 2) c) if (a => 22) d) if a >= 22

2. Which of following is not a decision-making statement.


a) if-elif statement b. for statement c. if -else statement d. if statement

3. What does the following code print to console.


if True:
print(1001)
else:
print(2002)
a) 1001 b.true c.2002 d. false

4. What will be the output of the following Python code?


If 4+5==10:
print(“TRUE”)
else:
print(“false”)
print (“True”)

a. False
True

b. True
True

c. false

d. none

5. What keyword would you use to add an alternative condition to an if


statement?
a. else if b. elseif c. elif d. None of the
above

6. What will be the output of the following Python code?


str1=”learn python”
str2=””
str3=””
for x in str1:
if(x==”r” or x==”n” or x==”p”):
str2+=x
pass
if(x==”r” or x==”e” or x==”a”):
str3+=x
print(str2,end=” “)
print(str3)
a) rnpn ea b) rnpn ear c) rnp ea d) rnp ear

7. Predict the output of the following code:


X=3
if x>2 or x<5 and x==6:
print(“ok”)
else:
print(“no output”)
a . ok b. okok c. no output d. none of
above

8. Predict the output of the following code:


x,y=2,4
if(x+y= =10):
print(“true”)
else:
print(“false”)
a. true b .false c. no output d. none

9. Consider the following code segment:


a = int(input(“Enter an integer: “))
b = int(input(“Enter an integer: “))
if a <= 0:
b = b +1
else:
a=a+1
if a > 0 and b > 0:
print (“W”)
elif a > 0:
print(“X”)
if b > 0:
print(“Y”)
else:
print(“Z”)
What letters will be printed if the user enters -1 for a and -1 for b?
a) Only W b. Only X c. Only Y d. Only Z

10. If the user inputs : 2<ENTER>, what does the following code snippet
print?
x = float(input())
if(x==1):
print(“Yes”)
elif (x >= 2):
print(“Maybe”)
else:
print (“No”)
a.Yes b.No c.Maybe d.Nothing is
printed

11. The ……………… statement forms the selection construct in Python.


a) If else if b..if c. For ; d.for

12. In Python, …………………. defines a block of statements.


a. Block b.loop c.indentation d.{}

13. An ……………… statement has less number of conditional checks than


two successive ifs.
a) If else if
b. if elif
c. if-else
d. none
14. The……….. clause can occur with an if as well as with loops.
a) else
b. break
c. continue
d. none
15. The ………….statement terminates the execution of the whole loop.
a) continue
b) exit
b. breake
c. break
16. The ……….. operator tests if a given value is contained in a sequence or
not.
a) In:
b) in
b. not in
c. none
17. An empty /null statement in Python is …………….
a) pass
b. none
c. null
d. none
e.
18. The break and continue statements, together are called
…………….statement.
a) Jump
b. goto
c. compound
d. none
19. The order of statement execution in the form of top to bottom is known
as construct.
a) Alternate b.sequence c.flow of data d. flow chart

20. Q.25 The two membership operators are ……….and …………


a) in, not in
b. true , false
c.=,==
d. none

You might also like