
CS402 T05

Quiz
•
Computers
•
Professional Development
•
Hard
Mike Wong
Used 1+ times
FREE Resource
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
Create a free account and access millions of resources
Similar Resources on Wayground
9 questions
JWD JS Test Bank 31-40

Quiz
•
Professional Development
10 questions
IT A OOPs Lab Quiz1

Quiz
•
Professional Development
12 questions
flow charts

Quiz
•
Professional Development
12 questions
JavaScript Quiz Day-1

Quiz
•
Professional Development
10 questions
Day 1 C Programming Quiz

Quiz
•
Professional Development
15 questions
Javascript Datatypes and Variables(Kushal Das)

Quiz
•
Professional Development
13 questions
Examen 2

Quiz
•
Professional Development
10 questions
c program -basic

Quiz
•
Professional Development
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

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

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th 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
Fun Random Trivia

Quiz
•
Professional Development
22 questions
Anne Bradstreet 1612-1672

Quiz
•
Professional Development
18 questions
Spanish Speaking Countries and Capitals

Quiz
•
KG - Professional Dev...
14 questions
Fall Trivia

Quiz
•
11th Grade - Professi...
15 questions
Disney Characters Quiz

Quiz
•
Professional Development
15 questions
Quiz to Highlight Q types & other great features in Wayground

Quiz
•
Professional Development