Java Inheritance Quiz

Quiz
•
Computers
•
11th Grade
•
Easy
Wayground Content
Used 16+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code snippet if `class B extends A` and both classes have a method `display()` that prints "A" in class A and "B" in class B, and method `display()` of class B calls `super.display()`? ```java B obj = new B(); obj.display(); ```
A
B
AB
BA
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What access modifier should be used for a superclass method to ensure that it can be overridden by any subclass in any package?
private
protected
public
default
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which principle of Object-Oriented Programming is demonstrated by method overriding?
Encapsulation
Inheritance
Polymorphism
Abstraction
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a correct way to call a superclass method from a subclass in Java?
super.methodName();
this.methodName();
superclass.methodName();
methodName();
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In Java, which keyword is used to refer to the parent class of a class?
parent
super
this
base
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is method overriding in Java?
Changing the value of a method's parameters in the subclass.
Providing a specific implementation of a method that is already provided by its superclass.
Removing a method from the superclass in the subclass.
Calling a method from the superclass in the subclass.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What keyword is used to inherit a class in Java?
extends
implements
inherits
uses
Create a free account and access millions of resources
Similar Resources on Wayground
11 questions
Python OOP Quiz

Quiz
•
11th Grade
10 questions
BTEC DIT C3 LAA - Cloud Computing

Quiz
•
10th - 11th Grade
15 questions
Java Scanner Quiz

Quiz
•
11th Grade
10 questions
Moringa JavaScript Arrays

Quiz
•
5th Grade - Professio...
10 questions
AP CSP - Python Lists and Arrays

Quiz
•
9th - 12th Grade
12 questions
Java Class vocabulary

Quiz
•
9th Grade - University
10 questions
Mid semester kelas XI RPL Konsep pemodelan berorientasi objek

Quiz
•
11th Grade
15 questions
39. OCR A Level (H446) SLR7 – 1.2 Object-oriented languages part

Quiz
•
11th Grade
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
20 questions
Digital Citizenship

Quiz
•
8th - 12th Grade
35 questions
Computer Baseline Examination 2025-26

Quiz
•
9th - 12th Grade
13 questions
Problem Solving Process

Quiz
•
9th - 12th Grade
10 questions
Understanding Algorithms with Pseudocode and Flowcharts

Interactive video
•
9th - 12th Grade
19 questions
AP CSP Unit 1 Review (code.org)

Quiz
•
10th - 12th Grade