wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Java quiz based on inheritance

Total questions: 10

Worksheet time: 9mins

Name
Class
Date
1.

Output of following Java Program?

a)

Derived::show() called

b)

Base::show() called

c)

Run time Error

d)

Compilation Error

2.

Output of following Java Program?

a)

10

b)

20

c)

Compilation Error

d)

Run Time Error

3.

Output of following Java Program?

a)

12

b)

321

c)

123

d)

23

4.

What will be the output of following program?

a)

Base::show() called

b)

Derived::show() called

c)

Compiler Error

d)

Runtime Error

5.

What will be the output of the following program?

a)

Base::show() called

b)

Derived::show() called

c)

Compiler Error

d)

Run Time Error

6.

Which inheritance in java programming is not supported

a)

Multiple inheritance using classes

b)

Multiple inheritance using interfaces

c)

Multilevel inheritance

d)

Single inheritance

7.

What is subclass in java?

a)

A subclass is a class that extends another class

b)

A subclass is a class declared inside a class

c)

Both above.

d)

None of the above.

8.

Output of following Java program?

a)

Base

Derived

Derived

b)

Base

Base

Derived

c)

Base

Derived

Base

d)

Compiler Error

9.

Predict the output of following program

a)

Base

b)

Derived

c)

Compiler Error

d)

Runtime Error

10.

Predict the output of following Java Program

a)

Compiler Error

b)

Grandparent's Print()

Parent's Print()

Child's Print()

c)

Child's Print()

Parent's Print()

Grandparent's Print()

d)

Runtime Error