Infinite While Loops in Java


Choose an answer and hit 'next'. You will receive your score and answers at the end.

question 1 of 3

When does an infinite loop happen?

Create Your Account To Take This Quiz

As a member, you'll also get unlimited access to over 79,000 lessons in math, English, science, history, and more. Plus, get practice tests, quizzes, and personalized coaching to help you succeed.

Try it risk-free
Try it risk-free for 30 days. Cancel anytime
Already registered? Log in here for access

1. Which code sample will result in an infinite while loop?

2. Examine the following code. This will create an infinite loop. What can be added to stop this from happening?

Create your account to access this entire worksheet
A Premium account gives you access to all lesson, practice exams, quizzes & worksheets
Access to all video lessons
Quizzes, practice exams & worksheets
Certificate of Completion
Access to instructors
Create an account to get started Create Account

About This Quiz & Worksheet

For this quiz and worksheet combo, you have the chance to review using infinite 'while' loops in Java. Questions focus on the conditions for an infinite loop and what will eventually happen to stop processing in Java.

Quiz & Worksheet Goals

Expect to see the following topics appear in the quiz questions:

  • When an infinite loop occurs
  • Code that outputs an infinite loop
  • A condition to tell the system to stop processing code within a loop
  • How Java deals with an infinite loop

Skills Practiced

  • Defining key concepts - ensure that you can name the condition for stopping processing of code in a loop
  • Information recall - remember what you have learned about creating an infinite loop
  • Knowledge application - use what you know to answer questions about what happens when Java continues to process an infinite loop

Additional Learning

For more practice with loops, click on the lesson titled Infinite While Loops in Java. With it, you can look into the extra topics mentioned below:

  • Advantages of infinite while loops
  • Samples of code
  • Boolean values