Object-Oriented Programming in Java

Test your knowledge of classes,inheritance,and polymorphism.

1. Which of the following is NOT one of the four main pillars of Object-Oriented Programming?
2. In Java, a class can extend multiple classes.
3. What keyword is used to define a subclass in Java?
4. What keyword is used to prevent a method from being overridden in Java?
5. Which of the following are access modifiers in Java?
6. What is the default value of a boolean instance variable in Java?
7. An abstract class can contain both abstract and concrete methods.
8. What is the term for a special method in Java that shares the same name as its class and is used to initialize objects?
9. Which statements about interfaces in Java are true (select all that apply)?
10. What is polymorphism in OOP?
11. A static method in Java can directly access non-static instance variables.
12. Which keyword is used to refer to the current instance of a class in Java?
13. What keyword is used to declare a class that cannot be subclassed?
14. Which of the following are examples of encapsulation in Java (select all that apply)?
15. What happens if a Java class defines a main method with a return type of 'int'?
16. What is method overloading?
17. Which keyword is used to call a superclass constructor from a subclass constructor?
18. Which of the following are true about abstract methods (select all that apply)?
19. What is the purpose of the 'this' keyword in Java?
20. Which OOP principle focuses on hiding implementation details and exposing only necessary features?
Answered 0 of 0 — 0 correct