WorksheetsQuiz 1: Loop and Array
Total questions: 35
Worksheet time: 35mins
Name
Class
Date
1.
What is the output of the following code snippet?
a)
1 2 3 4 5
b)
1 3 5
c)
2 4 6
d)
1 1 1 1 1
2.
What is the output of the following code snippet?
a)
5 3 1
b)
2 4 6
c)
5 3
d)
5 4 3 2 1
3.
What is the output of the following code snippet?
a)
6
b)
7
c)
8
d)
9
4.
What is the output of the following code snippet?
a)
1 2 3 4 5
b)
1 2 3 4
c)
2 3 4 5
d)
1
5.
What is the output of the following code snippet?
a)
10 9 8 7 6
b)
10 9 8 7 6 5
c)
6 7 8 9 10
d)
5 6 7 8 9 10
6.
What is the output of the following code snippet?
a)
1 2 4
b)
1 2 3
c)
1 2 3 4
d)
1 3 4
7.
What is the output of the following code snippet?
a)
5 4
b)
1 2 3 4 5
c)
5 4 3 2 1
d)
5 4 3
8.
What is the output of the following code snippet?
a)
1 2
b)
1
c)
1 2 3
d)
2
9.
What is the output of the following code snippet?
a)
1 3
b)
1 3 5
c)
1 2 3
d)
1 2 3 4 5
10.
What is the output of the following code snippet?
a)
1 1 2 1 2 3 1 2 3 4
b)
1 2 3 4
c)
1 2 1 2 3 1 2 3 4
d)
1 1 2 1 2 3 1 2 3 4 1 2 3 4
11.
What is the output of the following code snippet?
a)
1 2 3 4 5 6
b)
1 3 5
c)
2 4 6
d)
1 2 3 4 5
12.
What is the output of the following code snippet?
a)
1 2 4 8
b)
1 2 3 4 5 6 7 8
c)
1 3 5 7
d)
1 2 3 4
13.
What is the output of the following code snippet?
a)
2 3 4 4 5 6 5 6 7 8
b)
2 3 4
c)
2 3 4 5
d)
2 3 4 5 6 7 8
14.
What is the output of the following code snippet?
a)
2 4 6 8 10 12 14 16 18 20
b)
1 2 3 4 5 6 7 8 9 10
c)
10 9 8 7 6 5 4 3 2 1
d)
20 18 16 14 12 10 8 6 4 2
15.
What code that will print this?
a)
Option 1
b)
Option 2
c)
Option 3
d)
Option 4
16.
What is the index of the first element in an single dimensional array?
a)
0
b)
1
c)
null
d)
-1
17.
What is the output of the following code snippet?
a)
2
b)
3
c)
4
d)
5
18.
What is the output of the following code snippet?
a)
2
b)
4
c)
6
d)
8
19.
What is the output of the following code snippet?
a)
0
b)
2
c)
null
d)
error
20.
What is the output of the following code snippet?
a)
1 2 3
b)
3 2 1
c)
1 3 2
d)
error
21.
What is the output of the following code snippet?
a)
1 2 3 4 5 6 7 8 9
b)
1 4 7 2 5 8 3 6 9
c)
1 2 3
d)
error
22.
What is the output of the following code snippet?
a)
1 2 3
b)
3 2 1
c)
1 3 2
d)
ArrayIndexOutofBoundsException
23.
What is the output of the following code snippet?
a)
1
b)
3
c)
4
d)
6
24.
What is the output of the following code snippet?
a)
0
b)
2
c)
3
d)
error
25.
What is the output of the following code snippet?
a)
1
b)
2
c)
3
d)
ArrayIndexOutOfBoundsException
26.
What is the output of the following code snippet?
a)
John
b)
Emma
c)
David
d)
ArrayIndexOutOfBoundsException
27.
What is the output of the following code snippet?
a)
i 5
b)
c 3
c)
o 6
d)
l 4
28.
What is the output of the following code snippet?
a)
null
b)
error
c)
ArrayIndexOutOfBound
d)
[ ]
29.
What is the output of the following code snippet?
a)
1
b)
2
c)
3
d)
4
30.
What is the output of the following code snippet?
a)
John
b)
Alice
c)
Emma
d)
ArrayIndexOutOfBounds
31.
What is the output of the following code snippet?
a)
2
b)
5
c)
8
d)
ArrayIndexOutOfBounds
32.
What is the output of the following code snippet?
a)
ArrayIndexOutOfBounds
b)
Java Python
c)
Python JavaScript
d)
Java C#
33.
What is the output of the following code snippet?
a)
true true
b)
true false
c)
false true
d)
false false
34.
What is the output of the following code snippet?
a)
ArrayIndexOutOfBoundsException
b)
Emma
c)
Alice
d)
Mary
35.
What is the output of the following code snippet?
a)
2 1 0
b)
2 1 -1
c)
2 1 null
d)
Compilation Error
100 %
