SECTION A – MCQs (50 Questions)
(Select the MOST appropriate answer)
1. Which statement BEST defines an object in OOP?
A. A function with attributes
B. A runtime instance of a class
C. A blueprint of data
D. A collection of methods only
2. Which feature allows reuse of existing code without modification?
A. Encapsulation
B. Inheritance
C. Abstraction
D. Polymorphism
3. Which concept ensures internal data cannot be accessed directly?
A. Abstraction
B. Polymorphism
C. Encapsulation
D. Inheritance
4. Which option BEST represents abstraction?
A. Showing all internal logic
B. Hiding unnecessary details
C. Allowing subclassing
D. Sharing data
5. Which scenario demonstrates method overloading?
A. Same method, different implementation in child
B. Same method name, different parameters
C. Different method names
D. Same method with inheritance
6. Which relationship is purely conceptual without ownership?
A. Composition
B. Aggregation
C. Association
D. Inheritance
7. Which relationship enforces lifecycle dependency?
A. Association
B. Aggregation
C. Composition
D. Dependency
8. Aggregation is BEST described as:
A. Strong ownership
B. Weak “has-a” relationship
C. Inheritance-based
D. Dependency
9. Which violates SRP the MOST?
A. A class managing UI
B. A class handling logging and DB operations
C. A class validating input
D. A class formatting text
10. SRP improves:
A. Complexity
B. Maintainability
C. Memory usage
D. Execution speed
11. Which scenario BEST reflects OCP violation?
A. Adding new class
B. Editing existing logic to add features
C. Using abstraction
D. Extending interfaces
12. LSP ensures:
A. Code reuse
B. Subclass compatibility
C. Data hiding
D. Interface segregation
13. Which is an LSP violation?
A. Subclass behaves differently than parent expectation
B. Subclass extends functionality
C. Subclass uses abstraction
D. Subclass overrides method correctly
14. ISP aims to:
A. Reduce classes
B. Reduce large interfaces
C. Increase inheritance
D. Increase dependencies
15. DIP suggests high-level modules depend on:
A. Low-level modules
B. Interfaces/abstractions
C. Concrete classes
D. Static methods
16. Which is NOT a UML component?
A. Class
B. Attribute
C. Algorithm
D. Method
17. Which visibility is represented by ‘#’?
A. Public
B. Private
C. Protected
D. Global
18. What does ‘+’ represent in UML?
A. Private
B. Public
C. Protected
D. Default
19. Which relationship is denoted by solid diamond?
A. Aggregation
B. Composition
C. Association
D. Dependency
20. Which relationship is weakest?
A. Composition
B. Aggregation
C. Dependency
D. Inheritance
21. Multiplicity “*” means:
A. One
B. Zero or many
C. Exactly two
D. One or more
22. Multiplicity “1” indicates:
A. Optional
B. Exactly one
C. Many
D. Range
23. Which design pattern category handles object creation?
A. Structural
B. Behavioral
C. Creational
D. Functional
24. Factory Method Pattern provides:
A. Fixed object creation
B. Flexible object creation
C. Object destruction
D. Data encapsulation
25. Which is a key benefit of Factory Pattern?
A. Tight coupling
B. Loose coupling
C. Increased complexity
D. Reduced abstraction
26. Singleton pattern ensures:
A. Multiple instances
B. One shared instance
C. No instance
D. Cloned instances
27. Which is TRUE about Singleton?
A. Public constructor
B. Private constructor
C. No methods
D. Multiple instances allowed
28. Prototype Pattern avoids:
A. Object reuse
B. Expensive object creation
C. Inheritance
D. Encapsulation
29. Object Pool Pattern is BEST used when:
A. Objects are cheap
B. Objects are frequently reused
C. No memory issues
D. Static methods used
30. Adapter Pattern converts:
A. Data types
B. Interfaces
C. Classes
D. Methods
31. Bridge Pattern decouples:
A. Methods and data
B. Abstraction and implementation
C. Classes and objects
D. Interfaces and classe
32. Composite Pattern is used for:
A. Linear structures
B. Hierarchical structures
C. Interfaces
D. Databases
33. Which is NOT a structural pattern?
A. Adapter
B. Bridge
C. Command
D. Composite
34. Behavioral patterns focus on:
A. Creation
B. Structure
C. Interaction
D. Memory
35. Command Pattern encapsulates:
A. Class
B. Request
C. Object
D. Interface
36. Which is a key component of Command Pattern?
A. Builder
B. Receiver
C. Adapter
D. Factory
37. Interpreter Pattern evaluates:
A. Classes
B. Expressions
C. Objects
D. Interfaces
38. Iterator Pattern allows:
A. Object creation
B. Sequential access
C. Method overriding
D. Interface segregation
39. Clean code avoids:
A. Meaningful naming
B. Small functions
C. Unnecessary complexity
D. Early returns
40. Early returns help:
A. Increase complexity
B. Improve readability
C. Reduce abstraction
D. Increase coupling
41. Which practice improves maintainability?
A. Large methods
B. Clear naming
C. Deep nesting
D. Duplicate logic
42. Abstraction is commonly implemented using:
A. Interfaces or abstract classes
B. Only classes
C. Only functions
D. Only inheritance
43. Which principle promotes decoupling MOST?
A. SRP
B. OCP
C. DIP
D. LSP
44. Which principle reduces side effects of change?
A. SRP
B. ISP
C. DIP
D. LSP
45. Which pattern helps reuse algorithms interchangeably?
A. Strategy
B. Singleton
C. Factory
D. Adapter
46. Which pattern notifies multiple objects of state changes?
A. Observer
B. Iterator
C. Command
D. Prototype
47. Which pattern manages object states dynamically?
A. State
B. Adapter
C. Factory
D. Composite
48. Which pattern defines skeleton of algorithm?
A. Template Method
B. Strategy
C. Interpreter
D. Iterator
49. Which pattern allows undo/redo?
A. Command
B. Adapter
C. Composite
D. Factory
50. Which principle improves scalability MOST?
A. OCP
B. SRP
C. ISP
D. LSP
SECTION B – Short Answer Questions
(15)
1. Define OOP paradigm.
2. What is reusability?
3. Define polymorphism.
4. What is association?
5. Define aggregation.
6. Define composition.
7. What is method overloading?
8. What is SRP?
9. What is OCP?
10. What is LSP?
11. What is ISP
12. What is DIP?
13. What is UML class diagram?
14. What is Factory Pattern?
15. What is Command Pattern?