Design Patterns in .NET Framework

This Tests consist of questions related to Design patterns for the Dot Net framework. This test is beneficial to prepare for GATE exam as well as for development resources.

15 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which of the following is/are the correct statements for the Singleton design pattern in .Net?

  1. We can make Singleton class by making a private constructor of that class.
  2. Static initialization is suitable for multiple threaded Singleton class.
  3. Singleton class is used to save state and storing caches.
  4. All of the above.
  5. Only (1) and (3).
Question 2 Multiple Choice (Single Answer)

Which of following is/are correct about Prototype design pattern in C#?

  1. It comes under the category of Creational design Pattern.
  2. In this pattern, a limited number of state combinations exist in an object.
  3. Prototype pattern is used to reduce the database calls during database operations.
  4. All of the above
  5. Both (1) and (3)
Question 3 Multiple Choice (Single Answer)

What are the disadvantages of using Singleton Pattern in .Net?

  1. Singleton pattern reduces the potential for parallelism within a program.
  2. Using this pattern, the unit testing is more difficult.
  3. Singleton can be lazy loaded.
  4. Both (1) and(2).
  5. None of the above.
Question 4 Multiple Choice (Single Answer)

Which of the following is/are incorrect about Virtual Proxy object in the Proxy design pattern?

  1. It represents an object locally which belongs to a different address space.
  2. This object represents a heavy or skeleton object as a virtual proxy object and on demand loads the real object.
  3. It provides protection to the web pages by blocking some content.
  4. It provides the client specific information to the server.
  5. Option (1), (3) and (4).
Question 5 Multiple Choice (Single Answer)

Which of the following features are included in the Proxy design pattern?

  1. It provides security access to an existing object.
  2. It simplifies the API of complex objects.
  3. It provides interface for remote resources such as web service or REST resources.
  4. All of the above.
  5. Only (1) and (3).
Question 6 Multiple Choice (Single Answer)

Which of the following is/are false about Proxy design pattern in .Net?

  1. This pattern provides an interface to other objects by creating a wrapper class as the proxy.
  2. It provides the thread-safe feature to an existing class without changing the existing class's code.
  3. This pattern is used to construct a complex object.
  4. This pattern is used in web services.
  5. None of the above.
Question 7 Multiple Choice (Single Answer)

Which of the following is/are the false statement about composition method of Adapter design pattern implementation?

  1. It creates an has-a relationship.
  2. It creates an is-a relationship.
  3. This implementation is used when a class with an incompatible method needs to be used with another class.
  4. Both (2) and (3).
  5. None of the above.
Question 8 Multiple Choice (Single Answer)

Which of the following usability are provided by the Singleton class?

  1. Singleton class provides interface inheritance.
  2. Singleton class has static initialization.
  3. Singleton class can be extended into a factory pattern.
  4. All of the above.
  5. Only (1) and (2).
Question 9 Multiple Choice (Single Answer)

What is the significance of double locking technique in Singleton design pattern?

  1. It is used for concurrency issue in the application.
  2. It makes sure that no race condition in the application code.
  3. This technique does not maintain the thread safety in the application.
  4. This technique allows the developer to delay the instantiation of the object until it is first called upon.
  5. Both (1) and (3).
Question 10 Multiple Choice (Single Answer)

When is the facade design pattern being used?

  1. When a simple interface is required to access to a complex system.
  2. When the abstractions and implementations of a subsystem are tightly coupled.
  3. When there is need to separate an abstraction from its implementation.
  4. All of the above.
  5. Both (1) and (2).
Question 11 Multiple Choice (Single Answer)

Which of following is/are incorrect about Shallow Cloning in Prototype design pattern in C#?

  1. In Shallow Cloning, the copy of an object copies the elements and everything directly or indirectly referenced by the elements.
  2. In a Shallow copy, it copies all reference types or value types.
  3. In this cloning, only the parent object is cloned.
  4. In this cloning, the references in the new object point to the same objects that the references in the original object points to.
  5. Both (1) and (3).
Question 12 Multiple Choice (Single Answer)

Which of the following is/are incorrect about Remote Proxy object in the Proxy design pattern?

  1. It provides the client specific information to the server.
  2. This object represents a heavy or skeleton object as a virtual proxy object and on demand load the real object.
  3. It provides protection to the web pages by blocking some content.
  4. All of the above.
  5. Both (1) and (2).
Question 13 Multiple Choice (Single Answer)

Which of the following statements determine the behaviour of the Abstract factory pattern?

  1. It has step by step construction of a complex object.
  2. This pattern does not provide any concrete class for the dependent objects.
  3. This pattern allows the type of objects to be instantiated at run time.
  4. All of the above.
  5. Both (2) and (3).
Question 14 Multiple Choice (Single Answer)

Which of the following is/are correct about Aggregate interface in Iterator design pattern?

  1. It declares an interface to define the methods for the client.
  2. Client code should not be concerned about the details of the implementations.
  3. It provides a way to access the elements of aggregate objects sequentially without exposing its representation.
  4. All of the above.
  5. Both (1) and (3).
Question 15 Multiple Choice (Single Answer)

Which of following is/are correct about Deep Cloning in Prototype design pattern in C#?

  1. In this cloning, the copy of an object copies the elements and everything directly or indirectly referenced by the elements.
  2. In a deep copy, it copies all reference types or value types.
  3. In this cloning, only the parent object is cloned.
  4. In this cloning, the references in the new object point to the same objects that the references in the original object points to.
  5. Both (1) and (2).