Creational Design Patterns . Net_10 June

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 James Richardson
J
James Richardson
Community Contributor
Quizzes Created: 13 | Total Attempts: 11,025
Questions: 10 | Attempts: 739

SettingsSettingsSettings
Creational Design Patterns . Net_10 June - Quiz

.


Questions and Answers
  • 1. 

    What is the reason for studying design pattern?

    • A.

      Patterns makes it possible to reuse solutions

    • B.

      Patterns help with communication between analysts

    • C.

      Patterns give you perspective on the problem

    • D.

      All of the above

    Correct Answer
    D. All of the above
    Explanation
    Studying design patterns is important because they allow for the reuse of solutions, saving time and effort in the development process. Additionally, patterns help with communication between analysts by providing a common language and understanding of design concepts. Furthermore, patterns give a broader perspective on problem-solving, allowing for more effective and efficient solutions. Therefore, all of the given reasons are valid explanations for studying design patterns.

    Rate this question:

  • 2. 

    Patterns are the devices that allow programs to share knowledge about their ___

    • A.

      Code

    • B.

      Design

    • C.

      Analysis

    • D.

      None

    Correct Answer
    B. Design
    Explanation
    Patterns are the devices that allow programs to share knowledge about their design. Design patterns provide solutions to common design problems and enable programmers to create reusable and maintainable code. By using design patterns, programmers can leverage existing knowledge and best practices to improve the overall quality and efficiency of their software designs.

    Rate this question:

  • 3. 

    Which of the following are among ten things, which the basic templates of GoF design pattern include?

    • A.

      Problem

    • B.

      Context

    • C.

      Forces

    • D.

      All of the above

    Correct Answer
    D. All of the above
    Explanation
    The correct answer is "All of the above" because the basic templates of GoF design patterns include problem, context, and forces. These three elements are essential in understanding and applying design patterns effectively. The problem refers to the specific issue or challenge that the design pattern aims to solve. The context provides the background and environment in which the problem exists. The forces are the constraints and considerations that influence the design decisions. Therefore, all three elements are necessary components of the basic templates of GoF design patterns.

    Rate this question:

  • 4. 

    1. Which are NOT the possible errors of using design patterns?

    • A.

      Superficiality

    • B.

      Cohesion

    • C.

      Fit

    • D.

      Misdiagnosis

    Correct Answer
    B. Cohesion
    Explanation
    The possible errors of using design patterns include superficiality, fit, and misdiagnosis. However, cohesion is not considered an error when using design patterns. Cohesion refers to the degree to which the elements within a module or class belong together and work together towards a common goal. It is a desirable quality in software design and not considered an error.

    Rate this question:

  • 5. 

    Design patterns have to be object oriented?

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    Design patterns do not have to be object-oriented. While many design patterns are commonly used in object-oriented programming, there are also design patterns that can be applied in other programming paradigms such as functional programming or procedural programming. Design patterns are general reusable solutions to common problems in software design, and they can be adapted and used in various programming paradigms depending on the specific problem at hand.

    Rate this question:

  • 6. 

    Design patterns enables ____ reuse

    • A.

      Design

    • B.

      Architecture

    • C.

      Application Logic

    Correct Answer
    A. Design
    Explanation
    Design patterns enable code reuse.

    Rate this question:

  • 7. 

    1. Which of following patterns is not used to create an object?

    • A.

      Factory method

    • B.

      Strategy

    • C.

      Prototype

    • D.

      Abstract Factory

    Correct Answer
    B. Strategy
    Explanation
    The Strategy pattern is not used to create an object. The Strategy pattern is a behavioral design pattern that allows selecting an algorithm at runtime. It defines a family of algorithms, encapsulates each one, and makes them interchangeable. It is used to provide different strategies for solving a problem. However, it does not involve the creation of objects itself.

    Rate this question:

  • 8. 

    Which design pattern is also called anti pattern?

    • A.

      Factory method

    • B.

      Singleton

    • C.

      Prototype

    • D.

      Abstract Factory

    Correct Answer
    B. Singleton
    Explanation
    The Singleton design pattern is often referred to as an anti-pattern because it can introduce global state and tightly couple different parts of the codebase. It can make the code harder to test, maintain, and extend. The use of a Singleton can also hinder parallelism and make it difficult to achieve proper separation of concerns. Therefore, while the Singleton pattern can be useful in certain scenarios, it is generally considered an anti-pattern due to its potential drawbacks.

    Rate this question:

  • 9. 

    What is the key strategy in the Abstract factory?

    • A.

      Find what varies and encapsulate it

    • B.

      Favour aggregation over inheritance

    • C.

      Design to interfaces, not to implementations

    • D.

      All of the above

    Correct Answer
    D. All of the above
    Explanation
    The key strategy in the Abstract factory is to implement all of the given options. "Find what varies and encapsulate it" refers to identifying the varying parts of an object and encapsulating them into separate classes. "Favour aggregation over inheritance" suggests using composition and object aggregation instead of relying solely on inheritance. "Design to interfaces, not to implementations" emphasizes programming to interfaces rather than concrete implementations, allowing for flexibility and interchangeability. Implementing all of these strategies helps in creating a flexible and maintainable codebase.

    Rate this question:

  • 10. 

    1. What is the factory implementation in C#?

    • A.

      GetObject()

    • B.

      GetEnumerator()

    • C.

      GetType()

    • D.

      None of the above

    Correct Answer
    B. GetEnumerator()
    Explanation
    The GetEnumerator() method is the factory implementation in C#. This method is used to create and return an enumerator object, which allows for iterating over a collection of objects. It is commonly used in conjunction with the foreach loop to iterate through elements in a collection. The other options (GetObject(), GetType(), and None of the above) are not related to factory implementation in C#.

    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 22, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Jun 06, 2013
    Quiz Created by
    James Richardson
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.