Even though it was 3 hour test officially, everything was solved in 1 hour. Easy Coding Questions.
Content Outline
Special thanks to AlgoUniversity for mentorship, especially Manas Sir, Swapnil Sir and Nikita Mam.
Use this section to attempt solving problems by yourself. In next section is answer key for all these MCQs, followed by last section describing thought process to reach every answer and mentions few hacks.
These answers are 100% correct. Still, @Manas sir please cross verify Q8, Q10, Q11. Also, if anyone has better solutions than mine, please feel free to add them as Answers.
Tip/Hack
More than 50% questions were googl-able or computable. Here are links to useful computation resources
Pre-Requisite Topic(s) : Expectations, Linearity of Expectation (optional)
Solution
Let A be expected score of first dice.
Let B be expected score of second dice.
Both A and B are independent events.
Expectation(A) = Expectation(B) = 3.5 { Reason - Dice can have value between [1,6], so expectation is simply average of 1 and 6 }
Expectation(A.B) = Expectation(A) x Expectation(B) = 3.52 = 49/4.
Pre-Requisite Topic(s) : Permutation & Combination
Solution
Answer is obviously, Probability = (Favourable ways of choosing 13 cards as per Question) / (Total ways of choosing 13 cards)
Probability = (52 - 4x4)C13 / 52C13. Why (52 - 4x4)? Because we can't choose any of aces, kings, queen or jack and each of these can come in 4 suits.
I computed this value quickly using WolframAlpha which gave answer 0.0036
There might possibly be a better way to compute, but computing factorials and reducing it to fraction is cakewalk with WolframAlpha.
Pre-Requisite Topic(s) : Logic, Pigeon Hole Principle (optional / overkill)
Solution
In worst case, you can pick first three socks of all different color. The 4th socks will then surely complete a pair of socks with same color!
Pre-Requisite Topic(s) : Calculus, Asymptote
Solution
This is an excellent question where Wolfram Alpha actually literally solved the probelm!!
Here I used WolframAlpha to generate graphs of each option and then figured out correct option!
Option 1 | |
Option 2 | |
Option 3 | |
Option 4 |
Now we observe what is asked in the question. We want to put x = +infinity, and it should be linear. From graph we see, it is the case only in option 2, bingo!
Pre-Requisite Topic(s) : Matrices, Matrix Exponentiation(optional)
Solution
In practice I saved time and scope of manual error using Matrix Calculator I shared in link above.
Actual fastest solution to compute will be using same idea that we use in computing AB in O(log N). Repeated squaring this time applied to matrix this time! so we can compute final matrix in just 3 matrix multiplication instead of naive 5.
Also note, we have to do only 2 multiplication completely, for 3rd we can just compute any single value and that should be sufficient! Reason? All options have different elements, so with one computation we can figure out correct answer!
Pre-Requisite Topic(s) : Probability, Bernoulli Theorem
Solution
My solution isn't perfectly correct even though answer should be correct. Please write in answer you correct solution (probably using bernoulli theorem)
Let X be total number of times coin is flipped till we get 4 Heads. Clearly, Xth coin toss result in 4th Head.
Probability of Heads = 1/3. So in terms of expectation, out of X flips, exactly 1/3rd flips should be heads.
=> X * (1/3) = 4
=> X = 12.
That means, 12-4 = 8 is number of expected tails.
Pre-Requisite Topic(s) : Probability
Solution
Infinite tiles, can cause confusion about how to approach the problem. But the key insight that solves that problem is this simple observation - Whereever you throw the circular disk, its center is going to lie inside some particular square.
So we reduced the problem to this simpler version - Given a square of unit size, a disc of 1/10 unit radius is thrown such that its center lies within the square. Find probability that any portion of circle doesn't go outside square!
Now this reduced problem is very easy to solve. Center should lie within a smaller square of size (1- 1/10 - 1/10) units = (4/5) units.
=> Probability = (4/5)2 / (1)2 = 0.64.
Pre-Requisite Topic(s) : Expectations, Linearity of Expectation (optional)
Solution
Let A be expected score of first dice.
Let B be expected score of second dice.
Both A and B are independent events.
Expectation(A) = Expectation(B) = 3.5 { Reason - Dice can have value between [1,6], so expectation is simply average of 1 and 6 }
Expectation(A.B) = Expectation(A) x Expectation(B) = 3.52 = 49/4.
Pre-Requisite Topic(s) : Matrices
Solution
This solution needs verification.
I took, N = 3 and put values (x, y) = (10,20) and computed value of 3x3 matrix's determinant by using Matrix calculator and none of the first three options matched.
Pre-Requisite Topic(s) : Matrices
Solution
This solution needs verification.
I took, N = 3 and put values (x, y) = (10,20) and computed value of 3x3 matrix's determinant by using Matrix calculator and none of the first three options matched.
Pre-Requisite Topic(s) : Geometry, Calculas (Optional), Probability
Solution