![]() |
VOOZH | about |
Question 1
What will be the output of the following code?
A
B
Compilation Error
No Output
Question 2
How many times will the following loop execute?
5 times
6 times
Infinite times
Compilation Error
Question 3
What is the output of the following Java code?
0 1 2 3 4
0 1
0 1 2
No Output
Question 4
What is the correct syntax for a do-while loop in Java?
do { } while (condition);
while (condition) { }
do (condition) { }
while { condition };
Question 5
What will be the output of the following nested loop?
1,1 1,2 2,1 2,2 3,1 3,2
1,1 2,1 3,1 1,2 2,2 3,2
1,1 1,2 1,3 2,1 2,2 2,3
Compilation Error
Question 6
What happens if the condition in an if statement is false?
It throws an error
Else block runs (if available)
Code inside if runs
Program exits
Question 7
Which loop guarantees execution at least once?
for
while
do-while
foreach
Question 8
Which keyword is used to skip the current iteration in a loop?
break
exit
continue
skip
Question 9
What is the correct structure for a switch-case block?
switch {}
switch:
switch() {}
switch[]
Question 10
Which loop is the best suited for traversing arrays directly?
for
while
do-while
for-each
There are 10 questions to complete.