IBM Interview Question for Developer Program Engineers


Country: India
Interview Type: Phone Interview




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

In java you can instantiate several instances of even correctly implemented singleton in case you are working with several classloaders.
Another possible answer is 'in distributed environments'.

- seirge July 18, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

i have a doubt for distributed env bcoz some like hadoop have memcache which gives the feeling of local

- kevinbheda July 19, 2012 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

When is Singleton not a singleton -
http java dot sun dot com/developer/technicalArticles/Programming/singletons/

- raj August 17, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

imo, Singleton wont behave according to its definition, when we successfully Serialize the class object OR apply clone() on the class object. i think, both operations will clearly create new reference object.

Ps: Correct me, if i am wrong.

- Java~Fool September 03, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

1, use reflection
2, multithread

- aaron January 08, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

when you incorrectly implement it??

- guest July 17, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

that's a tricky one.
Lots of poor codes lead to that

- oohtj July 17, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

when we serialization the object, the singleton may behave different

- mani July 18, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

when we forget to throw cloneNotSupportedException,
to prevent the cloning of a singleton object

- Xiaonb August 10, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Possible scenories:
1) it should not work in a multi threaded enviornemnt...off course, not considered as double check locking mechanism...
2) If ctor of a class is in public mode

- Sindhi December 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

refer to dgmjava.blogspot.com

- dip January 07, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

A singleton class will not work as Singleton in these situations
1. If not coded Thread safe
2. Across Process. Each JVM will have it's own Instance of Singleton
3. Using Multiple Class loaders can lead to multiple instances of same class
4. JVM before 1.2, Garbage collector will collect it if not maintained reference of Singleton

- pc June 02, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 3 vote

When you have public constructor.

- loveCoding July 17, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Explain?

- Anonymous July 18, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

if it has declared as public cons... it wont be called as singleton at all...

- apr July 18, 2012 | Flag


Add a Comment
Name:

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

Books

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

Videos

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