Java OOP: 16 MCQs with answers
All 16 multiple-choice questions from this kit, free and with no sign-up.
Warm-up · 9 questions
Q1. What is abstraction in Java?
BeginnerShow answer & explanation
Hiding implementation details and showing only functionality
Abstraction focuses on what an object does rather than how it does it, hiding implementation details.
Q2. Which keyword is used to declare an abstract class in Java?
BeginnerShow answer & explanation
abstract
The `abstract` keyword is used to declare a class or method as abstract.
Q3. Can an abstract class have concrete (non-abstract) methods?
BeginnerShow answer & explanation
Yes, it can have both abstract and concrete methods
Abstract classes can contain both abstract methods (without body) and concrete methods (with body).
Q4. Which of the following is true about abstract methods?
BeginnerShow answer & explanation
They have no body and end with a semicolon
Abstract methods are declared without a body and end with a semicolon; they must be implemented by subclasses.
Q5. What is the primary purpose of abstraction in Java?
BeginnerShow answer & explanation
To reduce complexity by hiding unnecessary details
Abstraction simplifies complex systems by exposing only essential features.
Q6. Which of the following can be used to achieve abstraction in Java?
BeginnerShow answer & explanation
Abstract classes and interfaces
Both abstract classes and interfaces provide abstraction in Java.
Q7. Can you instantiate an abstract class directly?
BeginnerShow answer & explanation
No, abstract classes cannot be instantiated
Abstract classes cannot be instantiated directly; they are meant to be subclassed.
Q8. An abstract class can be declared as final.
BeginnerShow answer & explanation
False
An abstract class cannot be final because it must be subclassed to be used.
Q9. Abstract methods can be declared as static.
BeginnerShow answer & explanation
False
Abstract methods cannot be static because static methods cannot be overridden.
Building up · 5 questions
Q10. What happens if a class extends an abstract class but does not implement all abstract methods?
IntermediateShow answer & explanation
The subclass must also be declared abstract
If a subclass does not implement all inherited abstract methods, it must be declared abstract itself.
Q11. Which of the following is a correct way to declare an abstract method?
IntermediateShow answer & explanation
public abstract void display();
Abstract methods are declared with the `abstract` keyword, no body, and end with a semicolon.
Q12. What is the output of the following code? abstract class A { abstract void show(); } class B extends A { void show() { System.out.println("Hello"); } } public class Main { public static void main(String[] args) { A obj = new B(); obj.show(); } }
IntermediateShow answer & explanation
Hello
The abstract class reference `obj` points to a `B` object, and `show()` is overridden in `B`, so it prints "Hello".
Q13. Which statement is true about abstract classes?
IntermediateShow answer & explanation
They can have constructors
Abstract classes can have constructors, instance variables, and static methods; they may have zero abstract methods.
Q14. Which of the following is NOT a benefit of abstraction?
IntermediateShow answer & explanation
It allows multiple inheritance
Abstraction does not provide multiple inheritance; that is a feature of interfaces, not abstraction itself.
Topper level · 2 questions
Q15. What is the difference between an abstract class and an interface in Java?
AdvancedShow answer & explanation
Abstract classes can have concrete methods, interfaces can have default methods
Abstract classes can have concrete methods; interfaces can have default and static methods but no constructors.
Q16. Can an abstract class implement an interface without implementing its methods?
AdvancedShow answer & explanation
Yes, it can leave them unimplemented
An abstract class can implement an interface and leave methods unimplemented, marking them abstract.
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, in 42 languages.
- Chapter notes
- Flashcards
- Practice MCQs
- Scored tests
- Exam prep
Get Veda free See what students get
Free to start · No ads · Works in 42 languages