zuai-logo
zuai-logo
  1. AP Computer Science A
FlashcardFlashcardStudy GuideStudy GuideQuestion BankQuestion Bank

Inheritance in Object-Oriented Programming

Question 1
college-boardComputer Science AAPExam Style
1 mark

What does the class header “public class B extends C” mean?

Question 2
college-boardComputer Science AAPExam Style
1 mark

In a Java program, Class A and Class B are defined such that both have a method named methodOne() with different implementations, and Class C inherits from both Class A and Class B. If we create an object of Class C and call methodOne(), which version of methodOne() will be called?

Question 3
college-boardComputer Science AAPExam Style
1 mark

What are the terms for the classes established in an inheritance relationship?

Question 4
college-boardComputer Science AAPExam Style
1 mark

If we want to create a Vehicle class and a Truck class, which of the following makes the most sense?

Question 5
college-boardComputer Science AAPExam Style
1 mark

If we want Class Senior to be a subclass of Class Student, what should its header be?

Question 6
college-boardComputer Science AAPExam Style
1 mark

If classes E and F are created using the headers “public class E extends C” and “public class F extends C” respectively, what is true about them?

Question 7
college-boardComputer Science AAPExam Style
1 mark

In Java, a class can inherit from:

Feedback stars icon

How are we doing?

Give us your feedback and let us know how we can improve

Question 8
college-boardComputer Science AAPExam Style
1 mark

Consider the following class hierarchy: Class Animal contains objects like dog, cat, and bird, and Class WildAnimal, a subclass of Class Animal, contains objects like lion and tiger. Which of the following statements is true?

Question 9
college-boardComputer Science AAPExam Style
1 mark

What is the purpose of superclasses in object-oriented programming?

Question 10
college-boardComputer Science AAPExam Style
1 mark

Which keyword is used in the class header to create a subclass in Java?