NEW
Font size
WorksheetsJava Basic Algorithms Quiz: Assignment Statements
Total questions: 20
Worksheet time: 10mins
What will be printed after executing this code?
5
8
3
13
What is the value of `result` after this code executes?
3
1
2
0
What will print?
Java
Programming
Java Programming
Compilation Error
Given the code: What is the output?
3.75
3
4
15
After execution, what is `count`?
0
4
5
6
How many times will this loop execute?
4 times
5 times
6 times
Infinite loop
What is the output of this loop?
a) 0 1 2
b) 1 2 3
What will this code print?
4
9
10
1234
Which loop is most efficient for iterating exactly 100 times?
a) `while(true)` loop
b) `for(int i = 0; i < 100; i++)`
c) `do-while` loop
d) `for(int i = 0; i <= 100; i++)`
What does this loop print?
a) 5 4 3 2 1
b) 5 4 3 2
c) 2 3 4 5
d) 1 2 3 4 5
What is the output?
10
20
30
40
What is the length of this array?
0
2
3
4
What will this code print?
(this one is just a bit tricky)
0
null
5
Compilation Error
What is the output?
5
10
15
25
What does this code do?
(there are two things in this code you haven't had, but I know you can figure it out. Not a trick)
Prints: a b c
Declares an array of characters
Loops through the array
Prints the length of the array
What is the output?
You haven't had chartAt(i) but it's a shortcut for substring(I,I+1)
H
e
l
I don't know what's i
What will print?
3
4
5
J
What is the result?
Pro
Pr
Program
Programming
What does this print?
JAVA
java
Java
JaVa
What is the output?
true
false
Code
Compilation Error
