
CS402 T05
Authored by Mike Wong
Computers
Professional Development
Used 2+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
1. What is the purpose of a while loop in Java?
To execute a block of code once
To execute a block of code multiple times based on a condition
To define a constant variable
To define an array
2.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
2. How does a do-while loop differ from a while loop?
It does not check the condition at all
It checks the condition before the loop body executes
It executes the loop body at least once before checking the condition
It only works with numeric values
3.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
3. Which of the following terminates a loop immediately?
continue
break
return
exit
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
4. What is the output of the following code?
int count = 0;
while (count < 4) {
System.out.println("Hello");
count++;
}
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
No output
5.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
5. Which loop is most suitable for reading user input until a sentinel value is entered?
for loop
while loop
do-while loop
Nested loop
6.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
6. What does the continue statement do in a loop?
Exits the loop
Restarts the loop
Ends the loop
Skips the current iteration and continues with the next
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
7. What will be the value of sum after this loop executes?
int sum = 0;
for (int i = 1; i <= 5; i++) {
sum += i;
}
5
10
15
20
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
13 questions
Java GUI Unit 2 Review
Quiz
•
University - Professi...
10 questions
Systemy operacyjne
Quiz
•
6th Grade - Professio...
11 questions
Послеолимпиадный квиз!
Quiz
•
Professional Development
11 questions
Types of Mass Media
Quiz
•
10th Grade - Professi...
10 questions
Intro to Node.js
Quiz
•
Professional Development
10 questions
Friday Fun
Quiz
•
Professional Development
10 questions
Bundlers
Quiz
•
Professional Development
11 questions
Technology Morning Tea Quiz
Quiz
•
KG - Professional Dev...
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
Discover more resources for Computers
10 questions
How to Email your Teacher
Quiz
•
Professional Development
6 questions
3RD GRADE DECLARATION OF INDEPENDENCE EXIT TICKET
Quiz
•
Professional Development
19 questions
Black History Month Trivia
Quiz
•
6th Grade - Professio...
22 questions
Multiplying Exponents with the Same Base
Quiz
•
9th Grade - Professio...
40 questions
Flags of the World
Quiz
•
KG - Professional Dev...