OA. free
Free
Qualcomm Embedded Systems & Hardware Embedded Systems & Hardware Medium

Which of the statement(s) given below is/are are correct?

Qualcomm technical mcq question, verified with a worked answer. Free to practise - no sign-up.

Which of the statement(s) given below is/are are correct?

I) The inner if statement will be executed if the condition of the outer if statement evaluates to true.

II) The statements in the if block execute only if the specified condition evaluates to true.

Choose one option.
Show answer & explanation
Answer: D. Both (i) and (ii) are correct

Statement I is correct: nested if statements execute the inner condition only if the outer condition is true first—this is fundamental to control flow. Statement II is correct: if blocks execute their statements only when the condition evaluates to true; otherwise, they are skipped. Both statements accurately describe standard conditional execution behavior in programming.

Step-by-step Derivation:
Evaluation of each statement:

Statement I: Consider nested if statements:

if (outer_condition) {
    if (inner_condition) {
        // code
    }
}

The inner if is only reached (and thus executed) if outer_condition is true. This statement is TRUE.

Statement II: The if construct in all programming languages follows this rule:

if (condition) {
    // These statements execute only if condition == true
}

If condition is false, the block is skipped. This statement is TRUE.

Since both statements I and II are correct, the answer is D.