Xirius-JavaAbstraction3-COS201.pdf

Course: COS201 • Xirius AI

1. Which of the following objects can be created in Java?

2. What does inheritance allow when dealing with abstract classes in Java?

3. What does it mean when a class is declared abstract but does not contain any abstract method?

4. Which of the following statements is true about constructors in abstract classes?

5. What is the output when mailCheck() is called on an Employee reference that points to a Salary object?

6. Which keyword is used in Java to declare an abstract class?

7. What is the main purpose of abstraction in Java programming?

8. What is the key purpose of abstraction in Object-Oriented Programming?

9. Can an abstract class contain non-abstract methods?

10. If a class contains one or more abstract methods, what must be true about the class?

11. What must a subclass do if it inherits an abstract class with abstract methods?

12. Why might a method be declared abstract in a parent class?

13. Which of the following is NOT a characteristic of an abstract class?

14. In the provided example, which class is abstract?

15. In the given Employee example, which constructor statement is true?

16. What does the term "hiding implementation details" mean in abstraction?

17. What does the output indicate when calling mailCheck method on Salary reference?

18. What is the correct way to create an abstract method in Java?

19. How is an abstract method declared in Java?

20. What would happen if Salary did not override computePay() from Employee?

21. How does Java enforce abstraction using abstract classes?

22. Which is NOT true about abstract classes in Java?

23. What does the abstract keyword before a class declaration indicate?

24. How is abstraction achieved in Java?

25. What is abstraction in Object-Oriented Programming?

26. Can an abstract class extend another abstract class?

27. Which statement about inheritance from an abstract class is correct?

28. If a class contains an abstract method, what must be true about the class?

29. Why would you declare a class abstract without having abstract methods?

30. When a subclass inherits an abstract class and does not implement all abstract methods, what must happen?

31. What happens if you try to instantiate an abstract class?

32. What is required in a subclass of an abstract superclass having abstract methods?

33. What is the significance of the semicolon (;) at the end of abstract method declaration?

34. From the tutorial example, which method is specifically declared abstract in Employee?

35. Why does the abstract class Employee have fields and constructors if it cannot be instantiated?

36. In the example, what does the Salary class method computePay() return?

37. Can an abstract class be instantiated directly in Java?

38. Which keyword is used to specify that a method is abstract?

39. What will happen if you try to instantiate an abstract class directly in code like "Employee e = new Employee(...)”?

40. What is the effect of declaring a class as abstract in Java?

41. What is the relationship between Employee and Salary classes in the described example?

42. What concept does the statement "user will have information on what the object does but not how it does it" refer to?

43. If a class contains at least one abstract method, what must be true about the class?

44. In the example code, how is the constructor of the abstract superclass Employee called?

45. Which of the following is true about abstract methods in Java?

46. What is a key difference between an abstract method and a regular method?

47. What is a key characteristic of an abstract class compared to an interface?

48. In the example, what method must the Salary class override from Employee?

49. Can an abstract class in Java be instantiated directly?

50. What is the main purpose of declaring a method as abstract?