Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Create a program to implement a basic thread-safe Singleton design pattern.

Hard

Problem Statement

Create a program to implement a basic thread-safe Singleton design pattern.

Sample Input

Class Instance Request: Multiple calls to GetInstance()

Sample Output

Singleton instance created.
Singleton instance in action.
Singleton instance in action.
Same instance

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
using System; class Singleton { static void Main() { // Implement a thread-safe Singleton design pattern } }
Log in or sign up to run or submit your code.Log inSign up
Input
Class Instance Request: Multiple calls to GetInstance()
Expected Output
Singleton instance created.
Singleton instance in action.
Singleton instance in action.
Same instance