Unit 4: Polymorphism
Unit 4: Polymorphism
Sda
Sd
Asd
Asd
asdasdasdasdasdasd6. What is aggregation in Object-Oriented Programming?
A) A relationship where one class inherits from another class
B) A relationship where objects of one class are part of objects of another class
C) A relationship between an interface and its implementations
D) A relationship between static members of a class
10. Which relationship in Object-Oriented Programming allows for the reusability of code by enabling
a subclass to inherit features from a superclass?
A) Aggregation
B) Association
C) Inheritance
D) Composition
Unit 4: Polymorphism
1. What is polymorphism in Object-Oriented Programming?
A) The process of hiding the implementation details of an object's state
B) The process of creating duplicate objects
C) The ability of a method to do different things based on the object it is acting upon
D) The process of defining multiple constructors for a class
2. Which of the following best describes method overriding in C++?
A) Providing multiple implementations of the same method within a class
B) Redefining a method in a subclass with the same signature as a method in the superclass
C) Providing different implementations of a method with different signatures
D) Creating a new method with the same name but different parameters
9. In C++, can a subclass method override a superclass method with a broader access modifier?
A) Yes
B) No
Unit 5:
1. Which of the following best describes a String in C++?
A) A primitive data-type
B) An array of characters
C) An object that represents a sequence of characters
D) A class that cannot be instantiated
5. In a Library Management System, what data collection might be used to store information about
books and their availability?
A) ArrayList
B) HashSet
C) TreeMap
D) LinkedList
10. In a Library Management System, what data collection might be used to store information about
library members and their borrowed books?
A) HashSet
B) LinkedList
C) TreeMap
D) HashMap