Computer Science (CS) III Mastery Practice Exam 2026 - Free Computer Science Practice Questions and Study Guide

Session length

1 / 20

Which of the following correctly describes a situation where a derived class may be problematic?

If the derived class does not call the base class constructor.

If all methods are overridden without reason.

If all base class attributes are inherited without modification.

Both a and b are correct.

The situation where a derived class can be problematic can indeed be described by both the failure to call the base class constructor and overriding all methods without a valid reason.

When a derived class does not call the base class constructor, it may lead to uninitialized attributes or resources in the base class, resulting in unpredictable behavior or runtime errors. The base class may have important setup processes defined in its constructor that are necessary for its correct functionality. If these processes are skipped, the derived class may not function correctly, leading to bugs that are hard to trace.

Furthermore, if all methods in the base class are overridden in the derived class without purpose, this can indicate a misuse of inheritance. Such a scenario often leads to redundancy and can confuse the use of polymorphism — the derived class may not provide any additional functionality or improvement over the base class, making the override unnecessary. This can degrade code maintainability and clarity, leaving potential issues in the design architecture and violating principles such as the Liskov Substitution Principle, which emphasizes that derived classes should enhance or extend the behavior of base classes without altering their expected behavior.

Thus, both not calling the base class constructor and unnecessary overriding of methods can create problems with derived classes, which is why the correct answer incorporates both

Next Question
Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy