MCSD MCSD 3 — Questions and Answers
Question 1: Which design pattern provides a single point of access to a class instance and ensures only one instance exists throughout the application?
- Factory
- Observer
- Singleton (Correct answer)
- Decorator
Correct answer: Singleton
The Singleton pattern restricts a class to a single instance and provides a global access point to that instance.
Question 2: In Azure, which storage type is best suited for storing large amounts of unstructured binary data like images and videos?
- Azure Table Storage
- Azure Queue Storage
- Azure Blob Storage (Correct answer)
- Azure File Storage
Correct answer: Azure Blob Storage
Azure Blob Storage is optimized for storing massive amounts of unstructured data such as text and binary files.
Question 3: What does the 'async' keyword in C# enable when applied to a method?
- Multi-threading with parallel execution
- Compilation-time optimization
- Awaitable asynchronous execution using the Task-based model (Correct answer)
- Automatic exception handling
Correct answer: Awaitable asynchronous execution using the Task-based model
The 'async' modifier enables the use of 'await' inside the method, allowing asynchronous, non-blocking execution using Tasks.
Question 4: In SQL Server, which isolation level prevents dirty reads but still allows non-repeatable reads?
- Read Uncommitted
- Read Committed (Correct answer)
- Repeatable Read
- Serializable
Correct answer: Read Committed
Read Committed prevents dirty reads by only reading committed data but does not prevent non-repeatable reads.
Question 5: Which HTML5 API allows a web application to store key-value pairs locally in the browser with no expiration?
- IndexedDB
- SessionStorage
- Cookies
- LocalStorage (Correct answer)
Correct answer: LocalStorage
LocalStorage persists data with no expiration date across browser sessions, unlike SessionStorage which clears on tab close.
Question 6: In dependency injection, what is the lifetime that creates a new service instance for every HTTP request in ASP.NET Core?
- Singleton
- Transient
- Scoped (Correct answer)
- Pooled
Correct answer: Scoped
Scoped lifetime creates one instance per HTTP request, shared within that request but not across requests.
Question 7: What is the role of an interface in C# when used for dependency injection?
- It enforces memory management
- It defines a contract that concrete implementations must fulfill (Correct answer)
- It prevents class inheritance
- It compiles code faster
Correct answer: It defines a contract that concrete implementations must fulfill
An interface defines a contract—specifying methods and properties without implementation—allowing different concrete types to be injected interchangeably.
Which design pattern provides a single point of access to a class instance and ensures only one instance exists throughout the application?