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

Inheritance in Object-Oriented Programming

Question 1
college-boardComputer Science AAPExam Style
1 mark

What advantage does overriding afford when dealing with arrays or collections that hold objects belonging to both parent and child classes?

Question 2
college-boardComputer Science AAPExam Style
1 mark

When overriding a method, how should access privileges be modified?

Question 3
college-boardComputer Science AAPExam Style
1 mark

When a subclass in Java overrides a superclass method, what is required for the overridden method to maintain proper polymorphic behavior?

Question 4
college-boardComputer Science AAPExam Style
1 mark

Can you override private methods from the superclass in the subclass?

Question 5
college-boardComputer Science AAPExam Style
1 mark

What consequence results from declaring a final method in a parent class that has been previously overridden in a subclass?

Question 6
college-boardComputer Science AAPExam Style
1 mark

If an overridden method in a subclass is designed to improve the time efficiency of a search algorithm from O(n2)O(n^2)O(n2) to O(log⁡n)O(\log n)O(logn), what kind of strategy might have been introduced?

Question 7
college-boardComputer Science AAPExam Style
1 mark

If a superclass method processData() has O(n)O(n)O(n) complexity and its subclass overrides it with an algorithm of O(n2)O(n^2)O(n2) complexity, how will the overriding affect performance when processing large datasets?

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

When a subclass in Java overrides a superclass method, what must be true about the method signature in the subclass?

Question 9
college-boardComputer Science AAPExam Style
1 mark

What happens if you try to override a static method from the superclass in Java?

Question 10
college-boardComputer Science AAPExam Style
1 mark

What visibility can an overridden method have if it was protected in the superclass?