# Apple Interview Puzzle

Posted on :23-02-2016
Apple Interview Puzzle:-

Q1. You are given a 6 by 6 grid and asked to start on the top left corner. Now your aim is to get to the bottom right corner. You are only allowed to move either right or down. You must never move diagonally or backwards.
How many feasible ways are there for you to reach the end point?

ANS: 252 ways.

Explanation:

Pick up any random cell. Suppose that you took n steps in reaching the particular cell above it and m steps to reach the particular cell placed left to it. In such circumstances, the number of ways to reach to the random cell is equal to the sum of two steps n+m. Thus, keep that logic in mind and fill out the six by six grid. In that manner, there are 252 ways to get to the destination that is the bottom right step.

Q2. You are given with a cube with a three by three grid. Suppose you are standing on the back left corner of the cube and you are supposed to reach the front right of the cube. You are free to move towards the front, downwards or upwards.
How many ways are there that will take you to the end?

ANS: 90

Explanation:

Split the cube into three by three grids. You will get three layers. Now get to one square from the cell adjacent instead of counting the path. You can now count the paths from the left (x), the right (y) and the level above (z). So the path for any square will be x + y + z.

Q3. Find out the next term in the series
F21, S23, T25, T27, S29, M31, __?

ANS: W02

Explanation:

F21: Friday the 21st.
S23: Sunday the 23rd.
T25: Tuesday the 25th.
T27: Thursday the 27th.
S29: Saturday the 29th.
M31: Monday the 31st.

Avoiding every other day, the next term must be Wednesday the 2nd i.e. W02

Q4. You have ten sets of 10 coins. You are aware of exactly how much the coins weigh. You also know that all the coins in one set of ten are exactly a hundredth of an ounce off which makes the entire set of the ten coins a tenth of an ounce off. Also you are aware of the fact that all the other coins weight the correct amount. Now you are allowed to use an exceptionally precise digital weighing machine only once.
Can you identify which set of 10 coins is faulty?

ANS:
Keep one coin from the first set and place it on the scale along with the two from the second set etc. If the weight is off by one hundredth of an ounce, then you will know that it is the first set that is faulty and if the weight is off by two hundred of an ounce, then the second set is faulty and so on.

Q5. Sheldon Cooper reaches the final destination in his quest of finding the hidden treasures. The final destination has two doors - one leads to the treasure and the other leads to a deadly maze that ends only at death. The doors are protected by two guards. Both of the guards know the correct door that leads to the treasure. One of the guards never speaks a lie and the other always speaks a lie. But the sad part is that there is no way Sheldon Cooper can identify who is the liar and who speaks truth. Also the guards allow only one question to be asked to any one of the both.
What question will Sheldon Cooper ask and to whom to finally get the treasure he has been searching for?

ANS:
He can ask any one of them. The question he will ask is - Which door will the other guy say is the correct one?

If he asks this question to the truth teller, he will get the incorrect door as he will honestly tell him what the liar will say. If he asks the liar, he will get the incorrect door again as he will lie about what the truth teller will tell him (the truth teller will obviously tell him the right door). Thus, by asking any of them, Sheldon Cooper will get the incorrect door only and he can choose the other one to find the treasure.

Q6. There are 100 bulbs lined up in a room. All are turned on in the first pass. Then all the even numbered light bulbs are switched off. After that, every third bulb is switched on. Then all those bulbs that were switched off are turned back on and all those that were lit are turned off. Then the same process is being carried with the fourth bulb and the fifth bulb.
How many bulbs are glowing after 100 passes?

ANS: 10 Bulbs

Explanation:

For this tricky puzzle, you must check how many light bulbs in the row are having an odd number of factors. The first one surely has odd number of factors, the second has even, four has odd. Thus the bulb four and one will remain lit. The bulbs that are going to remain lit are perfect squares as they have an odd number of factors - 1, 4, 9, 16.

Since there are 100 passes, you can go up to 10 times 10 i.e. the square of 10. There are 10 perfect squares available to you - one, two, three, four, five, six, seven, eight, nine and ten. They corresponds to the bulb number 1, 4, 9, 16, 25, 36, 49, 64, 81 and 100. All of them will remain lit and thus total ten bulbs will remain lit after 100 passes.

Q7. Just to test the brilliance of Sherlocks mind, Dr. Watson makes five people stand in front of him. Out of the five, only one is the truth teller and the other four are togglers which means they may tell the truth or lie on being asked. But on being asked again, they will switch which means if they told a lie the first time, they will tell the truth on second question and vice versa.

Sherlock is challenged to ask only two questions to determine who the truth teller is. He can ask both the questions to the same person or ask two different people. How will he determine who is the truth teller?

ANS:
Sherlock will ask any one of them Are you the truth teller? There can be two responses to this question - Yes or No.

If the person says yes, then he is the truth teller or a lying toggle.
He will ask the second question to the same person Who is the truth teller?
If he is the truth teller, he will admit it. If he is a lying toggler, he will speak truth on the second question if he lied on the first, telling you who the truth teller is.

If the person says no, Sherlock will be confirmed of the fact that he is not the truth teller and thus he is a toggle who has told truth and will say a lie on the second question.
The next question he will ask to the same person Who is not the truth teller?
Since the person told truth in the first question, he will speak a lie this time and in order to tell a lie, he will tell Sherlock exactly who the truth teller is.

Q8. Three best logicians are brought into a room. Each of them has been painted a number on their forehead with a number that is unique and greater than zero. You are one of them and can see other two foreheads with the number 20 and 30 painted on them. The game begins and the host circles around the logicians asking each one of them to guess the number written on their forehead. Each of the logician is unable to answer and says that he can not guess it. Then the question is asked again.
What is your number and why?

ANS:
This particular answer depends on what the third person says.

You know that the other two logicians have 20 and 30 painted on their foreheads. If the first logician is 10, the second will either say he has either 40 or 20 painted on his forehead. The second logician will say I am either 30 or 10 but I can not be 10 because every number is unique as explained earlier. If the third logician is able to deduce that he has 30 painted on his forehead, but the third logician is not able to deduce the number. Thus the first logician is not numbered 10 and he must be painted 50 on his forehead.

Q9. Hundred most brilliant logicians are handpicked from the world and invited to a room. But before they could enter, they are told that at least one of them has a black forehead. Whenever anyone can frame out that he is having a black forehead, he needs to leave the room when the lights are turned off. After that, the lights are turned back on and those who could infer that their forehead was black have left the room.
What happens if they have painted every forehead black?

ANS:
Since there are 100 logicians, the lights are turned on and off hundred times and after the 100th time, all the logicians leave the room.

If all of them see 99 black foreheads, the lights get turned off. When the light is turned on again, everyone is able to see 99 black foreheads again. This happens 100 times and then every logician leaves the room.

Let us make it more simplified for you. Assume that only one person has a black forehead. The people who invited them said that at least one person has a black forehead and as they turn off the lights, that logician leaves.

Imagine the scenario with two logicians having black forehead. One of the logician sitting there must be thinking I have a black forehead or I do not have a black forehead. If I am not the one with black forehead, the other logician with black forehead will deduce that he is having a black forehead and then he will leave.

If I do not have a black forehead, the other logician will stay and thus I must be having a black forehead as well. Thus we must leave when the lights are turned off for the second time

When you repeat the logic to 100 times, you will get the answer.

Q10. An alien force has invaded the realms of the earth. All they plan is the destruction of the entire planet. However, they have given humans a chance. They picks up ten intelligent most humans (you are one of them) and take them in a pitch black room. There is nothing you can see in the total darkness. The aliens place a hat on every human. The hats are of two colors - pink and green. After they place all the hats, the lights are turned on.
You are not allowed to see your own hat. The circulation of the hat is totally random with any kind of possible combination. The aliens start from the back and ask, What is the color of hat you are wearing? Everyone is allowed to hear the answer. If he gives the correct answer, he will be allowed to live and save the people but if he gives the wrong answer, he will be killed mercilessly and the people you represent will be killed.
What will you do to save as many lives as you can?

ANS:
The human in front will count the number of green hats and if the count is an odd number, he will say green and if the number is even, he will say pink.

The next human behind him definitely saw either an odd or an even number of hats. If the number is still odd, then he has a pink hat. That human says Pink and survives. Thereafter, there will be an odd number of green hats forward and the third person can decide whether he is wearing a green hat or a pink hat.

If the second person sees an even number of green hats, then he must have a green hat as well and will be freed. In this fashion, the humans will just have to keep the track if the number of green hats in front of them are odd or even in number and then they can spontaneously conclude with the color of their hats.

Since the first human will be guessing, he will have a 50/50 chance of surviving but the other 9 people will definitely be saved.

Samsung
Microsoft
Siemens
Verizon