Search Header Logo

Interface Vs Inheritance test

Authored by M Khurram

Computers

University

Interface Vs Inheritance test
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

5 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What will happen?

Compiles successfully

Compile error due to ambiguity

Runtime error

Must implement twice

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What will happen when class C implements both interfaces A and B, each having a default method with the same signature?

The compiler will throw an error due to ambiguity.

The default method from interface A will be used.

The default method from interface B will be used.

The class C will inherit both methods.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you FIX the error in Question 2?

Use super.speak() directly

Delete one interface

Override speak() in class C

Use extends instead of implementation

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What will happen?

Compiles successfully

Compile-time error

Runtime error

It prints both A and B

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which is the correct syntax?

Class Dog extends Animal implements Pet, Guard

Class Dog implements Pet extends Animal

Class Dog extends Animal, Pet

Class Dog implements Animal, Pet

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?