Home
MCQS
Python MCQ Quiz Hub
MCQ on Flow of Control in Python Set 1
Choose a topic to test your knowledge and improve your Python skills
1. Python executes one statement after another from beginning to the end of the program. This is a __
Selection Construct
Sequential Construct
Iteration Construct
None of the above
2. The order of execution of the statements in a program is known as ___
flow of control
central flow
selection
iteration
3. Python supports _____________ types of control structures
1
2
3
4
4. Which of the following are control structure in python?
Selection
Iteration
Both of the above
Sequential
5. In programming, the concept of decision making or selection is implemented with the help of ___________ statement
while loop
for loop
if..else
None of the above
6. Execution of statements in _________________ construct depend on a condition test.
Selection
Sequence
Iteration
Repetition
7. Correct syntax of writing ‘simple if’ statement is _____
if condition statements
if (condition) statements
if condition : statements
if condition -- statements
8. _____ statements can be written in if block.
2
4
8
any number of
9. Which of the following is variant of conditional statement in Python?
simple if without else
if .. else
if .. elif
All the above
10. Number of elif in a program is dependent on the _____
number of conditions to be checked
number of variables in a program
number of loops in a program
None of the above
11. An ‘if’ condition inside another ‘if’ is called ___ a.
Second
nested
another if
All of the above
12. Leading whitespace (spaces and tabs) at the beginning of a statement is called _______
indentation
orientation
Iteration
None of the above
13. Write the output of the following code : if True: print("Hello") else: print("Bye")
Bye
Hello
Bye Hello
Hello Bye
14. Write the output of the following code : y=2 if 2!=y: print("H") else : print("K")
H
K
Error
Nothing will be printed
15. __ is an empty statement in Python.
Jump
Fail
Empty
Pass
16. Which of the following statement is not assigning a numerical value 8 to variable X, if original value of X is 0? ?
X = 8
X + = 8
X *= 8
None of the above
17. Write the output of the following : x = 10 if x > 7: print("Hello") print("Bye")
Bye
Hello
Bye Hello
Hello Bye
18. A statement inside ‘if’ has an indentation of _________ space
2
4
6
8
19. Ravi wants to display “Hello”, if the condition is True, otherwise, “Pass” if the condition is False. Which of the following help to implement the same?
if statement
if .. else statement
if .. elif statement
for loop
20. Ram wants to create a program to check whether an year is leap year or not. For this he should have a good understanding of __________
Conditional Statement
. for loop
while loop
All the above
21. if-elif statement is used in situation which involves ____________
multiple condition
exactly one condition
Both of the above
None of the above
22. What is the purpose of ‘else’ statement in if-elif ladder?
else statement in if-elif will execute, if none of the condition is True
else statement in if-elif will execute, if all the condition is True.
else statement in if-elif will execute, if the condition just above else statement is True
None of the above
23. Number of elif in if-elif ladder depends on _
number of conditions to be checked in program.
number of variables in program.
Both of the above
None of the above
24. A graphical representation that shows step by step solution to solve a given problem is __
Algorithm
Flow Chart
Line Chart
Pie Chart
25. Which of the following is not a keyword in Python?
True
False
if
For
Submit