PYTHON If Statement MCQ
Python MCQ- Home
- Tutorials
- Python
- If Statement
- Multiple Choice Question
(1) Which of the following will invert the result of relational expression?
A) AND
B) OR
C) NOT
D) XOR
Explanation
NOT operator will return FALSE if given condition is TRUE, and return TRUE is given condition is FALSE.
(2) If both conditions are TRUE then it will return TRUE.
A) AND
B) OR
C) NOT
D) XOR
Explanation
AND operator will return true only if all the provided results are true.
(3) which operator is used with multiple conditions in if statement?
A) Assignment
B) Logical
C) Arithmetic
D) Unary
Explanation
In python logical operators are used to combine results of multiple relational expressions.
(4) How many conditions can be used with single if statement?
A) One
B) Two
C) Four
D) Multiple
Explanation
We can use multiple relational expressions / conditions with single if statement.
(5) In python programming if statements are written after ________ tabs.
A) One
B) Two
C) Three
D) Four
Explanation
Statements that will execute when condition is TRUE are placed after one tab.
(6) Statement or set of statements are executed only if provided relational expression is.
A) TRUE
B) FALSE
C) NEUTRAL
D) EQUAL
Explanation
Only statements are executed when result of condition is true.
(7) In python which of the following operator is used after condition of if statement?
A) Semicolon (;)
B) Comma (,)
C) Colon (:)
D) Dot (.)
Explanation
Colon is the operator that is used after relational expression or condition of if statement.
(8) In python which of the following keyword is used to implement selection structure?
A) if
B) condition
C) sel
D) select
Explanation
if is a python keyword, which is used to implement simple selection structure.