Important MCQ

if-else is used for

Q.if-else is used for

A) a two-way decision
B) repeating code
C) comments
D) declaring variables
Correct Answer:
Option A
Detailed Explanation:
A) a two-way decision is correct. An if-else statement makes a two-way decision: the if block runs when the condition is true, otherwise the else block runs. Exactly one branch is selected.