OOPS Fourth Unit — Important Questions & Answers (JNTUA Class Work Model): 30 flashcards

All 30 flashcards from this kit, free and with no sign-up.

1. Which keyword implements inheritance in Java?

Show the answer

`extends`

2. What relationship does inheritance model?

Show the answer

An **is-a** relationship (a Dog is an Animal).

3. Which types of inheritance are allowed through Java classes?

Show the answer

Single, multilevel, and hierarchical. Multiple inheritance of classes is not allowed.

4. How is multiple inheritance achieved in Java?

Show the answer

Through **interfaces**, which avoids the diamond problem.

5. Are constructors inherited in Java?

Show the answer

No — but they are always invoked, superclass first, via implicit or explicit `super()`.

6. What must be the first statement in a subclass constructor?

Show the answer

`super()` (or `this()`), explicitly or implicitly.

7. What does `super.method()` do?

Show the answer

Invokes the parent's version of an overridden method, letting the subclass extend rather than replace behaviour.

8. What signature rule must an overriding method follow?

Show the answer

Identical signature, same or **covariant** return type, and it cannot reduce visibility.

9. Which methods cannot be overridden?

Show the answer

`static`, `final`, and `private` methods (static methods are hidden, not overridden).

10. When is overloading resolved vs overriding?

Show the answer

Overloading at **compile time** (static binding); overriding at **runtime** (dynamic binding).

11. What does dynamic method dispatch select?

Show the answer

The overridden method based on the **actual object type**, not the reference type.

12. What can an abstract class contain?

Show the answer

Fields, constructors, and both concrete and abstract methods; a class can extend only one.

13. What is an interface?

Show the answer

A contract; a class can implement multiple interfaces.

14. What are interface fields implicitly?

Show the answer

`public static final`

15. What are interface methods implicitly (pre-Java 8)?

Show the answer

`public abstract`

16. What did Java 8 and Java 9 add to interfaces?

Show the answer

Java 8: `default` and `static` methods. Java 9: `private` methods.

17. When should you use an abstract class vs an interface?

Show the answer

Abstract class for shared state and partial implementation; interface for a shared capability across unrelated classes.

18. What is a package?

Show the answer

A namespace that groups related classes and controls visibility.

19. Where must the `package` statement appear?

Show the answer

As the first statement in a Java source file.

20. Order the access modifiers from narrowest to widest.

Show the answer

`private` → default (package-private) → `protected` → `public`

21. Where are `private` members visible?

Show the answer

Only within the same class.

22. Where are default (no modifier) members visible?

Show the answer

Within the same package only.

23. Where are `protected` members visible?

Show the answer

Same package and to subclasses in other packages.

24. Where are `public` members visible?

Show the answer

Everywhere.

25. Is `protected` the same as package-private?

Show the answer

No — `protected` is wider; it also grants access to subclasses in other packages.

26. How does Java resolve interface method conflicts?

Show the answer

With `InterfaceName.super.method()`.

27. What are covariant return types?

Show the answer

An overriding method may return a subtype of the parent's return type.

28. Can an overriding method throw broader checked exceptions?

Show the answer

No — it cannot throw broader checked exceptions than the parent method.

29. What is the diamond problem?

Show the answer

Ambiguity when two parent classes define the same method; Java avoids it for classes and resolves interface conflicts explicitly.

30. What should a class-work model answer combine?

Show the answer

A definition, the mechanism, and a short correct program.

Make your own

Your notes can be a kit like these

Every kit here was made from real study material. Point Veda at a chapter, a PDF, a photo or a link and get notes, flashcards, practice MCQs, games and a scored test — free to start, in more than 40 languages.

  • Chapter notes
  • Flashcards
  • Practice MCQs
  • Scored tests
  • Paper Solver

Get Veda free See what students get

Free to start · Android app and web · More than 40 languages