• 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

4. You have 5 quarters on the table in front of you: four fair (regular two-sided coins) and one double-sided (both sides are heads). You pick one of them up at random, flip it five times, and get heads each time. Given this information, what is the probability that you picked up the double-sided quarter?

There are 5 coins--4 regular and 1 unfair. Assuming an equal probability of picking up a random coin, the probability of picking up a fair quarter is .8, and the double-sided .2

Assuming you pick up the double sided, you will flip 5 heads guaranteed. Assuming you pick up a regular one, you have a (.5)^5=1/32 probability of flipping 5 heads in a row. 1/32 (P(5 heads))*8/10 (P(fair coin))=1/40.

So you set up a Bayes table...

.........1-4 heads...................................5 heads
Fair... 248/320=(31/32*8/10).............1/40 =(1/32*8/10)
Unfair 0 =(0*2/10)............................ .2/10 =(1*2/10)

And since we know we rolled 5 heads, we isolate the 5 heads column...

Then it's just a straightforward calculation...

.2/(.2+.025)= .89

I just hope that I don't look like a fool for using basic bayes table stuff without all of the crazy notation...this is the reason I got a C+ in theory of probability...I say solve the problem, and don't go nutso on the notation...which is why I have so much trouble following it all the time >_<

Edit: This may also be why I have so much trouble programming...as my algorithms professor said, being able to do a problem on hand is trivial.
 
The Hands Have An Angle On The Face

Letting t represent the time in hours since the most recent 12 midnight, express A(t) as the minimal positive angle in radians between the hour-hand and minute-hand of a regular analog clock. In particular, find A(.25), A(1.08), A(6), A(33), A(100), A(-.25), A(-100).
 
Prob 1.

Two points are randomly selected on the sides of a unit square. Find the probability that the distance between them is less than unity.

.

The following is an incorrect attempt.

There are in all 10 possibilities to arrange these two points on the sides of the square-
A- 4 ways to select them on the same side
B- 2 ways to select them on opposite sides
C- 4 ways to select them on adjacent sides

(Assuming that the two points are the same,i.e. putting point 1 on side 1 and point 2 on side 3 is the same as putting point 2 on side 1 and point 1 on side 3. )

Now analyzing each of these categories,

A- In the 4 ways out of 10 to select the points on the same side, their distance will surely be less than unity. Hence p(A) = 4/10 * 1 =0.4

B- There are 2 ways to select them on opposite sides. Their distance will never be less than unity in this case. Hence p(B)=2/10 * 0 = 0

C- Now the interesting part- if the two points are on adjacent sides. We can use pythogaras theorem here. The pythogaras triplet of .8, 0.6 and 1 comes into the picture. The points along with the adjacent vertex will form a right angled triangle. This right angled triangle will have a hypotenuse of exactly 1 when
point1 is 0.6 distance from the vertex
point2 is 0.8 distance from the vertex (or vice versa)

Hence for the hypotenuse i.e the distance b/w the points to be less than 1, we have to select

point1 within a segment of length 0.6(from the vertex) -the probability of doing which is 0.6
point2 within a segment of length 0.8(from the vertex) -the probability of doing which is 0.8



Hence the chance of selecting the two points such that the hypotenuse i.e the distance b/w the points is less than 1 is = 0.6*0.8-0.48

Hence p(C)= 4/10 * 0.48 = 0.192

The answer is = p(A) + p(B) + p(C) = 0.4 + 0 + 0.192 = 0.592

However as you may have noticed there is also the possibility that in case C, point1 is at a distance of 0.9 from the vertex and point2 is at a distance of 0.4- their distance will still be less than 1. I am not sure how to account for this.

Any suggestions?
 
We could account for case C given below in the following way :-

In case C when two points are on the adjacent sides, the minimum distance b/w them can be 0 and the max distance can be sqrt(2)=1.4142.

So the chances of selecting a random distance within the range (0,1.4142) such that it is less than one is 1/1.4142 = 0.7071

Hence the calculation for case C will become p(C)=4/10 * 0.7071 = 0.2828

The answer would then be=p(A) + p(B) + p(C) = 0.4 + 0 + 0.2828 = 0.6828

Correct me if I am wrong.
 
Solution to DUO ON A SQUARE - Prob 1

Prob 1.

Two points are randomly selected on the sides of a unit square. Find the probability that the distance between them is less than unity.

Consider a unit square in the first quadrant of xy-coordinate plane, two of whose sides coincide with the x and y axes. So, the square vertices are A(0,0), B(1,0), C(1,1), D(0,1).

Of the two points randomly selected on the sides of this square - which may be selected one after another - the first point can be on any one of the four sides with equal probability due to symmetry. So, taking advantage of symmetry, we can just as well consider only one side.

So, assume the first point F(x,0) falls on the side AB on the x-axis. The second point S(u,v) will have a distance of less than unity from F(x,0) if {u=0 &
0<=v<=rad[1-x^2]} or {0<=u<=1 & v=0} or {u=1 & 0<=v<=rad[1-(1-x)^2]}.

Now, consider the portion of the square perimeter starting with point L(0,rad[1-x^2]), and going counterclockwise, to vertex A, then vertex B, and up to the point R(1,rad[1-(1-x)^2]). If the second point S falls within this stretch of the square just described - i.e., LABR - then the length SF will be less than unity. The length of the portion of the square just described - with nodes LABR - is rad[1-x^2]+1+rad[1-(1-x)^2].

So, since the perimeter of the unit square is 4, then taking the length of LABR and dividing it by 4 will give us the probability of point S being less than 1 away from point F(x,0).

But the probability of the first point F falling at point (x,0) on the side AB is dx, as x runs from 0 to 1.

So, Here's the answer:

Probability=Integral(from 0 to 1) of {
rad[1-x^2]+1+rad[1-(1-x)^2]} dx/4=(2+pi)/8.

Cheers!
 
Wow...that's just ridiculous.

This is why I abhor geometric probability. By far the hardest kind in my experience.
 
Hey guys,

so, if I have x% chance to die in an auto accident from NYC to Philly (say distance d1) what is the chance that I die in an auto accident from NYC to, say, Oregon (say distance d2)?

rio



Answer: 1-(1-x%)^(d2/d1)



Ask me how I did it, and I will explain.
 
Di vi si bi li ty Tests!

Does there exist a divisibility test for every prime number?

In this forum, a while back there was a question on divisibility tests.

The divisibility test for number 11 is rather very simple.

Let sigma{(10^k)*a(k) [as k runs from 0 to (n-1)]} denote an n-digit number Q in base 10, where for each k: a(k) is one of the numbers 0,1,2, . . .,9.

Now 11 divides Q if and only if 11 divides sigma{((-1)^k)*a(k) [as k runs from 0 to (n-1)]}.

Basically, we partition the digits of Q into two groups such that in each group digits have the same position parity. Then compute the difference of the sums from each group. If 11 divides this difference, then Q is divisible by 11, otherwise it isn't. Can you prove this result?

Now, what is the (or a) divisibility test for 7, or for 13, for any prime p?

It turns out that every prime number has one or more divisibility tests. Can you prove it?

Note that a divisibility test is an extremely simple algorithm that is applicable to any integer, no matter how big.


 
There are five bags containing the same number of coins. Four of the bags contain gold coins while the last bag contains silver coins coated with gold, and you are told that each gold coin weighs 10 oz. and each silver coin weighs 2 oz. less. You have a weighting scale (minimum=8 oz., maximum=large enough so you can weigh all five bags of coins) and you can take coins out of the bags. What's the minimum number of weighings you need to do in order to tell which bag has the silver coins?


well the simple answer is at most it takes 5 weighings...but that is definitely wrong.

you can weigh sets of bags.

weighing 1: 3 bags.
weighing 2: 2 bags.

from there, you can tell which set of bags has the silver coins.

if it is set #2, it only takes 3 weighings,

if it is set #1, it takes 4 weighings...but both less than 5 weighings.

so minimum it takes via this methodology is 3 weighings.

Barron

The correct answer is you only need 1 weighing.

You can take one coin from bag1, two from bag2, three from bag3 and so on, and weigh them.

If the final weight is 148oz (instead of 150 oz which would be the case if all bags have gold coins) then we know that bag1 has silver coins.

If final weight is 146 oz we know that bag2 is the rogue silver bag .....and so on.
 
Q. There are two rooms. one room contains four lightbulbs: the other, four switches to turn on the lights. You can only be in one room at a time, and you can only enter either room twice. How do you find out which switch is related to which lightbulb?

A. Turn on one switch, leave on for 30 minutes. Turn another switch on for 15. Next turn on a switch for one minute. Turn them all off. Enter lightbulb room.

The lightbulb that is cold is the switch you never turned on. the hottest bulb, or rather the bulb that takes the longest to cool down is the first switch. Seond hottest was the switch that was on for 15 mins. and the third was the switch that was on for 1 minute (cools down the fastest)
 
Have an Integral Break!

Integrate (f(x)) from (\\\pi/2) to infinity where


(f(x)=\frac{sin x + cos x}{e^x + cos x})
 
The Ways Of Coins On A Checkerboard

In how many ways can the following be done?

To place k identical coins on an nxn checkerboard -- consisting of n^2 identical unit squares -- subject to the following conditions:

1. Every coin must be placed within a unit square.

2. Each unit square can accept at most one coin.

3. The number of coins in each row must be at least one.

4. The number of coins in each column must be at least one.

Answer the question for (a) k=9, n=4; (b) k=11, n=4; (c) k=9, n=5.

Can you come up with a general solution in terms of k and n (with k>=n)?
 
"Prob 1.

Two points are randomly selected on the sides of a unit square. Find the probability that the distance between them is less than unity."


I think this way. You have 4 out 10 chances of being both points on the same side with probability 1 and 4 out 10 times of being inadjacent times with probability Pl=Integral[SQRT(1-(1-x)^2] between 0 and 1, which is Pi/4, being x the distance from one corner of the square to certaing point on a side. Therefore you have.

P=2/5(1+PI/4)=71%.



 
Why it is 4 out of 10 that both points on the same side? i think it is 1 out of 4.
"Prob 1.

Two points are randomly selected on the sides of a unit square. Find the probability that the distance between them is less than unity."


I think this way. You have 4 out 10 chances of being both points on the same side with probability 1 and 4 out 10 times of being inadjacent times with probability Pl=Integral[SQRT(1-(1-x)^2] between 0 and 1, which is Pi/4, being x the distance from one corner of the square to certaing point on a side. Therefore you have.

P=2/5(1+PI/4)=71%.



 
Because the square has 4 sides therefore both points can be on side 1 or side 2.... or side 4 ( these are possible cases) and total number of cases are 10( one point on side 1 and the other on side 2 etc.......) so probability of both points on the same side is 4 out of 10 or 2/5. These are total number of cases.( the numbers represent sides of the square, 13 means one point on side 1 , the other on side 3)
11,12,13,14
22,23,24
33,34
44
 
Hi olepep,

Your counting method is incorrect as it blurs the distinction between the points. It is more accurate to allow for permutation of the points by considering the points as distinct. Here's what I mean: let P denote the first point and Q the second. Let P-1 denote the placement of point P on side 1, and Q-3 denote the placement of point Q on side 3, for example. Once you begin to take a COMPREHENSIVE approach to your counting method, you will leave no case missed out and you'll never over-count. So, we will consider the following two placements as different: (P-1 & Q-3) and (P-3 & Q-1).

You will see at once that the probability that the two points will be on the same side is 1/4, exactly what we've always known, and exactly what rocket said.

Also:

I've solved this problem already. See my post of 06-14-2008. The answer is (2+pi)/8.
 
This Flea Hops and Hops!

Consider a square ABCD along with its two diagonals intersecting in point E. A flea hops from any one of the points A, B, C, D, E to an adjacent point. For example, from point A, The flea hops to D or B or E, but not to C. Assume that the flea is originally positioned at point E. The probability of the flea hopping on the n-th hop from any of the points A, B, C, D to point E is (n-1)/n. For example, if the flea, originally positioned at E, has hopped from E to A to B to A to D, then the probability that it will now hop to point E is 4/5, and that it will hop to another adjacent point is 1/5.

Starting from point E, compute the expected number of hops the flea makes before it returns to point E.
 
Okay, here is the answer:
We know that the flea makes one jump to leave point E. Then, we start a series. The expected value of making it back to E on its second jump is 2*1/2. The expected value of it making it back to E on its third jump is 3*1/2*2/3. The expected value of 4 jumps is 4*1/2*1/3*3/4. The expected value of 5 jumps is 5*1/2*1/3*1/4*4/5. In other words, the expected value of the flea making it back to E on any jump is n*1/2*1/3*...*1/(n-1)*(n-1)/n, or 1/(n-2)!

So the expected number of jumps it takes the flea to reach point E is sum from (i=2 to INF) of 1/(i-2)!

That series, after plugging out a few terms on my calculator, since it QUICKLY turns into a very small number per term, comes out to e.

So the answer is the expected number of jumps is e.

Am I right?
 
Regarding the square unit problem , yes, is 1/4 , and yes, I get the same answer by changing that. 1/4+1/2(PI/4)= 1/8(2+Pi). I made that stupid mistake.

Regarding the flea, I agree with the reasoning but din't do the calculation.
 
Back
Top