QuestionQ190Verified/Control Flow – Conditional Blocks and LoopsCopy linkReport a problemAsk AstroTutorSave questionWhat occurs when the user executes the following code? AThe program enters an infinite loop.BThe program outputs one asterisk ( * ) to the screen.CThe program outputs five asterisks ( ***** ) to the screen.DThe program outputs three asterisks ( *** ) to the screen.Show AnswerAnswerExplanationThe initial value of speed is 3, which does not satisfy speed < 0, so the while loop body is skipped. A while loop’s else block runs when the loop finishes without encountering break, and it prints one asterisk.Show comments0Show commentsCommunity DiscussionNo comments yet. Be the first to start the discussion!
Community Discussion