QuestionQ98

VerifiedControl Flow – Conditional Blocks and Loops

How many stars will the following code snippet print to the monitor?

Question Image

Explanation

The first loop iteration changes i from 4 to 2, prints one star, and then executes break because i == 2. A break exits the loop immediately and prevents the loop’s else clause from running.

Community Discussion

No comments yet. Be the first to start the discussion!