Understand subtype polymorphism in C++/Java
1. Which of the following is NOT a rule for method overriding?
Explanation
Explanation
Explanation
Explanation
Explanation
2. Suppose you are developing a program for a library that has different types of books, including fiction, non-fiction, and reference books. Each book has a title, an author, and a publication date. Which of the following statements about using polymorphism to implement a method that displays the details of a book is true?
3. In a car rental system, there are different types of vehicles such as Sedan, SUV, and Hatchback. Each vehicle type has different features and specifications. To implement this in Java, which of the following statements about subtype polymorphism is correct?
4. You are designing a system that requires creating complex Product objects with many optional attributes. The construction process involves multiple steps, and you want to ensure that the object is built incrementally and immutably. Which creational design pattern would you employ to handle this complex object creation?
5. You are developing a logging system where you need to ensure that only one instance of the Logger class exists throughout the application to manage log files and prevent concurrent access issues. Which creational design pattern would you use to achieve this?