Infibeam Interview Question for SDE-2s


Country: India
Interview Type: Phone Interview




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

Definition of Producer- Consumer problem from wikipedia:-

" The producer and the consumer, who share a common, fixed-size buffer used as a queue. The producer's job is to generate a piece of data, put it into the buffer and start again. At the same time, the consumer is consuming the data (i.e., removing it from the buffer) one piece at a time. The problem is to make sure that the producer won't try to add data into the buffer if it's full and that the consumer won't try to remove data from an empty buffer."

In this case instead of a single producer producing data and single consumer consuming there can be multiple producers producing data and multiple consumers consuming them.

- hulk May 03, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

could you clarify the question? maybe the class LinkedBlockingQueue could be used for such purposes.

- Oleg G May 03, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

The interviewer told not to use any BlockingQueue implementation there in Java inbuilt.

The discussion moved on from a standard producer / consumer implementation in which we have to use our own BlockingQueue implementation.

For standard producer-consumer implementation you can refer:-

hxxp://javarevisited.blogspot.sg/2012/02/producer-consumer-design-pattern-with.html

- hulk May 03, 2014 | Flag
Comment hidden because of low score. Click to expand.
-2
of 2 vote

@hulk stop spaming with your fake interview questions. Some people want to prepare themselves for the real interview instead of solving your study problems.

- Anonymous May 03, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I know the rules very well. If this was a non-interview question I would have posted this in Forums not here.

Now coming to this question, if you have given interview in any decent product company for mid-level java role then you will know that this is quite common multi-threading question.

In fact I was asked this same question in two companies :)

- hulk May 08, 2014 | 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