
Inheritance Quiz
Computers
11th - 12th Grade
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is the correct syntax to indicate that class A is a subclass of B?
public class B extends A {public A implements B {public class A : super B {public class A extends B {2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the following classes:public class Vehicle {...}public class Car extends Vehicle {...}public class SUV extends Car {...}
Car c = new SUV();
SUV s = new Car();
Car c = new Vehicle();
SUV s = new Vehicle():
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Can an object be a subclass of another object?
Yes---as long as single inheritance is followed.
No---inheritance is only between classes.
Only when one has been defined in terms of the other.
Yes---when one object is used in the constructor of another.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is correct syntax for defining a new class Jolt based on the superclass SoftDrink?
class Jolt isa SoftDrink { //additional definitions go here }
class Jolt implements SoftDrink { //additional definitions go here }
class Jolt defines SoftDrink { //additional definitions go here }
class Jolt extends SoftDrink { //additional definitions go here }
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Does a subclass inherit both member variables and methods?
No--only member variables are inherited.
No--only methods are inherited.
Yes--both are inherited.
Yes--but only one or the other are inherited.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is NOT an advantage to using inheritance?
Code that is shared between classes needs to be written only once.
Similar classes can be made to behave consistently.
Enhancements to a base class will automatically be applied to derived classes.
One big superclass can be used instead of many little classes.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What restriction is there on using the super reference in a constructor?
It can only be used in the parent's constructor.
Only one child class can use it.
It must be used in the last statement of the constructor.
It must be used in the first statement of the constructor.
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?