Search Header Logo

OOP2 Understanding Inheritance in OOP

Authored by A Beacham

Computers

11th Grade

Used 22+ times

OOP2 Understanding Inheritance in OOP
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is inheritance in object-oriented programming?

A mechanism to create private attributes

A way to reuse code by creating a new class from an existing class

A method to delete attributes from a class

A process to convert a class into a function

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In the context of the provided example, what is the superclass of the `Employee` class?

LightBulb

Person

SalariedEmployee

HourlyPaidEmployee

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a derived class in the given example?

Person

Employee

LightBulb

Method

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of overriding a method in a subclass?

To delete the method from the superclass

To provide a more specific implementation of a method in the subclass

To create a new class

To change the class name

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you call a method from the superclass if it has been overridden in the subclass?

By using the `super` keyword

By renaming the method

By deleting the subclass method

By using the `override` keyword

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In the example, what additional attribute does the `Employee` class have compared to the `Person` class?

Date of Birth

National Insurance Number

Salary

Job Title

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the relationship between `SalariedEmployee` and `Employee` in the example?

`SalariedEmployee` is a superclass of `Employee`

`SalariedEmployee` is a subclass of `Employee`

They are unrelated

They are the same class

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?