Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

JAVA Round 3

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

What will be the output? int[] arr = {1,2,3}; System.out.println(arr.length);

a)

2

b)

3

c)

4

d)

Error

2.

Which interface supports sorting?

a)

Comparable

b)

Runnable

c)

Cloneable

d)

Serializable

3.

Which keyword prevents serialization?

a)

volatile

b)

static

c)

transient

d)

final

4.

Which keyword prevents inheritance?

a)

static

b)

final

c)

private

d)

abstract

5.

Which exception is checked?

a)

ArithmeticException

b)

IOException

c)

NullPointerException

d)

ArrayIndexOutOfBoundsException

6.

What will be the output? int a = 5; System.out.println(a++ + ++a);

a)

11

b)

12

c)

13

d)

14

7.

Which Java feature supports lambda?

a)

Class

b)

Functional Interface

c)

Package

d)

Thread

8.

What will be the output? Integer a = 100; Integer b = 100; System.out.println(a==b);

a)

true

b)

false

c)

Error

d)

None

9.

Which keyword is used to throw exception manually?

a)

throws

b)

throw

c)

try

d)

catch

10.

Which operator checks object type?

a)

instanceof

b)

typeof

c)

equals

d)

compare

11.

What will be the output? int x = 10; System.out.println(x==10 ? "Yes" : "No");

a)

Yes

b)

No

c)

Error

d)

None

12.

Which collection is synchronized by default?

a)

ArrayList

b)

Vector

c)

HashMap

d)

HashSet

13.

Which method compares string content?

a)

==

b)

equals()

c)

compare()

d)

match()

14.

What will be the output? try{ int x = 10/0; } catch(Exception e){ System.out.print("Error"); }

a)

Compile Error

b)

Runtime Error

c)

Error

d)

No output

15.

Which collection stores key-value pairs?

a)

List

b)

Set

c)

Map

d)

Queue

16.

Which access modifier allows access within package and subclasses?

a)

private

b)

default

c)

protected

d)

public

17.

What will be the output? for(int i=0;i<3;i++){ System.out.print(i); }

a)

012

b)

123

c)

0123

d)

01

18.

What will be the output? String s = "Java"; s.concat("World"); System.out.println(s);

a)

JavaWorld

b)

World

c)

Java

d)

Error

19.

Which memory stores local variables?

a)

Heap

b)

Stack

c)

Method Area

d)

Cache

20.

What will be the output? System.out.println(10/3);

a)

3

b)

3.33

c)

3.0

d)

Error