KnowledgeBoat Logo
|

Computer Science

Assertion (A): In an if-else statement, the if block checks the true part whereas the else checks for the false part.

Reasoning (R): if-else is a conditional construct where else block is mandatory.

  1. Both A and R are true and R is the correct explanation of A.
  2. Both A and R are true but R is not the correct explanation of A.
  3. A is true but R is false.
  4. A is false but R is true.

Python Control Flow

1 Like

Answer

A is true but R is false.

Explanation
In an if-else statement, the if block checks the condition for the true part, whereas the else block executes if the condition is false. The else block in an if-else statement is not mandatory.

Answered By

2 Likes


Related Questions