wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Quiz_Java01

Total questions: 24

Worksheet time: 14mins

Name
Class
Date
1.
a)

BubbleSort

b)

SelectionSort

c)

InsertionSort

d)

None of the above

2.

Local variable which is?

a)

is declared inside the class but outside the method

b)

is declared inside the method

c)

All of the above

3.

What is the output of these statements?

for (int i = 1; i <= 10; ++i) {

System.out.print(i);

}

a)

2345678910

b)

23456789

c)

234567891011

d)

12345678910

4.

Which of the following opinion is TRUE about break and continue statement?

a)

continue leaves a loop, break jumps to the next iteration.

b)

break skips the current iteration of a for, while , or do-while loop

c)

break leaves a loop, continue jumps to the next iteration.

d)

None of the above

5.
a)

012

b)

0123

c)

01234

d)

None of the above

6.

Types of Java Comments include:

a)

Single Line Comment

b)

Multi Line Comment

c)

Documentation Comment

d)

Single Line Comment and Multi Line Comment

e)

All answers are TRUE

7.
a)

BubbleSort

b)

SelectionSort

c)

InsertionSort

d)

None of the above

8.
a)

BubbleSort

b)

SelectionSort

c)

InsertionSort

d)

None of the above

9.

Which opinion is TRUE about naming conventions in java?

a)

class name should start with uppercase letter and be a noun

b)

interface name should start with uppercase letter and be an adjective

c)

method name should start with lowercase letter and be a verb

d)

variable name should start with lowercase letter

e)

All of the Answers

10.

The object cloning is a way to create exact copy of an object?

a)

True

b)

False

11.
a)

1

b)

2

c)

3

d)

4

12.
a)

Prints: 12

b)

Prints: 1,4,7

c)

Prints: 2,5,8

d)

Prints: 3,6,9

13.
a)

Prints: false,false,false

b)

Prints: false,false,true

c)

Prints: false,true,false

d)

Prints: true,false,false

14.
a)

Prints: false,false,false

b)

Prints: false,false,true

c)

Prints: false,true,true

d)

Prints: false,true,false

15.
a)

Prints: 1,true

b)

Prints: 2,true

c)

Prints: 1,false

d)

Prints: 2,false

16.
a)

Prints: 0,0

b)

Prints: 1,0

c)

Prints: 0,1

d)

Prints: 1,1

17.
a)

Prints: 3

b)

Prints: 4

c)

Prints: 5

d)

Prints: 6

18.
a)

Prints: 3,4,8

b)

Prints: 7,2,6

c)

Compile-time error

d)

Run-time error

19.
a)

Prints: 390

b)

Prints: 195195

c)

Prints: 195ab

d)

Prints: ab195

20.
a)

1

b)

2

c)

3

d)

4

21.
a)

Prints: A

b)

Prints: B

c)

Prints: C

d)

Compile error

22.
a)

Prints: ABC

b)

Prints: ABCC

c)

Prints: CBA

d)

Prints: ABCBCC

23.
a)

Prints: 0001

b)

Prints: 012

c)

Prints: 012012

d)

Prints: 012345

24.

Which of the following is not primitive data type?

a)

byte

b)

short

c)

enum

d)

int