Search Header Logo

Java Inheritance & Polymorphism Quiz

Authored by Viswanath E

Information Technology (IT)

University

Used 3+ times

Java Inheritance & Polymorphism Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

25 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What is the purpose of inheritance in Java?

To define multiple constructors

To reuse existing code

To create new data types

To hide data from other classes

2.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which keyword is used for inheritance in Java?

inherit

extends

override

implements

3.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Can a subclass constructor directly access a private member of its superclass?

Yes, always

No, private members are not accessible

Only using super

Only in the same package

4.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What happens when both superclass and subclass have a field with same name?

Superclass field is accessed through superclass reference

Compilation error

Java doesn't allow field hiding

Subclass field hides superclass field

5.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Can we override a method that throws an exception with one that doesn't?

No

Only if both throw same exception

Only if exception is unchecked

Yes

6.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which of these allows multiple inheritance?

Abstract classes

Interfaces

Classes

Constructors

7.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which of the following is an example of polymorphism?

Method Overloading

Declaring interfaces

Using only static methods

Declaring final variables

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?