for loops & while loops

Quiz
•
Computers
•
University - Professional Development
•
Hard
Used 4+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which is the correct?
for (int i = 0; i < COUNT; i++)
{
}
for (int i = 0; i < COUNT; i++);
{
}
for (int i = 0; i < COUNT; i+)
for (int i = 0 i < COUNT i++)
{
}
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which will print "Hello Karel" 1000 times?
for (int i = 0; i < 100; i++)
{
System.out.println("Hello Karel");
}
for (int i = 0; i < 1000; i++)
{
System.out.println("Hello Karel");
}
for (int i = 0 i < 1000; i++)
System.out.println("Hello Karel");
}
for (int i = 0; i < 1000; i+)
{
System.out.println("Hello Karel");
}
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following will count down from 1 to 10 without error?
public class WhileLoop extends ConsoleProgram
{
public void run()
{
int i = 10;
while(i >= 0)
System.out.println(i);
i--;
}
}
public class WhileLoop extends ConsoleProgram
{
public void run()
{
int i = 10;
while(i >= 0)
{
System.out.print(i);
i--;
}
}
}
public class WhileLoop extends ConsoleProgram
{
public void run()
{
int i = 9;
while(i >= 0)
{
System.out.println(i);
i--;
}
}
}
public class WhileLoop extends ConsoleProgram
{
public void run()
{
int i = 10;
while(i >= 0)
{
System.out.println(i);
i--;
}
}
}
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Pick the for loop which duplicates this while loop:
int x = 0;
while ( x < 500 )
{
System.out.println( x );
x = x + 5;
}
for ( int x = 5; x <= 500; x+=5 )
System.out.println( x );
for ( int x = 0; x < 500; x+=5 )
System.out.println( x );
for ( float x = 0.0; x < 500.0; x += 5.0 )
System.out.println( x );
for ( int x = 500; x >= 0; x-=5 )
System.out.println( x );
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the following print?
for ( int j = 0; j < 5; j++ )
{
for ( int k = 0; k < 10 ; k++ )
System.out.print( "*" );
System.out.println( );
}
**********
**********
**********
**********
**********
**********
**********
**********
**********
**********
**********
**********
**********
**********
**********
*****
*****
*****
*****
*****
*****
*****
*****
*****
*****
*
*
*
*
*
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code fragment?
for ( int count = 0; count <= 20; count+=2 )
System.out.print( count + " " );
System.out.println( );
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
0 2 4 6 8 10
0 2 4 6 8 10 12 14 16 18
0 2 4 6 8 10 12 14 16 18 20
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
var i = 0;
while (i < 3)
{
println("Hello There");
i++;
}
What does the code output?
Hello There
Hello There
Hello There
Hello There
Hello There
Hello There
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Java SE: Programming I

Quiz
•
Professional Development
15 questions
Java Quiz based on array

Quiz
•
University
10 questions
Java Programming Basics

Quiz
•
University
12 questions
Operators in C

Quiz
•
University
15 questions
Java Programming

Quiz
•
University
10 questions
Java Control Flow statements

Quiz
•
University
12 questions
javaquizvivek

Quiz
•
University
15 questions
Java

Quiz
•
University
Popular Resources on Wayground
10 questions
SR&R 2025-2026 Practice Quiz

Quiz
•
6th - 8th Grade
30 questions
Review of Grade Level Rules WJH

Quiz
•
6th - 8th Grade
6 questions
PRIDE in the Hallways and Bathrooms

Lesson
•
12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
15 questions
Subtracting Integers

Quiz
•
7th Grade
Discover more resources for Computers
11 questions
All about me

Quiz
•
Professional Development
10 questions
How to Email your Teacher

Quiz
•
Professional Development
15 questions
Let's Take a Poll...

Quiz
•
9th Grade - University
5 questions
Setting goals for the year

Quiz
•
Professional Development
2 questions
Pronouncing Names Correctly

Quiz
•
University
14 questions
2019 Logos

Quiz
•
Professional Development
34 questions
WH - Unit 2 Exam Review -B

Quiz
•
10th Grade - University
21 questions
Mapa países hispanohablantes

Quiz
•
1st Grade - University