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
5 questions
AP CSA Unit Review #2

Quiz
•
9th - 12th Grade
5 questions
Topic 2.4 Video 2

Quiz
•
11th Grade
8 questions
Unit 9 Quiz 1 Review

Quiz
•
9th - 12th Grade
9 questions
Object-Oriented Languages Quiz

Quiz
•
11th Grade
10 questions
Summary 5.1-5.4

Quiz
•
9th - 12th Grade
9 questions
Module 6-Data Link Layer

Quiz
•
9th Grade - University
13 questions
ITC: Chapter 4 Lesson 2 Windows Basics

Quiz
•
11th Grade
7 questions
CodeHS 4.12 Inheritance

Quiz
•
9th - 12th Grade
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade