Introduction to While Loops Quiz
5 Questions
1 Views

Introduction to While Loops Quiz

Created by
@CapableChaparral

Questions and Answers

What is the general format of the while loop?

  • while {expression} statement;
  • while (expression) { statement; }
  • while (statement) { expression; }
  • while (expression) statement; (correct)
  • When is the expression in a while loop evaluated?

  • Before each execution of the statement (correct)
  • After each execution of the statement
  • Only once at the beginning of the loop
  • At the end of the loop
  • What kind of loop is the while loop?

  • Conditional loop
  • Post-test loop
  • Infinite loop
  • Pretest loop (correct)
  • In a while loop, what happens if the expression is false?

    <p>The loop is finished and program statements following execute</p> Signup and view all the answers

    What will happen if no change occurs to the condition in a while loop?

    <p>An infinite loop will occur</p> Signup and view all the answers

    Use Quizgecko on...
    Browser
    Browser