Object-Oriented Programming MCQs (Part-6)

What is the purpose of the Singleton design pattern?

A Single instance
B Multiple instances
C Code reusability
D Code optimization

Which design pattern ensures that objects are created based on certain conditions?

A Singleton Pattern
B Prototype Pattern
C Observer Pattern
D Factory Pattern

What is the main purpose of the Observer Pattern?

A Object persistence
B Object communication
C Data hiding
D Event handling

What does the Strategy Pattern allow?

A Object serialization
B Object persistence
C Dynamic behavior selection
D Single method overriding

Which of the following is the key feature of Exception Handling?

A Managing runtime errors
B Preventing method overloading
C Enhancing class inheritance
D Object initialization

Which of the following is an example of a Checked Exception in Java?

A NullPointerException
B ArithmeticException
C IndexOutOfBoundsException
D IOException

Which of the following is a Design Pattern used to create objects without specifying the exact class of object that will be created?

A Observer Pattern
B Factory Pattern
C Singleton Pattern
D Prototype Pattern

In the context of design patterns, what is the role of the Prototype Pattern?

A Object cloning
B Event handling
C Method overriding
D Data abstraction

Which design pattern provides a way to ensure that a class has only one instance?

A Factory Pattern
B Prototype Pattern
C Observer Pattern
D Singleton Pattern

Which of the following is a benefit of Exception Handling in OOP?

A Object creation
B Runtime error management
C Code readability
D Simplified debugging

What is the main advantage of the Factory Pattern?

A Implements multiple algorithms
B Provides multiple instances
C Controls object creation
D Reduces code complexity

Which of the following statements is true about the Observer Pattern?

A It allows real-time communication
B It is used for object cloning
C It involves method overloading
D It restricts object visibility

In the context of design patterns, what does the Facade Pattern provide?

A Dynamic behavior selection
B Direct access to an object
C Object initialization
D Simplified interface

What is the role of Abstract Factory Pattern in OOP?

A Increases object mutability
B Defines object behaviors
C Creates families of related objects
D Manages object exceptions

What is the main purpose of Method Overriding in OOP?

A Method duplication
B Handling exceptions
C Modifying inherited behavior
D Increasing performance