
Interface Vs Inheritance test
Authored by M Khurram
Computers
University

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
What will happen?
Compiles successfully
Compile error due to ambiguity
Runtime error
Must implement twice
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
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
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

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?