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.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- 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
Assertion (A): When a set of statements is indented under the same block, starting from the same indentation, it is said to be a compound statement.
Reasoning (R): Compound Statement begins with a header ending with a colon (:) sign and the statements under the same indentation are marked as a block.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Assertion (A): The conditional flow of control is implemented using if statement.
Reasoning (R): if statements can only be used to execute a single statement or a block of statements if a certain condition is true.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Assertion (A): When a Python code is unable to accept an input, it results in runtime error.
Reasoning (R): Runtime error arises due to incorrect statement that results in no output.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Assertion (A): break and continue are termed as Jump statements.
Reasoning (R): Jump statements can only be used with looping constructs but not with conditional constructs.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.