Python Control Structures
Python Control Structures - Important Points
1. | Which of the following is a control structure in Python? |
---|
A. Functions
B. Variables
C. Loops
D. Strings
View Answer Discuss Work SpaceAnswer: option c
Explanation:
Control structures are used to control the flow of execution in a program. Loops are one of the types of control structures in Python.
2. | Which of the following is not a type of loop in Python? |
---|
A. for loop
B. while loop
C. do-while loop
D. nested loop
View Answer Discuss Work SpaceAnswer: option c
Explanation:
3. | Which loop executes a block of code a fixed number of times? |
---|
A. for loop
B. while loop
C. do-while loop
D. switch loop
View Answer Discuss Work SpaceAnswer: option a
Explanation:
4. | Which loop executes a block of code as long as a specified condition is true? |
---|
A. for loop
B. while loop
C. do-while loop
D. switch loop
View Answer Discuss Work SpaceAnswer: option b
Explanation:
5. | Which statement is used to exit a loop prematurely in Python? |
---|
A. break
B. continue
C. pass
D. exit
View Answer Discuss Work SpaceAnswer: option a
Explanation: