# Engineering intern sollicitatievragen

# 40K

Sollicitatievragen voor een Engineering Intern gedeeld door sollicitanten## Meest gestelde sollicitatievragen

### given 20 "destructable" light bulbs(which breaks at certain height), and a building with 100 floors, how do you determine the height that the light bulb breaks.

56 antwoorden↳

Only one light bulb is needed. Start at floor level, drop it, and if it does not brake USE THE SAME BULB for next trial higher up until the very same bulb brakes. Minder

↳

binary search

↳

Start at the lost likely point based on your experience – the first floor -- and see if the bulb breaks when dropped. If not, then a test is warranted. Start at half way point and keep going up or down to the next halfway point until you determine the height. You should be able to determine the floor within 7 bulbs or fewer and – assuming each floor is 10 feet high, you should be able to determine the exact height in feet within another 5 bulbs or fewer. The greatest number of bulbs you could break to reach the answer would be 12, plus the one for the initial test = 13 total. Minder

### Gave a Situation of a Fire Burning in company. 3 Options : a) Run out of the company b) Save other People c ) Call fire Service

26 antwoorden↳

Answer was : Follow the evacuation procedure (Run out of the comany)

↳

call fire service and save the people

↳

Call fire service

### You have 25 horses, what is the minimum number of races you can find the top 3. In one race you can race 5 horses, and you don't have a timer.

31 antwoorden↳

7. chzwiz, your answer is incorrect. One of the first or second place horses could be 2nd fastest and/or 3rd fastest. I drew a grid to visualize the problem. First, run five races to establish 5 groups of internally ranked horses, and you can of course immediately eliminate 4 & 5 of each race. 1 2 3 x x 1 2 3 x x 1 2 3 x x 1 2 3 x x Then race 1st place horses, eliminate 4 & 5, and those they beat earlier. You can also eliminate the horses #3 beat, and the 3rd place horse from #2's first race. 1 ? ? X X 2 ? X X X 3 X X X X X X X X X X X X X X You know #1 is fastest. Race the remaining horses (2, 3 and ?'s), and the top two are 2nd and 3rd. After reading the above answers, this is the same as B's revised answer, but I found it easier to explain/visualize with the grid. Minder

↳

The answer is definitely 7, here is a fantastic explanation: http://www.programmerinterview.com/index.php/puzzles/25-horses-3-fastest-5-races-puzzle/ Minder

↳

It would be 7, mainly because since there only 5 racers each round, then it would be tournament style. As you can tell, tournament style never determines the rankings in the short term. (Imagine if a new tennis player played against Roger Federer and he loses. He's not bad, he's just really unlucky haha) So in order to determine the answer, you would have to use massive logic and reasoning. First step is obvious: you get 5 sets of horses to race through 5 races. So the number is already at 5. We get the top horse in each one and note them. However, one problem is that you have to consider if fastest horses could lie all in the first, second, third, fourth, or fifth group. But we can't determine that yet, so let's race one more time with the winners of each race. Second step: Race with each winner from their groups. That makes 6 total races so far. Ok, now we can get somewhere with this. So now, its a question of which horses we can eliminate to determine the next race. Who can we eliminate though? Well, we can get rid of: - All the horses in the group with the last race that were 4th and 5th place. This makes sense since if the winner of their groups only made 4th and 5th place in the tournament style race, then they are definitely not the fastest horses. 15 horses remaining. - Well, we can also get rid of the last two horses of each group since we are only looking for the top 3. 9 horses remaining. - We also can get rid of the first place winner since we already know he is definitely the best. 8 horses remaining. - Since we already determined who the fastest horse is, now we have to determine who the second and third fastest horse can be. In that case, the second place horse from the last round can get rid of the third horse of that group, since he definitely has no shot of being the first or second fastest horse of this new race. Also, in the third group, we can get rid of the second and third horse in the group due to the same reasoning above. 5 horses remaining. Oh wow! We now have 5 horses left! This means we can just have a clean race and find the second and third fastest horse. So overall, the answer is 7 races! Minder

### How many different ways can you get water from a lake at the foot of a mountain, up to the top of the mountain?

28 antwoorden↳

Jesus guys. You're interviewing for DISNEY! Use some imagination. My favorite so far is people power. Set up a huge rotating conveyor belt with small buckets on it, that dip into the lake. A person hops on at the top, and rides it down. This would be great if all the jobs were at the bottom, or if they needed t odo something else at the bottom. It would be fun too! Other ways might be to boil it yourself! dig under a section of lake and start a huge fire with a big condenser tube over it. Have the tube curly cue all the way to the top of the mountain, condense up there, then drip out as nice cool, distilled water. Use your imagination. Be creative. None of you would have been hired for this job. Minder

↳

It's Disney... CGI effects! The water doesn't really get there, it just looks amazing to the public. Minder

↳

I would borrow the sorcerer's hat, find all the brooms he left laying around and reanimate them to carry buckets of water up the mountain. It would be magical! Minder

### Given a number n, find the largest number just smaller than n that can be formed using the same digits as n.

16 antwoorden↳

My answer did not show properly: public static int smaller(int n){ if(n less than 10) return n; int d0 = n % 10, n2 = n / 10, d1 = n2 % 10; if(d1 greater than d0) return n / 100 * 100 + d0 * 10 + d1; return smaller(n2) * 10 + d0; } Minder

↳

It doesn't work, please ignore it This one works: public static int smaller(int n){ int i = 1; int result = 0; while(i ＜＝ n / 10 && n / i / 10 % 10＜= n / i % 10) i *= 10; if(i ＞ n / 10) return n; int d = n / i / 10 % 10; int j, x; for(j = 1; (x = n / j % 10) >= d; j *= 10) result = result * 10 + x; result += j * x; result = result * 10 + d; for(j *= 10; j ＜= i; j *= 10) result = result * 10 + n / j % 10; return result + n / i / 100 * i * 100; } Minder

↳

# Python implementation def getSmallerNumWithSameDigits(num): strNum = list(str(num)) endI = len(strNum)-1 endDigit = strNum[endI] # Walk backwards through digits for i in range(len(strNum) - 1, -1, -1): digit = strNum[i] # If the digit is greater than the end if digit > endDigit: # Swap them strNum[endI], strNum[i] = strNum[i], strNum[endI] break # Put back into int form return int(''.join(strNum)) print getSmallerNumWithSameDigits(912345678) Minder

### You are in a boat in a pool with a rock in your hand. You throw the rock into the pool. Does the water level rise, drop, or stay the same?

13 antwoorden↳

If the rock were neutrally buoyant the water level would remain the same. It is heavier than water which causes it to displace more than its own volume while in the boat compared to at the bottom of the lake. Therefore the water level of the lake would go down. Minder

↳

These answers are troubling. The only correct answer so far is Ben. The water level goes down. Minder

↳

The weight of the boat plus you plus the rock has already displaced the height of the water. The only time the water level will change will be when the rock is mid air. Minder

### The first question he gave me was not hard. 1. You call to someone's house and asked if they have two children. The answer happens to be yes. Then you ask if one of their children is a boy. The answer happens to be yes again. What's the probability that the second child is a boy? 2. (Much harder) You call to someone's house and asked if they have two children. The answer happens to be yes. Then you ask if one of their children's name a William. The answer happens to be yes again.(We assume William is a boy's name, and that it's possible that both children are Williams) What's the probability that the second child is a boy?

12 antwoorden↳

1. BB, BG, GB, GG 1/4 each, which later reduced to only BB, BG, GB with 1/3 probability each. So the probability of BB is 1/3 2. Let w is the probability of the name William. Probability to have at least one William in the family for BB is 2w-w^2, For BG - w, GB - w, GG - 0. So the probability of BB with at least one William is (2w-w^2)/(2w+2w-w^2) ~ 1/2 Minder

↳

The answer by Anonymous poster on Sep 28, 2014 gets closest to the answer. However, I think the calculation P[Y] = 1 - P[C1's name != William AND C2's name != William] should result in 1 - (1- e /2) ( 1- e / 2) = e - (e ^ 2 ) / 4, as opposed to poster's answer 1 - (e^2) / 4, which I think overstates the probability of Y. For e.g. let's assume that e (Probability [X is William | X is boy]) is 0.5, meaning half of all boys are named William. e - (e ^ 2) / 4 results in probability of P(Y) = 7/16; Y = C1 is William or C2 is William 1 - (e ^ 2) / 4 results in probability of P(Y) = 15/16, which is way too high; because there is more than one case possible in which we both C1 and C2 are not Williams, for e.g. if both are girls or both are boys but not named William etc) So in that case the final answer becomes: (3e/2 - (e^2)/2) * 0.5 / (e - (e ^ 2) / 4) = 3e - e^2 / 4e - e^2 = (3 - e) / (4 - e) One reason why I thought this might be incorrect was that setting e = 0, does not result in P(C2 = Boy | Y) as 0 like Anyoymous's poster does. However I think e = 0 is violates the question's assumptions. If e = 0, it means no boy is named William but question also says that William is a Boy's name. So that means there can be no person in the world named William, but then how did question come up with a person named William! Minder

↳

I think second child refers the other child (the one not on the phone) In this case answer to first is 1/3 and second is (1-p)/(2-p) where p is total probability of the name William. For sanity check if all boys are named William the answers coincide. Minder

### Why Network Rail and why the rail industry?

12 antwoorden↳

They give you a map with switches and relays. They correspond to track signaling systems. Standard red orange green. KVL, KCL and decent circuitry knowledge. Minder

↳

Just try to relate safety measures/hazards/etc to previous work experience. There was a relay on a circuit diagram. Just know what it is and basic functionality. Minder

↳

thank you mate, how about the KVL and KCL? what sort of questions were you asked about in regard? Minder

### Implement a power function to raise a double to an int power, including negative powers.

11 antwoorden↳

#include #include #define MAX_ARRAY_LENGTH 256 double power(double, unsigned int); int main(int argc, char** argv) { double a = atof(argv[1]); int b = atoi(argv[2]); double result = power(a, b >> 31 == 0 ? b : -b); if ((unsigned int) b >> 31 == 1) { result = 1 / result; } printf("%f\n", result); return 0; } double power(double a, unsigned int b) { switch (b) { case 0: return 1.0; case 1: return a; default: return (b & 1) == 0 ? power(a * a, b >> 1) : power(a * a, b >> 1) * a; } } Minder

↳

I am surprised that not a single person here had noticed that the guy asked to raise a DOUBLE to a given power. Men, double are not integers. Their exponent is stored in a part of their binary representation. If you multiply n times a double you will make n times a rounding error and n useless calculations. Just changed the binary part of the double that is related to its exponent, and here it is, your double has been raised to a given power, a you absolutely lost no precision, and you've made 0 calculations. This is basic stuff, every university teaches that to its students... floating numbers representation... Minder

↳

TD's answer is interesting, but not very useful. If you actually try it you'll find that since the double's base is 2, any changes to the exponent portion approximately multiply (or divide) numbers by a power of two. I say approximately here, since TD forgot to mention that the number itself isn't stored in float point numbers, only the digits after the implied 1. So yes, it's important to know how floating point numbers work, but modifying the exponent portion of a floating point number is a fundamentally incorrect solution. Minder

### Implement division without using multiplication or division. It should work most efficient and fast.

11 antwoorden↳

exp(ln(a)-ln(b))=a/b

↳

What if one or both of a,b is less than zero. ln(x) for x < 0 is not defined. Minder

↳

Obviously the interviewer would not allow us to use Math functions like exp, log etc. We are supposed to use the Long division method or the Newton Raphson method to find the quotient. Newton Raphson is the fastest but uses operator * (multiplication) though. Minder