Design Patterns/Design Patterns MCQ QUESTIONS AND ANSWER Sample Test,Sample questions

Question:
 GOF stands for ?

1. Gamma of four

2.Gang of four

3.Gang of helm

4.Gamma of helm


Question:
 In factory method pattern, the framework must instantiate classes but it only knows about the abstract classes, which it cannot initiate. How would one solve this problem?

1.encapsulating the knowledge of which document subclass to is to be created and

2.moving this knowledge out of the framework

3.instantiating the application specific documents without knowing their class

4.all of the mentioned


Question:
 In which pattern does a surrogate or placeholder class control access to the original object? 

1.Adapter

2.Proxy

3.Decorator

4.Bridge


Question:
 What is the primary purpose of the Prototype Pattern in design patterns? 

1.To provide a mechanism for creating, deleting, and managing classes at runtime.

2.To create a clone of an existing object rather than creating a new one, typically for performance reasons.

3.To provide a simple way to represent hierarchical relationships between objects.

4. To provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.


Question:
 Which behavioral design pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable? 

1.Strategy

2.Observer

3.Mediator

4.State


Question:
 You want to minimize development cost by reusing methods? Which design pattern would you choose?

1.Adapter Pattern

2. Singleton Pattern

3. Delegation pattern

4. Immutable Pattern


Question:
Can we create a clone of a singleton object?

1.Yes

2.No

3.Can be yes or no

4.Can not say


Question:
Design patterns can be classified in _______ categories.

1.1

2.2

3.3

4.4


Question:
Factory pattern is one of most used design pattern in Java.

1.TRUE

2.FALSE

3.Can be true or false

4.Can not say


Question:
Filter pattern also known as?

1. Adapter pattern

2.Composite pattern

3. Filter pattern

4.Decorator pattern


Question:
Filter pattern also known as?

1. Adapter pattern

2.Composite pattern

3. Filter pattern

4.Decorator pattern


Question:
How many types of design patterns are there? 

1.3

2.5

3.8

4.10


Question:
In how many steps Singleton class in java created?

1. 1

2. 2

3.3

4.4


Question:
The Decorator design pattern is also known as: 

1.Wrapper

2. Virtual Proxy

3.Ghost

4. Pseudo Proxy


Question:
The recurring aspects of designs are called design

1.patterns

2.documents

3.structures

4.methods


Question:
The use of design patterns for the development of object-oriented software has important implications for

1.Component-based software engineering

2.Reusability in general

3.All of the mentioned

4.None of the mentioned


Question:
What is a design pattern in software development? 

1. A fixed set of coding rules

2. A general reusable solution to a commonly occurring problem

3.A specific coding style

4.None of the above


Question:
What is a Singleton design pattern? 

1. A design pattern that allows you to ensure that a class has only one instance

2.A design pattern that lets you fit more objects into the available amount of RAM

3.A design pattern that separates an object's specification from its implementation

4. A design pattern that ensures that the class has multiple instances


Question:
What is Template Design Pattern? 

1. It defines the skeleton of an algorithm in a method, deferring some steps to subclasses.

2.it ensures that a class has only one instance and provides a global point of access to it.

3.It encapsulates a request as an object, thereby allowing for the parameterization of clients with queues, requests, and operations.

4.It provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation.


Question:
What is the main benefit of using a design pattern?

1. It reduces the total codebase

2.It allows for the separation of responsibilities

3.It ensures that the code is easier to understand and debug

4.All of the above


Question:
What is the primary function of the Adapter design pattern in software development? 

1.It allows classes with incompatible interfaces to work together by wrapping its own interface around that of an already existing class.

2.It ensures that a class only has one instance and provides a global point of access to it.

3. It provides an interface for creating families of related or dependent objects without specifying their concrete classes.

4.It allows for the dynamic addition of new operations to objects without modifying the classes.


Question:
What is the primary purpose of the Abstract Factory design pattern in software design? 

1. It provides an interface for creating families of related or dependent objects without specifying their concrete classes.

2.It ensures that a class only has one instance and provides a global point of access to it.

3. It defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.

4.It decouples an abstraction from its implementation so that the two can vary independently.


Question:
What is the use of the Builder Pattern?

1. It simplifies the creation of complex objects by breaking the creation process into steps.

2. It allows an object to alter its behavior when its internal state changes.

3.It ensures a class has only one instance and provides a global point of access to it.

4.It helps in hiding the complexities of the system and provides an interface to the client.


Question:
Which behavioral design pattern should be used when a behavior among objects should be encapsulated and made to operate on an object structure? 

1.Visitor

2.Strategy

3.Observer

4.Command


Question:
Which design pattern defines one-to-many dependency among objects?

1.Singleton pattern

2.Facade Pattern

3.Observer pattern

4.Factory method pattern


Question:
Which design pattern is used when there is a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically?

1.Observer

2.State

3.Visitor

4.Command


Question:
Which design pattern provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation? 

1. Proxy pattern

2.Observer pattern

3.Iterator pattern

4.Strategy pattern


Question:
Which design pattern would you use to encapsulate a request as an object? 

1. Decorator Pattern

2.Command Pattern

3.Singleton Pattern

4. Bridge Pattern


Question:
Which design patterns are specifically concerned with communication between objects?

1.Creational Patterns

2.Structural Patterns

3.Behavioral Patterns

4. J2EE Patterns


Question:
Which mechanism is applied to use a design pattern in an OO system?

1.Inheritance

2.Composition

3.All of the mentioned

4.None of the mentioned


Question:
Which of the following best describes the Composite design pattern? 

1.The Composite pattern composes objects into tree structures to represent part-whole hierarchies.

2. The Composite pattern defines an interface for creating families of related or dependent objects without specifying their concrete classes.

3. The Composite pattern decouples an abstraction from its implementation so that the two can vary independently.

4.The Composite pattern provides a way to access the elements of a collection object in a sequential manner without any need to know its underlying representation.


Question:
Which of the following best describes the Factory Pattern in design patterns? 

1.It is used to create duplicate objects while keeping performance in mind.

2.It involves a single class that is responsible to join functionalities of independent or incompatible interfaces.

3.It restricts the instantiation of a class and ensures that only one instance of the class exists.

4.It allows an object to be created without exposing the creation logic to the client and the created object is referred to using a common interface.


Question:
Which of the following is a behavioral design pattern? 

1.Observer Pattern

2.Composite Pattern

3.Flyweight Pattern

4.Builder Pattern


Question:
Which of the following is a design pattern?

1.Behavioral

2.Structural

3.Abstract Factory

4. All of the mentioned


Question:
Which of the following is NOT a creational design pattern? 

1.Singleton Pattern

2.Factory Pattern

3.Bridge Pattern

4.Prototype Pattern


Question:
Which pattern allows an object to change its behavior when its internal state changes? 

1.State

2.Strategy

3.Visitor

4.Composite


Question:
Which pattern are identified by Sun Java Center?

1. Factory pattern

2. Abstract Factory pattern

3.Behavioral Patterns

4.J2EE Patterns


Question:
Which pattern helps in reducing complex conditional logic? 

1.Strategy pattern

2. Observer pattern

3. Factory pattern

4. Proxy pattern


Question:
Which pattern is specifically concerned with communication between objects? 

1.Mediator

2.Decorator

3.Factory

4.Command


Question:
Which pattern prevents one from creating more than one instance of a variable?

1.Factory Method

2.Singleton

3.Observer

4.None of the mentioned


Question:
Which structural design pattern decouples an abstraction from its implementation so that the two can vary independently? 

1.Adapter

2.Bridge

3.Composite

4.Facade


Question:
You want to avoid multiple inheritance. Which design pattern would you choose?

1.Abstraction-Occurrence Pattern

2.Player-Role Pattern

3.General Hierarchy Pattern

4.Singleton Pattern


Question:
_____ works as a bridge between two incompatible interfaces.

1.Prototype pattern

2.Adapter pattern

3. Bridge pattern

4. Filter pattern


Question:
________ represent the best practices used by experienced object-oriented software developers.

1.EB2

2.IMS

3.Design Patterns

4.JCL


More MCQS

  1. Design Pattern Mcq Set 1
  2. Design Patterns MCQ QUESTIONS AND ANSWER
  3. Software Design Modeling MCQ QUESTIONS AND ANSWER
Search
Olete Team
Online Exam TestTop Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on Online Exam Testwebsite is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!