Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

oops

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Which statement about Java classes is true?

a)

A class must always contain a main method

b)

A class can have multiple constructors

c)

A class can’t have private fields

d)

An object can be created without a class

2.

Which members are not inherited by a subclass?

a)

Constructors

b)

Private fields

c)

Static methods

d)

Both (a) and (b)

3.

B can override A’s private methods

a)

If class B extends class A, what is correct?

b)

B can call A’s constructor directly

c)

B automatically inherits all public and protected members

d)

B cannot access A’s fields at all

4.

What is method overriding?

a)

a) Same method name, different return type, same class

b)

b) Same method name, different parameters, same class

c)

c) Same method name, same parameters, different class (inherited)

d)

d) Different method name, same class

5.

Which is runtime polymorphism?

a)

a) Method Overloading

b)

b) Method Overriding

c)

c) Constructor Overloading

d)

d) Static method hiding

6.

Which is true about interfaces?

a)

a) A class can implement multiple interfaces

b)

b) An interface can extend multiple interfaces

c)

c) An interface can extend a class

d)

d) Both a and b

7.

When an object is created:

a)

a) Only methods are loaded into memory

b)

b) Only data members are loaded into memory

c)

c) Both data members and methods are loaded

d)

d) Only constructor is loaded

8.

Which one is not polymorphism?

a)

a) Method overloading

b)

b) Method overriding

c)

c) Operator overloading

d)

d) Interface implementation

9.

Which statement is true?

a)

a) Abstract class supports multiple inheritance

b)

b) Interface supports multiple inheritance

c)

c) Both class & interface support multiple inheritance

d)

d) None support multiple inheritance

10.

Which is valid declaration?

a)

a) abstract final class Test {}

b)

b) public abstract class Test {}

c)

c) static abstract class Test {}

d)

d) private abstract class Test {}