• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

Quantitative Interview questions and answers

Some answers.....

Here are my answers to some of the following questions:

1. The sum of all the digits must a multiple of 9.

4. Let En denotes the event that after n steps one returns back to the starting point for the first time. And I find P(En)=1/2 for all the n.

Proceeding in thi way: first, the number of steps one take to return to the starting point must be even, say 2, 4, 6........ We start from P(E2)=1/2. Then E4 means after the first 2 steps one must be in the diagonal point (for example, if you start from A, then this means after the first 2 steps you much arrive at C, otherwise you get back to A in 2 steps). Then from C to get back to A in 2 steps, the probability is 1/2. Thus P(E4)=1/2. You can also reason like this, you have two different paths to reach C from A in 2 steps, and for each of this path, you have two paths for another 2 steps, one of each leading you back to A, and one leading you to C. So there are 4 paths in all for 4 steps, and 2 of which gets back to A, two of which gets to C (you cannot arrive at B and D in an even number of steps). You can proceed similarily for other n. So the expectation does not converge.

5. If p is a prime number larger than 3, then P^2-1 should be a multiple of 24.

First p must be odd, so let p=2n-1 or 2n+1, then p^2-1=(p-1)(p+1)=(2n-2)2n or 2n(2n+2), so 4(n-1)n or 4n(n+1), the product of two consecutive numbers is even, so this means p^2-1 must a multiple of 8.
Secondly, p must not a muliple of 3, so p=3n+1 or 3n+2, then p^2-1= 3n(3n+2) or (3n+1)(3n+3), in either case, p^2-1 is a multiple of 3. So it is a multiple of 24.

6. f(n)=f(n-1)+f(n-2), where n is the total number of steps, f(n) is the number of possible ways, and the boundary condition is f(1)=1, f(2)=2.

We can focus on the last jump, it can either be 1 step or 2 steps. If it is a 1 step jump , then the number of ways is determined by the number of ways for the first n-1 steps, that is f(n-1). Similarily, if it is a 2 step jump, then the number of ways is determined by the first n-2 steps, that is f(n-2). No other choice for the last step jump, so the totol number is just the sum, that is, f(n)=f(n-1)+f(n-2).

7. Simple statistics, var(Z)=a^2Var(X)+b^2Var(Y)+2abVar(X)Var(Y)Rho, wher Rho is the correlation coefficient of X and Y.





Here a few more fun and worth doing problems.

Question: Given arbitrary integer, come up with a rule to judge if it is divisible by 9. Prove it.

Question: Roll a penny around another fixed penny in the center with edges in close contact. After moving half circle around the center penny, you will find the penny in motion has rotated 360 deg. Why?

Question: very heavy wall moving at 60mph, a ball moving same direction at 120 mph. What is direction and speed of ball after ball hit wall.

Question: A square with four corners A,B,C,D. Suppose you start from corner A and have equal chance to go to neighboring corners B and D; After reaching new corner, you again have equal chance to go to its two neighboring corners. The time consumed to travel on each edge is 1, what is the mean time to come back to A.

Question: What is the properties of \(p^2-1\) where p is prime number larger than 3

Question: A stair of 100 steps. You can either climb either one step or two steps but no more each time and you can walk up entire stair any way you like with rule above obeyed. How many possible combinations of ways to finish the walk?

Question: Given variances and covariance of X and Y. Z=a*X+b*Y. Calc variance of Z.
 
P(11)>P(12)

On first sight, I guess P(11)=P(10) and has the maximum probability, so P(11)>P(12). I make this guess based on my knowledge about the distribution of the sum of two fair dice, which is easy to calculate. It has a symmetrical distribution with respect to P(7), which is the highest, 6/36, for i<=6, P(i)=(i-1)/36, for i>=8, P(i)=P(14-i). So I guess that for the distribution of the sum of 3 dice, which can take value from 2 to 18 (16 results), it still has symmetrical distributions with respect to the central value, the only difference is that now we have an even number of values, so the maximum should be occur for the two central value, that is 10 and 11.

Then I take serious calculations for all the probabilities which confirms my guess. I calculate it by using the distribution of the sum of 2 dice and conditioning on the value of the first dice. Proceed in this way: starting from P(3)=1/216, then for P(4), first determine what value the first dice can take, in this case ,should be 1 or 2. If taking 1, the probability is 1/6, then the sum of the left two dice must be 3, which has probability 2/36; if taking 2, the probability is 1/6, then the sum of the left two dice must be 2, for which the probability is 1/36. So sum this up, P(4)=1/6*2/36+1/6*1/36=3/216. For P(5), the first dice can take 1, 2, and 3. If taking 1, the probability is 1/6 (taking 1)*3/36(the other two taking 4)+1/6(taking 2)*2/36(the other two taking 3)+1/6(taking 3)*1/36(the other two taking 2)=6/216. We can proceed in this to calculate all the probabilities, particularly, P(10)=P(11)=27/216, and P(12)=P(9)=25/216.
A six-sided die is rolled three times independently. Which is more likely: a sum of 11 or a sum of 12? (5 minutes limit)\\:D/
 
P(xy<0.5)=0.8466.

We can solve this easily using geometrical method. x,y are i.i.d uniform distributed in (0,1), so the sample space can be represented as a unit square. The curve xy=0.5 is easily determined which passes (1, 0.5) and (0.5,1). So P(xy<0.5) is the area of the region of the unit square under the curve xy=1. This can be calculated by a double integral with respect to this region. Or we can first calculate the area of the region of the unit suqare which is above xy=0.5, which is the double integral: integral(0.5,1)dy integral(1/2y,1) dx, which is 0.5*(1+ln0.5)=0.1534, so P(xy<0.5)=1-0.1534=0.8466.



Well I will contribute a question :--


Suppose you have a random number generator that generates random numbers between (0,1) with a uniform distribution.... 2 consecutive generations are independant of each other...

You generate 2 random numbers x, y from this random number generator.... What is the probability that xy < 0.5
 
1. The same. Because how much milk is moved to the water bottle is always equal to the amount of water moved to the milk bottle, according to the conservation of the volume.

2. I can only rewrite is as a double integral, but cannot integrate it analytically. Any hints??

3. This problem can best be solved backward. If only the 4th and 5th thieves are left, then whatever the 4th thieve proposes, the 5th will disallow it and kill the 4th. So for the 4th, he will try to avoid that he and the 5th are left. So this means whatever 3rd thieve proposes, 4th will definitely agree. So to maximize the payoff, 3rd will propose to have all the 100 gold coins, giving 4th and 5th zero. So for the 2nd thieve, the 3rd will always disagree, so to survive, the 2nd thieve must gain agreement from 4th and 5th. What he should do is just to keep 98 coins and give 4th and 5th 1 coin each, which is higher than the payoff that 4th and 5th can gain if 2nd is killed and 3rd is propsing, in which case they can only get 0 from above argument. Following the same way, for the 1st thieve, the 2nd will definitely disagree, so he has to gain support from two of 3rd, 4th and 5th while at the same time keeping as many coins for himself as possible. He can give 3rd 1 coin, give 2 coins to 4th or 5th, and keep 97 for himself. And this is the optimal strategy to maximize the payoff.

5. 1/2. By replication or hedge strategy.

7. Buffon's needle problem.

8. Price is: C(0)=N(d1)exp(-rT1)-Kexp(-rT2)N(d2), where d1=(-lnK+(r+sigma^2/2)(T2-T1))/(sigma*sqrt(T2-T1)). Using the BS call option pricing formula.

Anybody gives some hints to the question 6 ??? (The last two expectation)



1. (BOfA, ML) There are a cup of milk and a cup of water. Take one teaspoon of milk,
put into the water cup; mix well. Take one teaspoon of the mixture in the water cup and put into the milk cup then mix well.
Which is higher: the percentage of water in the milk cup or the percentage of milk in the water cup ?

2. (Barclays, ML) (W_t) is brownian motion. N is cdf of normal (N(0,1)). Calculate (E(N(W_t))).

3. (GS) There are 5 thieves numbered 1,..,5 trying to divide 100 gold coins using this algorithm: the number 1 will come up with a way to divide money, if there is more than 50% agreement among them about his method (including the dividing thief) then it's done. If not, then they will kill the first thief and the second thief will divide money coming up with his own method. If you are the first one, what method you will use to divide money ?

4. (SG) There is a cubic cheese 3x3x3. There is a rat eating this cheese in the following manner: it east a corner (1x1x1) of the cubic the first day. The next day, it will eat another 1x1x1 cell which has the same outer face as the one it eats the day before. Find an algorithm so that the rate can eat the center cell the last day.

5. (ML, LB, SG, Bear, DB) The today price of a certain stock is 20$. Here is an option: if the stock reaches 40$ then the payoff is 1$. Price this option.

6. (SG) (t < T). W is brownian motion. Calculate (E(W_T|W_t), E(W_t|W_T), E(W_t| |W_T| )) ((W_t) conditioning to the absolute value of (W_T))

7. (JPM) There are parallel lines with distance d lying on the same 2-D plane. There is a line segment with length l>d. Find probability that this line segment not crossing any other lines.

8. (ML) (T_1 < T_2). Pricing forward-start option (E(\frac{S_{T_2}}{S_{T_1}}-K)^{+})
 
but on the other hand, let y=x^x^x^..., we should have y=y^x. That is x=1. What's wrong here? I got confused..

No, the answer to this is \(x=\sqrt{2}\)

\(a=x^{x^{\ldots}}=2\)

\(ln(x^{x^{\ldots}}) = ln2\)

\(x^{x^{\ldots}}lnx = ln2\)

\(a lnx = ln2\)

\(2lnx = ln2\)

\(lnx = \frac{1}{2}ln2\)

\(lnx = ln\sqrt{2}\)

\(x = \sqrt{2}\)
 
Hello

I disagree with Nbzxroro in several things , the most important is:

"Question: A square with four corners A,B,C,D. Suppose you start from corner A and have equal chance to go to neighboring corners B and D; After reaching new corner, you again have equal chance to go to its two neighboring corners. The time consumed to travel on each edge is 1, what is the mean time to come back to A"

The result is 2.962962963. average time to get back to A.
Which is the sumatory of (4*n^2)/(4^n), and n from 1 to infinite and , yes it converges.

I also disagree with the Boxes filled out with milk and water. and with the Thieves problem as well( but in this one is basically the same as my answer, the difference is that there is no need to give money to 3rd).
 
Question: A stair of 100 steps. You can either climb either one step or two steps but no more each time and you can walk up entire stair any way you like with rule above obeyed. How many possible combinations of ways to finish the walk?

The result is Sumatory of 100!/((2i!)*(100-2i)!), where i=1,50.
6.33825E+29 ways to climb the stairs.
 
Questions asked in an interview at CSFB for a quant job.

Q1. Suppose you're on a train that has 1 to 100 carts. Given you are in fifth cart, what's the expected number of the carts?

Q2. Show that (\cosh(\lambda *B_t)*e^{(-\lambda^2*t/2)}) is martingale.

Q3. How many convergence modes are there?

Q4. How do you compute P(N>0.5) where N is N(0,1) by importance sampling?

Q5. What is the distribution of order statistic?

Q6. Solve the SDE of Ornstein-Uhlenbeck.

Q7. Supposed you have a fair coin, and you bet $1, if you toss a H, you get $1 and if you toss a T, you lost half your bet. What is the expected value of the money you have if you toss the coin infinitely?

Q8. Suppose you have a rod, and you are going to divide the rod into 3 pieces, what's the probability of the three pieces will form a triangle?
 
Aye!
We will start by defining a markov process and use stationary distributions:
Define
(X_{i}) to the be event that (Y_{n}) mod 13 == i.
0<= i <= 12
Now clearly P((X_{i})) -> P((X_{j})) =1/6 iff j<= i + 6 (mod 13)
And P((X_{i})) -> P((X_{j})) =0 iff j> i + 6 (mod 13)
In this fashion for a transition probability matrix, having dimension 13X13. Observe that the process has a row sum as well as the column sum one. Thus the matrix is doubly stochastic and since it has finite number of states the answer is 1/13(using properties of doubly stochastic processes with finite states. The system is recurrent and irreducible and therefore a stationary distribution exists.Figure the rest out.)
I knew this answer, I wanted an answer without possibly using markov chains and stuff.
and the answer seems quite obvious too. :)
 
Q7.

Lim (1/2^(N+1))Sum(N!/(i!*(N-i)!)*(3i+2-N), N->Inf and i=1,N

Q8.

1/4
 
The answer is 10.

Label the bottles 0,1,2,...999

Line the 10 people up in a row. They are going to act like digits of a binary number. Pour a bit of bottle X in the glass of each of the people for whom the binary representation of X sets their digit to 1. Repeat for all X.


In other words, pour wine from bottle 0 into nobody's glass. Pour wine from bottle 1 into the first person's glass only (counting from the right). Pour wine from bottle 746 into the glasses of the tenth, eighth, seventh, sixth, fourth and second people's glasses (because the binary rep. of 746 is 1011101010). Write down the binary number given by the people who die after drinking. This is the number of the poisoned bottle.

In other words, the guy at the left end has wine from bottles 512 to 999 in his glass. The guy immediately to his right has wine from bottles 256 to 511 and 768 to 999 in his glass, etc.
they will die of alcohol poisoning first
 
If I understand your idea correctly, the result should be the sum of (100-i)!/((i !)*(100-2i)!) for i=0,1,2...50, which is the number of jumps of 2 steps each.

Supporse you have i jumps of 2 steps each, then you must have (100-2i) jumps of 1 step each. So to calculate the number of possible arrangements is equilvalent to calculate the permutation of 100-i objects which can be divided into 2 groups, one is of i size and one is of (100-2i) size. So for each i, the permutation is (100-i)!/((i !)*(100-2i)!). You can check its validity for two special cases, i=0 (100 jumps of 1 step each) and i=50 (50 jumps of 2 steps each), either of which should has only 1 possible arrangement. On the contrary, your solution fails for both. Please have a check.

Now if you run the simulation to sum over all the possible value of i, I bet you should get the same result as the Febonacci sequence mentioned in my solution.



Question: A stair of 100 steps. You can either climb either one step or two steps but no more each time and you can walk up entire stair any way you like with rule above obeyed. How many possible combinations of ways to finish the walk?

The result is Sumatory of 100!/((2i!)*(100-2i)!), where i=1,50.
6.33825E+29 ways to climb the stairs.
 
1. For the square question, I reconsider a solution: E(n)=4. I think this should be the corret answer.

One can only go back to the starting point by an even number of steps, say n=2k, for k=1,2,....infinity. For n=2k steps, all the odd steps do not matter, because they will lead to either B or D (suppose one starts from A). Only the even steps matter. To be back to A for the first time at the nth step, it requires that at the 2,4,6....2k-2 steps, one does not go back to A, so the probability is (1/2)^(k-1), and at the 2k step one must go back to A, for which the probability is simply 1/2. So the total probability that for n=2k steps one goes back to A for the first time is 1/2^k. The expected number of steps E(n)=sum(2k*1/2^k) for k=1,2,...to infinity. This converges to 4.

For example, if one needs 4 steps to go back to A for the first time, what is the probability of this?Proceed this way: the 1st step does not matter, it will lead to B or D. Then for the 2nd step, no matter where you are now(B or D), the probability that you do not go back to A is 1/2 (suppose you are in B after the 1st step, then you can go A or C for the 2nd step). Now you are definitely in C after 2 steps if you do not go back to A. Then the 3rd step again does not matter, leading you to either B or D. Then in the 4th step, you have to go back to A and the probability is again 1/2. So the total probability is 1/4.

2. For the milk and water question as well as the thieves question, what is ur answer? I think my solution is the right answer.

Hello

I disagree with Nbzxroro in several things , the most important is:

"Question: A square with four corners A,B,C,D. Suppose you start from corner A and have equal chance to go to neighboring corners B and D; After reaching new corner, you again have equal chance to go to its two neighboring corners. The time consumed to travel on each edge is 1, what is the mean time to come back to A"

The result is 2.962962963. average time to get back to A.
Which is the sumatory of (4*n^2)/(4^n), and n from 1 to infinite and , yes it converges.

I also disagree with the Boxes filled out with milk and water. and with the Thieves problem as well( but in this one is basically the same as my answer, the difference is that there is no need to give money to 3rd).
 
Hello nbszroro

I am sorry, you didn't understand my solution and it's right. Review it .( I changed the i=0,50 instead i=1,50, I missed the 0, sorry). It does not fail for neither case (remember 0!=1).

Sumatory of 100!/((2i!)*(100-2i)!), where i=0,50.


Regards

Question: A stair of 100 steps. You can either climb either one step or two steps but no more each time and you can walk up entire stair any way you like with rule above obeyed. How many possible combinations of ways to finish the walk?

The result is Sumatory of 100!/((2i!)*(100-2i)!), where i=0,50.
 
Hello Andriy

I didn't look at any book and I think is much easier to understand what I did.

First the rule for a triangle is that one side has to be less than the addition of the others and greater than the difference, if you study that , you will find that , in order to form a triangle, the 3 segments have to be less than l/2.
Second. Imagine that the cut points are x1 and X2, this 2 variables are uniform distributions between 0 and L( they can fall randomly between 0 and L).
Third. Create a bidimensional representation where the X coordinate is X1 and the "Y" coordinate is X2, all the possible cases is the area of the square L^2, let's find the fvorable cases. If you do that you see ( imagine X1 is first cut and X2 is second cut X2>X1, later you multiple by 2 in case X2<X1).
Segment 1=X1<L/2
Segment 2=X2-X1<L/2
Segment 3=L-X2<L/2

By representing the area where the above conditions fall you will see a small triangle 1/8 of the area of the square. By interchanging the cut points ( if the X1 is the second cut and X2 is the first one) then you see anothet rinagle same size, therefore 2*1/8 =1/4 is the solution
 
Sorry, for the two cases i=0 and 50, your expression is true. But I am afraid that your answer is still incorrect. Just simply check i=1. You have only one jump of 2 steps, and 98 jumps of 1 step. How many different ways? Should be 99, right? Because you can only start jumping 2 steps a time at the 1,2,....and 99th step. My answer gives 99, but your answer gives 99*100/2. Please have a check.





Hello nbszroro

I am sorry, you didn't understand my solution and it's right. Review it .( I changed the i=0,50 instead i=1,50, I missed the 0, sorry). It does not fail for neither case (remember 0!=1).

Sumatory of 100!/((2i!)*(100-2i)!), where i=0,50.


Regards

Question: A stair of 100 steps. You can either climb either one step or two steps but no more each time and you can walk up entire stair any way you like with rule above obeyed. How many possible combinations of ways to finish the walk?

The result is Sumatory of 100!/((2i!)*(100-2i)!), where i=0,50.
 
Hi nbzxroro

Yes, you are right , I made a mistake on that one

Thanks for showing it
 
Back
Top