Microsoft Interview Question for Software Engineer / Developers


Country: United States
Interview Type: Phone Interview




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

(1) We know all the labels are wrong,
Because of (1), the "mixed" basket has to be either all apples or oranges, it cannot be mixed. You pick from the basket labeled "mix". There are two cases:
1. You picked an apple. We now know the basket labeled "mixed" is all apples. Then (again due to (1)) the basket labeled "orange" can either be all apples or mixed. But we already know it is not all apples. Thus, the basket labeled "orange" is mixed. And the remaining basket is all apples.

2. Similar to the case above. If you get an orange from the basket labeled "mixed", we know that the basket is all oranges. Then the one labeled "orange" has to be apples and the remaining one is all mixed (EDIT: corrected the last basket label. Thanks to John Zhao).

- gokayhuz October 27, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

In the first case the remaining one is mixed and the second case remaining one is mixed as well. If you say that the remaining basket is all apples or all oranges you are wrong since the one labeled mixed will be that.

- Anuj October 27, 2013 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

@anuj : Read the solution again.

- teli.vaibhav October 27, 2013 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

In the first case, it's correct. But in the second case, the remain one is all mixed, not oranges, since you have determined the basket labeled "mixed" has oranges.

- John Zhao October 27, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Pick the mixed box, since it is wrongly labeled we can certainly get to know one kind of fruit basket.

- Anonymous November 05, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

You are hire as software engineer in multinational company your task is to write a conversion program for a Shopkeeper selling fruit. First ask the user for the amount of fruit to buy, such as 3 apples and 2 oranges. Then find the minimum number of 100g, 50g, 20g, 10g and 5g weights for weighing the fruit. An apple has a weigh of 105g and an orange has a weight of 120g. Your program should produce input/output that looks like the following:
Weight program
Enter the number of apples to buy: 3
Enter the number of oranges to buy: 2
100g-weight: 5
50g-weight: 1
20g-weight: 0
10g-weight: 0
5g-weight: 1

- Anonymous January 27, 2021 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Simple symmetry argument. Picking apple is "equivalent" to picking orange. So pick mixed.

- Anonymous October 28, 2013 | Flag Reply


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