OOPS and Other Essential Concepts - Graded Quiz
21. Which of the following statements about abstraction in Java is correct?
- Abstraction is the process of hiding implementation details and exposing only the essential features of an object.
- Abstraction is the process of converting an object into a different data type.
- Abstraction is the process of making an object immutable.
- Abstraction is the process of converting a primitive data type into an object.
22. Which of the following is true about abstract classes in Java?
- Abstract classes can be instantiated.
- Abstract classes can have both abstract and concrete (implemented) methods.
- Abstract classes cannot have any constructors.
- Abstract classes can be used to create objects.
23. Which of the following statements is true about encapsulation in Java?
- Encapsulation is the process of converting an object into a different data type.
- Encapsulation is the process of hiding implementation details and exposing only the essential features of an object.
- Encapsulation is the process of making an object immutable.
- Encapsulation is the process of converting a primitive data type into an object.
24. Which of the following is true about abstract classes and interfaces in Java?
- Abstract classes can have constructor implementations, while interfaces cannot.
- Interfaces can have concrete (implemented) methods, while abstract classes cannot.
- Abstract classes can extend multiple classes, while interfaces can only extend one interface.
- Abstract classes can provide multiple inheritance, while interfaces cannot.
25. Which of the following statements is true about the difference between abstract classes and interfaces in Java?
- Abstract classes can be implemented by any class, while interfaces can only be extended by other interfaces.
- Abstract classes can provide multiple inheritance, while interfaces cannot.
- Abstract classes can only have abstract methods, while interfaces can have both abstract and non-abstract methods.
- Abstract classes can have multiple inheritance, while interfaces can only have single inheritance.
26. Which of the following statements is true about abstract classes and interfaces in Java?
- Abstract classes can have method implementations, while interfaces can only have method declarations.
- Abstract classes can be fully implemented, while interfaces cannot.
- Abstract classes can have fields and variables, while interfaces can only have constants.
- Abstract classes can be used to achieve multiple inheritance, while interfaces cannot.
27. Which of the following statements is true about abstract classes in Java?
- Abstract classes can be instantiated directly.
- Abstract classes cannot have any constructors.
- Abstract classes can have both abstract and concrete methods.
- Abstract classes can be used to create objects.
28. Which of the following is not a valid modifier for an interface in Java?
- public
- private
- static
29. What is the distinction between abstract classes and interfaces in Java?
- Abstract classes can provide multiple inheritance, while interfaces cannot.
- Abstract classes can have method implementations, while interfaces can only have method declarations.
- Interfaces can be implemented by any class, while abstract classes can only be subclassed.
- Abstract classes can have private methods, while interfaces cannot.
30. Which of the following statements is true about abstract methods in Java?
- Abstract methods have a body and can be directly invoked.
- Abstract methods do not have a body and must be implemented by any concrete class that extends the abstract class or implements the interface.
- Abstract methods can have method implementations.
- Abstract methods can only be used in abstract classes, not in interfaces.