Python Programming Multiple Choice Question -
Conditionals And Loops

This section focuses on the "Conditionals And Loops" of the Python programming. These Multiple Choice Questions (mcq) should be practiced to improve the Python programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

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

View Answer

2. What keyword would you use to add an alternative condition to an if statement?

A. else if
B. elseif
C. elif
D. None of these

View Answer

3. Can we write if/else into one line in python?

A. Yes
B. No

View Answer

4. In a Python program, a control structure:

A. Defines program-specific data structures
B. Directs the order of execution of the statements in the program
C. Dictates what happens before the program starts and after it terminates
D. None of the above

View Answer

5. What will be output of this expression:
  'p' + 'q' if '12'.isdigit() else 'r' + 's'

A. pq
B. rs
C. pqrs
D. pq12

View Answer

6. Which statement will check if a is equal to b?

A. if a = b:
B. if a == b:
C. if a === c:
D. if a == b

View Answer

7. Does python have switch case statement?

A. True
B. False

View Answer

Also check :


* You must be logged in to add comment.