Skip to main content

8 interview questions engineers struggle to answer

Asked to: Systems engineer at Google

Q: How many trailing zeros are in the number 5! (5 factorial)?

Suggested answers:

Option 1: 5!=120. So there is 1 trailing zero.

Option 2: This sounds like one geared not so much towards getting the right answer, but getting to it the right way. If you think a bit and say 'one', the interviewer will know you did it the brute-force way, doing the math. You'd get at the answer faster, and probably impress them more, if you think instead how many times a ten will be produced in doing that math, rather than what the actual result of the math will be.


Asked to: Software engineer at Facebook

Q: You have two light bulbs at a 100-story building. You want to find the floor at which the bulbs will break when dropped. Find the floor using the least number of drops.

Suggested answers:

Option 1: Start moving up in increments of 10 floors and dropping the bulb until it breaks (ie: drop from floor 10, if it doesn't break, drop from floor 20, etc.). Once the bulb breaks, move down to the floor before it broke in and start moving up floors in increments of one until the second bulb breaks. This results in a worst case scenario of 19 drops.

Option 2: 19 drops is not the best worst-case scenario... imagine trying floor 16, if it breaks, you try 1 - 15 and that's 16 tries. If it doesn't break, then try floor 31 and if it breaks, then try 17 - 30 (so 16 tries, including the try on floor 16). And on and on (45, 58, 70, 81, 91, 100). If you reach 91, you'll have tried 7 floors so far and if it doesn't break, then there's 9 more tries to get to 100 (thus 16 in the worst case.)


Asked to: Manager at Amazon

Q: If you had 5,623 participants in a tournament, how many games would need to be played to determine the winner?

Suggested answers:

Option 1: The interviewer is not looking for the right answer because there can be many. What he/she is looking for is your logical approach to solving the answer. So you could start by probing more is first I would like to understand if 5,623 participants represent the number of teams or individuals. Then ask the next logical question based on the answer.'

Option 2: 5,622. Assuming it is a single elimination tournament. All teams lose one game except the champs. It's always # of teams - 1.


Asked to: Software development engineer at Web trends

Q: There are 20 different socks of two types in a drawer in a completely dark room. What is the minimum number of socks you should grab to ensure you have a matching pair?

Suggested answer:

I'm not a mathematician, statistician, or highly analytical, but if you pick up three socks they could still be all of the same type -- even if the odds are 50%. The Odds do not equal reality. So the only way to 'ensure you have a matching pair' is to pick up 11 of the 20. This is the only foolproof guaranteed way to get a pair (in the real world and not the world of odds.)


Asked to: Software engineer at Cisco

Q: If you have a square room with no roof, and you had four flagpoles you had to plant on the walls so that each flagpole touched two walls, how would you do it?

Suggested answer: The answer was that by planting them on the corners, each one is touching two walls because each corner is part of two walls. I wanted to pierce two walls with a pole horizontally too. They said it was an innovative solution.


Asked to: Software engineer at DE Shaw & Co

Q: There are 9 balls all of which weigh the same except one, what is the minimum weighings necessary to find the ball weighs more (or less)?

Suggested answer: You could do this with two weighings assuming its a two pan balance -- (1) place three balls on each side if they balance out, then it's the remaining three that has abnormal ball (2) out of that group, place one ball on each side - if balances it out, the abnormal ball is the remaining one. If the weighing in step (1) does not balance out, grab the group of three balls that is light or heavy and repeat step (2) described above.'


Asked to: ASIC verification engineer at Zoran

Q: You have 2 pieces of rope, each of which burns from one end to the other in 30 minutes (no matter which end is lit). If different pieces touch, the flame will transfer from one to the other. You cannot assume any rope properties that were not stated. Given only 1 match, can you time 45 minutes?

Suggested answers:

Option 1: Take one rope (Rope A), place it down as a circle. Light a match and start burning rope A at the tips that are touching. When the rope completely burns out, 15 minutes will have passed (since both ends are burning and being consumed at once). Hold the second rope (Rope B) straight and place one end so that it will immediately catch fire when the two burning points from (Rope A) finally touch and are just about to burn out. Thus 15 minutes on Rope A + 30 minutes on Rope B gives you 45 mins.

Option 2: Make a T simple.


Asked to: Software engineer at Raytheon

Q: In front of you are three light switches. Only one does anything, and it turns on the light downstairs. From here you can't see the light, and it makes no sound. You must determine which switch operates the light, but you can only go check it once. How do you figure out which switch is for the light?

Suggested answer: Flip any switch you want. Wait for about 5-10 minutes to let the bulb heat up. Flip that same switch off, and another one on. Go check the light. If it's off and hot, it was the first switch, if it's on it was the second and if it's cold and off, it was the last one.




Comments

Popular posts from this blog

HP's Spectre 13.3, the world's thinnest laptop

US tech giant HP has launched Spectre, touted as the world's thinnest laptop. The laptop is as thin as a AAA battery. Spectre measures 10.4 millimeters (0.41 inch) at its thickest point, this makes it slimmer than than the 12-inch MacBook (0.52 inches) and MacBook Air (0.68 inches). Another USP of the laptop is its copper design combined with carbon fiber that gives the laptop a premium look. It features 13.3-inch full HD screen with Corning Gorilla Glass. The laptop comes with 8GB LDDR3 RAM and 512GB SSD storage and runs on 6th generation Intel Core i5 and i7 processors. It features a hybrid battery that lasts up to 9.45 hours on a single charge, according to the company. The laptop includes 3 Type-C USB I/O ports. Priced the laptop at $1,249 (Rs 83,121 approx), HP Spectre will be available in Asia-Pacific and Japan starting May. The company also launched EliteBook Folio notebook; Elite x3 and Elite X2 computing devices. Elite Folio EliteBook Folio n

Perks Of Not Being A Party Person

A hot, new club has opened in your city and there is a long queue of people waiting outside, dying to get inside. And you are one of those people who won’t even consider going to the club to understand what the buzz is all about, because you don’t like to party. This post is for those people who prefer to eat out with friends, have a movie marathon on weekends, or curl up on the sofa with a nice book in hand, instead of going partying. 1. You can easily win an argument over not partying, when someone is being judgemental 2. You have amazing conversations with your friends which you actually remember later on  Remember when…? :) 3. You don’t have to worry about driving home safely a fter a night out with your friends Or have one friend to stay sane and sober so that person can drive you back home. Instead, all of you sing songs when you are going out in your car. 4. No alcohol and no partying equals no hangover So you don’t have to spend the same amount of time y

11 Reasons Why You Should Date Your Best Friend

Friends are the best people of your life as you have an option to choose them. We all have a best friend who understands you more than your beloved one. So would it be fair enough if we date our bestie ? Let’s see some reasons why you should date your best friend.. 1. She/he understands you more than your parents Source Your bestie understands you even more than your parents do as they easily can relate themselves to you. 2. Bonding Source The best bonding you do have is with your best friend. 3. You know what he /she actually wants Source You know what exactly your best friend expects from you and hence your relationship will go smooth 4. You know each other’s past Source You both know each other’s ex, crush and it will be easy to get them over their past. 5. All secrets are out Source Obviously all your secrets are out and you don’t need to spy each other. 6. Love is already there Source There is an unconditional and selfless love in best