
CPT 236 Test 2 Review

Quiz
•
Computers
•
University
•
Medium
Reza Naqvi
Used 4+ times
FREE Resource
78 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
How many times will the following code print "Welcome to Java"?
int count = 0;
while (count++ < 10) {
System.out.println("Welcome to Java");
}
8
9
10
11
0
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Do the following two statements in (I) and (II) result in the same value in sum?
(I):
for (int i = 0; i < 10; ++i) {
sum += i;
}
(II):
for (int i = 0; i < 10; i++) {
sum += i;
}
yes
no
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
How many times will the following code print "Welcome to Java"?
int count = 0;
while (count < 10) {
System.out.println("Welcome to Java");
count++;
}
8
9
10
11
0
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the value in count after the following loop is executed?
int count = 0;
do {
System.out.println("Welcome to Java");
} while (count++ < 9);
System.out.println(count);
8
9
10
11
0
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
How many times is the println statement executed?
for (int i = 0; i < 10; i++)
for (int j = 0; j < 10; j++)
System.out.println(i * j);
100
20
10
45
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the number of iterations in the following loop?
for (int i = 1; i < n; i++) {
// iteration
}
2*n
n
n - 1
n + 1
7.
MULTIPLE SELECT QUESTION
1 min • 1 pt
Which of the following loops prints "Welcome to Java" 10 times?
for (int count = 1; count <= 10; count++) {
System.out.println("Welcome to Java");
}
for (int count = 0; count < 10; count++) {
System.out.println("Welcome to Java");
}
for (int count = 1; count < 10; count++) {
System.out.println("Welcome to Java");
}
for (int count = 0; count <= 10; count++) {
System.out.println("Welcome to Java");
}
Create a free account and access millions of resources
Similar Resources on Wayground
75 questions
APCS Principles Practice Exam

Quiz
•
8th Grade - University
80 questions
Day - 8 Complete Syllabus (Core JAVA)

Quiz
•
University
83 questions
ch 4,5

Quiz
•
University
80 questions
โครงสร้างข้อมูลและอัลกอริทึม

Quiz
•
University
79 questions
NET1L - Lesson 4 (Physical Layer)

Quiz
•
University
74 questions
Debug and complete code

Quiz
•
University
74 questions
Linked List

Quiz
•
University
75 questions
REM UAS Sistem Komputasi dan Pemrograman

Quiz
•
University
Popular Resources on Wayground
50 questions
Trivia 7/25

Quiz
•
12th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
11 questions
Negative Exponents

Quiz
•
7th - 8th Grade
12 questions
Exponent Expressions

Quiz
•
6th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
20 questions
One Step Equations All Operations

Quiz
•
6th - 7th Grade
18 questions
"A Quilt of a Country"

Quiz
•
9th Grade