Question:

Match List-I with List-II 

Choose the correct answer from the options given below: 
 

Show Hint

Remember the difference between `break` and `continue`: `break` \textbf{b}reaks \textbf{o}ut of the loop entirely. `continue` \textbf{c}ontinues to the next iteration. For `if` vs `switch`, `if` is more flexible and can check complex, unrelated conditions, while `switch` is for checking many possible constant values of a single variable.
Updated On: Sep 24, 2025
  • (A) - (I), (B) - (II), (C) - (III), (D) - (IV)
  • (A) - (I), (B) - (III), (C) - (II), (D) - (IV)
  • (A) - (II), (B) - (I), (C) - (IV), (D) - (III)
  • (A) - (III), (B) - (IV), (C) - (I), (D) - (II)
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is C

Solution and Explanation

Step 1: Understanding the Concept:
This question tests the understanding of basic control flow statements in programming languages like C++, Java, or C.
Step 2: Detailed Explanation:
Let's analyze the correct pairing for each statement in List-I:
(A) if statement: An `if` statement evaluates a boolean expression. It can be made complex by combining multiple expressions with logical operators (`&&`, `||`) and can be chained with `else if` to check a sequence of different conditions. Thus, it (I) can have multiple conditions.
(B) switch statement: A `switch` statement evaluates a single variable or expression and compares its value against a series of `case` constants. It is based on the value of one integral or enum expression. Therefore, it (II) can only have one condition (whose value is then checked against multiple cases).
(C) break statement: When used inside a loop or a `switch` block, the `break` statement immediately terminates the innermost enclosing loop or `switch` statement. Control passes to the statement following the terminated statement. Thus, it (IV) exits the entire loop.
(D) continue statement: When used inside a loop, the `continue` statement ends the current iteration of the loop and proceeds to the next iteration. It (III) skips the current iteration and continues with the next.
Step 3: Final Answer:
The correct pairings are: (A)-(I), (B)-(II), (C)-(IV), (D)-(III). Let's examine the provided options. None of the options match this correct pairing. There is an error in the question's options. However, if we are forced to choose the "best" fit, let's analyze option (3): (A)-(II), (B)-(I), (C)-(IV), (D)-(III). This option correctly matches `break` (C) with (IV) and `continue` (D) with (III). It incorrectly swaps the descriptions for `if` (A) and `switch` (B). Given that two out of the four pairings are correct, this is the most likely intended answer, despite the error in the first two pairings.
Was this answer helpful?
0
0

Questions Asked in CUET PG exam

View More Questions