Bloomberg LP Interview Question for Senior Software Development Engineers

Country: United States
Interview Type: Written Test

Comment hidden because of low score. Click to expand.
of 1 vote

the only little bit interesting thing about singleton is the initialization with multiple threads. The trick is to first check the instance variable, if it is not null, return it. if it is null, lock a critical section, check again if the instance variable is not null and only initialize if null. Just don't do this with c++ on multi core platforms, because it won't work properly.

- Chris June 19, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
of 1 vote

Singleton with respect to what?
1. Virtual Machine level?
2. User Level?
3. OS Level?
4. Network Level?
5. WAN level?
6. .. Internet level?
You can have singleton for all of it, really. Perhaps not [6], enforcing is a huge problem, so may be not [6].
Let's see.

1. Given something is reflective, you can not have true singleton. The only way to achieve singleton in JVM is either use static final classes, or use enums.
2. User level Singleton. Try running two windows media player. Try it. Hmm. You can not. We were taught about this one.
3. OS level - there are plenty examples of singleton process - you can implement that as a class - but... well.
You got the idea.
Only one instance exists is not even a pattern, it is a property, and not so much easily implemented.
[ ]
In short, the singleton pattern makes code more complex, less useful, and a real pain to re-use or test. Eliminating singletons can be tricky, but it’s a worthwhile endeavour.

- NoOne June 20, 2017 | Flag Reply

Add a Comment

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.


is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More


CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More