.Net Design Patterns Quiz

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Stephanie Young
S
Stephanie Young
Community Contributor
Quizzes Created: 85 | Total Attempts: 67,667
Questions: 10 | Attempts: 433

SettingsSettingsSettings
.Net Design Patterns Quiz - Quiz

Design patterns provides solutions to problems as regard software design. When designing an application, the best way a programmer can solve any problem that erupts is by using design patterns. Click the start button and get started. Good Luck!


Questions and Answers
  • 1. 

    Which of the following behavioural patterns sequentially access the elements of a collection?

    • A.

      Chain of Resp.

    • B.

      Command

    • C.

      Iterator

    • D.

      Interpreter

    Correct Answer
    C. Iterator
    Explanation
    The correct answer is Iterator. The Iterator pattern provides a way to access the elements of a collection sequentially without exposing its underlying structure. It allows clients to iterate over a collection without knowing the specific implementation details. The Chain of Responsibility, Command, and Interpreter patterns do not specifically deal with the sequential access of elements in a collection.

    Rate this question:

  • 2. 

    The behavioural pattern that defines simplified communication between classes is

    • A.

      Mediator

    • B.

      Momento

    • C.

      Observer

    • D.

      State

    Correct Answer
    A. Mediator
    Explanation
    The correct answer is Mediator. The Mediator pattern defines a simplified communication between classes by introducing a mediator object that encapsulates the communication logic between these classes. It promotes loose coupling and reduces dependencies between classes, as they only need to communicate with the mediator instead of directly with each other. This pattern is useful in scenarios where a set of objects need to interact with each other in a controlled and centralized manner.

    Rate this question:

  • 3. 

    The following are creational design patterns except:

    • A.

      Factory Method

    • B.

      Adapter

    • C.

      Abstract Factory

    • D.

      Builder

    Correct Answer
    B. Adapter
    Explanation
    The given question is asking for the design pattern that is not a creational design pattern. The Factory Method, Abstract Factory, and Builder are all examples of creational design patterns as they provide ways to create objects. However, the Adapter design pattern is a structural design pattern, not a creational one. It is used to adapt the interface of one class to another, allowing them to work together.

    Rate this question:

  • 4. 

    Behavioural patterns include the following except:

    • A.

      Observer

    • B.

      State

    • C.

      Strategy

    • D.

      Proxy

    Correct Answer
    D. Proxy
    Explanation
    Behavioural patterns in software design refer to patterns that focus on communication and interaction between objects. The Observer pattern allows objects to notify and update other objects about changes in their state. The State pattern allows an object to change its behavior based on its internal state. The Strategy pattern allows different algorithms or strategies to be used interchangeably within an object. However, the Proxy pattern is not a behavioural pattern. It is a structural pattern that provides a surrogate or placeholder for another object to control access to it.

    Rate this question:

  • 5. 

    Which of the following creational design patterns creates a set of related objects or dependent objects?

    • A.

      Prototype

    • B.

      Abstract Factory

    • C.

      Singleton

    • D.

      Builder

    Correct Answer
    B. Abstract Factory
    Explanation
    The correct answer is Abstract Factory because the Abstract Factory design pattern is used to create a family of related objects or dependent objects. It provides an interface for creating objects, but allows subclasses to decide which class to instantiate. This pattern is useful when there are multiple families of objects that need to be created and the system should be independent of how these objects are created, composed, and represented.

    Rate this question:

  • 6. 

    Which of these is not a structural design pattern? 

    • A.

      Adapter

    • B.

      Composite

    • C.

      Proxy

    • D.

      Visitor

    Correct Answer
    D. Visitor
    Explanation
    The Visitor pattern is not a structural design pattern. It is a behavioral design pattern. Structural design patterns deal with the composition of classes and objects to form larger structures, while behavioral design patterns focus on the interaction between objects and how they communicate with each other. The Adapter, Composite, and Proxy patterns are all examples of structural design patterns.

    Rate this question:

  • 7. 

    Which of these design patterns allows an object to alter its behavior when its internal state changes?

    • A.

      State

    • B.

      Prototype

    • C.

      Visitor

    • D.

      Mediator

    Correct Answer
    A. State
    Explanation
    The State design pattern allows an object to alter its behavior when its internal state changes. This pattern is used when an object needs to change its behavior based on its internal state, and it encapsulates each state into a separate class. The object delegates the behavior to the current state class, and when the state changes, the object's behavior changes accordingly. This pattern promotes loose coupling between the object and its states, making it easier to add or modify states without affecting the object's code.

    Rate this question:

  • 8. 

    Proxy pattern falls under what design pattern? 

    • A.

      Structural

    • B.

      Creationa Creational

    • C.

      Behavioural

    • D.

      None of the above

    Correct Answer
    A. Structural
    Explanation
    The Proxy pattern falls under the Structural design pattern category. This pattern involves creating a proxy object that acts as a substitute for another object, controlling access to it and providing additional functionality if needed. The main purpose of the Proxy pattern is to provide a level of indirection between the client and the real object, allowing for easier control and management of the object's behavior.

    Rate this question:

  • 9. 

    Which of these design patterns is used to process a list or chain of various types of request?

    • A.

      MVVM Design

    • B.

      MVP Design

    • C.

      Chain of Responsibility Design

    • D.

      MVC Design

    Correct Answer
    C. Chain of Responsibility Design
    Explanation
    The Chain of Responsibility Design pattern is used to process a list or chain of various types of requests. In this pattern, multiple objects are linked together in a sequence, and each object has the ability to handle the request or pass it on to the next object in the chain. This allows for a flexible and dynamic way of handling requests, where each object in the chain can decide whether to handle the request or delegate it to the next object.

    Rate this question:

  • 10. 

    The design pattern that involves the removal of an algorithm from its host class and putting it in a separate class is

    • A.

      State Design Pattern

    • B.

      Observer Design Method

    • C.

      Visitor Design Pattern

    • D.

      Strategy Design Pattern

    Correct Answer
    D. Strategy Design Pattern
    Explanation
    The correct answer is the Strategy Design Pattern. This design pattern involves removing an algorithm from its host class and placing it in a separate class. The host class then holds a reference to the strategy class and delegates the algorithm execution to it. This allows for easy swapping of different algorithms at runtime without modifying the host class.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 19, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Mar 05, 2018
    Quiz Created by
    Stephanie Young

Related Topics

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.