kSquared at GameDev community forums posted a list of phone screen questions from Google, with some answers that he attempted. You’ll have to head to GameDev to read the answers, but here’s the list of questions to ponder:

- You are shrunk to the height of a nickel and your mass is proportionally reduced so as to maintain your original density. You are then thrown into an empty glass blender. The blades will start moving in 60 seconds. What do you do?
- How would you find out if a machine’s stack grows up or down in memory?
- Explain a database in three sentences to your eight-year-old nephew.
- How many gas stations would you say there are in the United States?
- How many golf balls can fit in a school bus?
- How much should you charge to wash all the windows in San Francisco?
- How many times a day does a clock’s hands overlap?
- How many piano tuners are there in the entire world?
- You have eight balls all of the same size. 7 of them weigh the same, and one of them weighs slightly more. How can you find the ball that is heavier by using a balance and only two weighings?
- You have five pirates, ranked from 5 to 1 in descending order. The top pirate has the right to propose how 100 gold coins should be divided among them. But the others get to vote on his plan, and if fewer than half agree with him, he gets killed. How should he allocate the gold in order to maximize his share but live to enjoy it? (Hint: One pirate ends up with 98 percent of the gold.)
- You have to get from point A to point B. You don’t know if you can get there. What would you do?
- Imagine you have a closet full of shirts. It’s very hard to find a shirt. So what can you do to organize your shirts for easy retrieval?
- Every man in a village of 100 married couples has cheated on his wife. Every wife in the village instantly knows when a man other than her husband has cheated, but does not know when her own husband has. The village has a law that does not allow for adultery. Any wife who can prove that her husband is unfaithful must kill him that very day. The women of the village would never disobey this law. One day, the queen of the village visits and announces that at least one husband has been unfaithful. What happens?
- In a country in which people only want boys, every family continues to have children until they have a boy. if they have a girl, they have another child. if they have a boy, they stop. what is the proportion of boys to girls in the country?
- If the probability of observing a car in 30 minutes on a highway is 0.95, what is the probability of observing a car in 10 minutes (assuming constant default probability)?
- If you look at a clock and the time is 3:15, what is the angle between the hour and the minute hands?

## 18 Comments on Programming phone screen questions

9) You have eight balls all of the same size. 7 of them weigh the same, and one of them weighs slightly more. How can you find the ball that is heavier by using a balance and only two weighings?

ANSWER: Weigh 3 balls on each side of balance.

IF even, the remaining ball is heaviest.

ELSE, one side will be heavier. Thus the heaviest ball is one of the those three.

Balance 2 of remaining 3.

IF even, remaining ball is heaviest.

Slight edit on Tyson’s answer

9) You have eight balls all of the same size. 7 of them weigh the same, and one of them weighs slightly more. How can you find the ball that is heavier by using a balance and only two weighings?

ANSWER: Weigh 3 balls on each side of balance.

IF even, weigh the remaining 2 balls.

ELSE, one side will be heavier. Thus the heaviest ball is one of the those three.

Balance 2 of remaining 3.

IF even, remaining ball is heaviest.

#1. Stay low, depending on the blender of course.

#7 At least 24 times as every hour has a corresponding minute of overlap.

#16 0 or 360 degrees.

>>ANSWER: Weigh 3 balls on each side of balance. IF even, the remaining ball is heaviest.<<

Wrong. There are 8 balls, not seven.

16. If you look at a clock and the time is 3:15, what is the angle between the hour and the minute hands?

—-

7.5 degrees.

minute hand is on the 3, hour hand is 1/4 of the way from 3 to 4. Circle is split up into 12 hour sectors, and 12*4=48 quarter hour sectors. The angle is one quarter hour sector, so 360 degrees/48 = 7.5 degrees.

7. How many times a day does a clockÃ¢â‚¬â„¢s hands overlap?

Ans: A clock’s hand will overlap once in an hour. So in a day = 24 times will get overlap.

—————

9. You have eight balls all of the same size. 7 of them weigh the same, and one of them weighs slightly more. How can you find the ball that is heavier by using a balance and only two weighings?

Ans: Step-1: First group the balls in 3+3+1

Step-2: Then take the 3+3 use the first chance to weigh the both set of 3 by placing the weight balancing gauge.

Suppose if it balanced. The one which we have separately is the heavier.

Else

Steup-3: Find the heavier side of 3 balls among them (which is in the weighing gauge) split those as 1+1+1. Then use the second chance to weigh it by using weight balance.

Keep one ball in each side of the weight balance and keep the other one separately.

If the weight balance is equal. then heavier is the ball which we have separately or the weight balance will show the heaviest easily.

———————–

16. If you look at a clock and the time is 3:15, what is the angle between the hour and the minute hands?

Ans: While the minute hand is on the 3, hour hand is 1/4 of the way from 3 to 4. That is exactly it might reached one fourth of the distance.

As the clock is having 360 degrees in total.

We can find by dividing 360/12 = 30 degrees. That is 30 degree will be the in-between degrees of subsequent hours. (eg: 1-2 will have 30 degree angle)

Hence to find the 3hrs 15 min degree = 30/4 = 7.5 degree (in 1 hour four 15 min will come right ?)

7.5 degree will be the ans.

If the probability of observing a car in 30 minutes on a highway is 0.95, what is the probability of observing a car in 10 minutes (assuming constant default probability)?

We have a 5% probability of not observing a car in 30 minutes. This is the same as the probability of not observing a car in 10 minutes for 3 consecutive periods. Therefore

1/20 = (x)^3 where x is the probability of not seeing a car in 10 minutes. Therefore x is approximately 2.714.

For some of the more poignant questions, here’s how I’ll ask the interviewer back:

1) Will I blend? (if not, lie really flat and pray to as many gods as possible in 60 seconds)

2) Do I have gdb?

7) Does the clock have a second hand?

11) Is this not urgent or does point B save me from a falling piano?

12) Is there an even distribution of colors or am I as I’m imagining with lots of black shirts? If so, this is obviously a max heap.

Now for #13,

All 100 couples stand there and look at each other. If there’s one cheater, then there is one wife who can’t see a cheating husband…which means it’s hers. He immediately dies and all is well.

If nobody says anything that day, then there must be more than one cheater. Assume that there are two, then every wife but one must see two cheating husbands. The wife that sees only one can figure that his husband must be a cheater, because otherwise that one she sees would have died already. She goes stabby, we then go back to the one-cheater scenario, and all is well.

Assume that there are three cheaters, then everybody but one wife sees three cheaters. When that wife notices that nobody has said anything beyond the time it takes to process the two-cheater scenario (say one more day) she will know that her husband is cheating.

And so on until all cheaters die.

Weigh 3 balls on each side of balance.

IF even, weigh the remaining 2 balls.

ELSE, one side will be heavier. Thus the heaviest ball is one of the those three.

Balance 2 of remaining 3.

IF even, remaining ball is heaviest.

How many golf balls can fit in a school bus? It depends on the size of the bus,it may be a double decker bus.

If you look at a clock and the time is 3:15, what is the angle between the hour and the minute hands?

Sorry,I am wearing a digital watch.

#15

Steve said:

“1/20 = (x)^3 where x is the probability of not seeing a car in 10 minutes. Therefore x is approximately 2.714.”

You got your reasoning right but for some reason bungled the final part. x is approximately 0.37, and as this represents the chance of NOT seeing a car in any given ten minute period, the chance of SEEING a car is 0.63 approx.

#7

Techno says:

“Ans: A clockÃ¢â‚¬â„¢s hand will overlap once in an hour. So in a day = 24 times will get overlap.”

No. Consider a 12 hour rotation, and let’s consider all moments when we move from non-overlapping to overlapping. On the first hour, this DOES NOT OCCUR. On all subsequent hours, it happens once in that hour. (On the twelfth hour, it happens right at the very last second.) So you get 11 overlaps in any twelve hour period, and 22 overlaps in a day.

#13

there are 100 cheaters. The wives know of 99. they wake up in the morning no man is dead => their husband is the cheater, so they kill him. All men are dead RIP. (it’s a livelock-like question, it depends on the sampling method)

7. A clock’s hands overlap at 12:00, they also overlap once per hour, except in the 11th hour. In the 11th hour, the minute hand doesn’t catch up to the hour hand until 12:00, so the answer is 22 times per day.

13. All the men in the village will be killed. Let’s call one of the women #49. She knows of 49 infidelities. If her husband was faithful, all other women would know of 48 infidelities. Now a new woman #48 would assume her husband was faithful and believe all other women knew of 47 infidelities. This would continue until one woman was totally unaware of cheaters. (Keep in mind, all women actually know of 49 cheaters, they just think there is a 49,48,47…1,0 knowledge pattern). When the queen makes her announcement, the lack of surprise in the village will confirm that this pattern is not true, therefore every husband is a cheater and they will all die.

3)A database is like a large book contain everything you needed.

4) No. of gas station=2*total no. of cities.

5)No. of Golf ball=(Size of Bus/size of ball)

6)No.of glass* $1

7)24

8)NO.of company making piano tuners*AVG. no. of piano tuners made by them

9)Total no. of Ball=8

Weight 3 balls on each side of balance.

So that one condition comes that they are in equal Weight.

afterthat 2 ball remaining with 1 weight slightly more.

Now it is easy to find the heaviest ball.