CS305 Object Oriented Programming & Methodology
ANSWER KEY
Unit 1: Introduction to Object-Oriented Thinking & Object-Oriented Programming:
1. A) OOP focuses on data rather than procedures.
2. C) Encapsulation
3. C) Improved code maintainability
4. B) Limited code reuse
5. A) Class model
6. D) Central processing
7. C) It's encapsulated within objects.
8. B) It makes data manipulation easier.
9. D) Inheritance
10. A) Object-Oriented Programming
Unit 2: Encapsulation and Data Abstraction:
1. A) The process of hiding the implementation details of an object's state
2. B) Attributes
3. B) Services
4. B) Private
5. B) A member variable that is shared by all instances of the class
6. C) Objects
7. B) The process of calling methods on objects
8. B) To initialize the state of an object
9. C) Destructor
10. C) Shared behavior and state
Unit 3: Relationships – Inheritance:
1. C) Association
2. B) Is-a
3. B) A dog is a mammal
4. B) A relationship where objects of one class are connected to objects of another class
5. C) Composition
6. A) A class that cannot be instantiated but can be subclassed
7. B) A blueprint for a class that defines a set of methods that must be implemented
8. C) Inheritance
9. D) Polymorphism
10. A) Aggregation
Unit 4: Polymorphism:
1. C) The ability of a method to do different things based on the object it is acting upon
2. B) Redefining a method in a subclass with the same signature as a method in the superclass
3. A) Providing multiple implementations of the same method within a class
4. C) The number and types of parameters passed to the method
5. A) Polymorphism that is resolved at compile time
6. C) Compile-time polymorphism
7. B) Polymorphism that is resolved at runtime
8. D) @Override
9. B) No
10. B) Polymorphism allows objects of different types to be treated as objects of a single type
Unit 5:
1. C) An object that represents a sequence of characters
2. B) Using try-catch blocks
3. B) To allow for parallel execution of tasks
4. C) String
5. D) LinkedList
6. C) A case study
7. C) By catching the exception and displaying an error message to the user
8. A) To allow multiple users to access the system simultaneously
9. B) HashMap
10. D) HashMap