1) What keyword is used to allow a class to inherit from another class? a) implements b) extends c) inherits d) super 2) Which access modifier makes a method or variable accessible only within its own class? a) public b) protected c) private d) default 3) What is the term for the ability of an object to take on many forms (e.g., a superclass reference holding a subclass object)? a) Inheritance b) Encapsulation c) Polymorphism d) Abstraction 4) A class that is declared with the abstract keyword: a) Can be instantiated directly. b) Cannot be instantiated directly. c) Can only have abstract methods. d) Cannot have a constructor. 5) What keyword is used for a class to use an interface? a) extends b) uses c) realizes d) implements 6) When a subclass provides a specific implementation for a method that is already defined in its superclass, it is called: a) Method Overloading b) Method Overriding c) Method Hiding d) Method Abstracting 7) Can a single class in Java extend more than one class (multiple inheritance)? a) Yes b) No 8) Can a single class in Java implements more than one interface? a) Yes b) No 9) Which modifier makes a member accessible to its package and all its subclasses (even in other packages)? a) public b) protected c) private d) default (package-private) 10) An interface can contain: a) Only abstract methods. b) Only concrete methods. c) Abstract methods, default methods, and static methods. d) Only constructors. 11) What is the main purpose of an abstract class? a) To be instantiated many times. b) To serve as a base class (superclass) for other classes to extend. c) To hide all data. d) To replace interfaces. 12) The default access modifier (when no modifier is written) means the member is accessible: a) Only within the same class. b) Only within the same package. c) Everywhere in the project. d) Only to subclasses.

Answer the multiple-choice questions about Java Object-Oriented Programming concepts

Skor Tablosu

Görsel stil

Seçenekler

Şablonu değiştir

Otomatik olarak kaydedilen geri yüklensin mi: ?