Amazon ML Summer School 2025
Sample Test by Scaler
Section 1: MCQ Section
Question 1: Which of the following conditions must be met for the Central Limit Theorem (CLT) to apply?
A) The sample must be drawn from a normal distribution
B) The population must be symmetric
C) The population must have finite mean and variance
D) The sample size must be at least 30 for any population
Answer: C — CLT holds when population has finite mean and variance.
3
Question 2: Let f (x) = xex . What is the value of limx→∞ f (x)?
A) 1
B) ∞
C) Does not exist
D) 0
Answer: D — exponential in denominator grows faster than cubic numerator.
Question 3: Which of the following is true about dropout in neural networks?
A) Dropout amplifies gradients
B) Dropout reduces overfitting by deactivating neurons during training
C) Dropout increases model complexity
D) Dropout is applied only during inference
Answer: B — dropout helps regularize the model during training.
Question 4: Which test compares means with unequal variance?
A) Paired t-test
B) Welch’s t-test
C) Chi-square test
D) Z-test
Answer: B — Welch’s t-test handles unequal variances.
[ ]
1 2
Question 5: Let A = . Which of the following is the inverse of A?
3 4
[ ]
4 −2
A)
−3 1
[ ]
−2 1
B)
1.5 −0.5
[ ]
−2 1
C)
3 −1
[ ]
2 −1
D)
−1.5 0.5
[ ] [ ]
1 4 −2 −2 1
Answer: B — inverse of A is −2 = .
−3 1 1.5 −0.5
https://github.com/cu-sanjay
Question 6: A box contains 3 blue, 4 green, and 5 yellow balls. Three balls are drawn at random without
replacement. What is the probability that at least two balls are of the same color?
8 3 88 30
A) 11 B) 11 C) 220 D) 220
( )
Answer: A — total combinations: 123 = 220; favorable outcomes = 160 (at least 2 same color), so
probability = 160
220 = 8
11 .
Question 7: Which is not an assumption of Linear Regression?
A) Multicollinearity exists
B) Linearity
C) Normally distributed residuals
D) Homoscedasticity
Answer: A — multicollinearity violates regression assumptions; it is not required, rather avoided.
Question 8: If rank(A) = 2 and A is a 3 × 3 matrix, which of the following must be true?
A) det(A) = 0
B) Columns of A are linearly independent
C) Nullity of A is 0
D) A is invertible
Answer: A — rank less than 3 implies det(A) = 0 and A is not full-rank.
Question 9: Two datasets each have standard deviation = 5. If you combine them into a single dataset
of double the size, with equal means, what is the combined standard deviation?
A) 5
B) 2.5
C) 0
D) 10
Answer: A — if means are equal and sizes equal, variance remains same, so standard deviation is unchanged:
5.
Question 10: Which of the following causes Random Forest to overfit?
A) Fewer features
B) More trees
C) Bootstrapping
D) Deeper trees
Answer: D — deeper trees increase model complexity and risk of overfitting.
Question 11: In Fβ score, what happens when β → ∞?
A) Recall emphasized
B) F-score vanishes
C) Equal weight
D) Precision emphasized
Answer: A — as β → ∞, recall dominates the score.
Question 12: A bag contains 3 red and 2 blue balls. Two balls are drawn without replacement. What
is the probability that they are of different colors?
4 3 7 2
A) 5 B) 5 C) 10 D) 5
(5) 6
Answer: B — total pairs = 2 = 10, different color pairs = 6, so probability = 10 = 35 .
https://github.com/cu-sanjay
Question 13: In gradient descent, what happens if the learning rate is too high?
A) Training is guaranteed to succeed
B) Model underfits
C) Convergence is faster
D) The model may diverge
Answer: D — large learning rate can cause updates to overshoot, preventing convergence.
Question 14: Let A19 . Find the eigenvalues of A19 .
A) 219 , (−2)19
B) 1, -1
C) 2, -2
D) 219 , −219
Answer: D — eigenvalues of An are powers of eigenvalues of A.
Question 15: Two fair dice are rolled. What is the probability that the sum is divisible by 4?
A) 13 B) 18
5
C) 16 D) 14
9
Answer: D — favorable sums: 4, 8, 12 → 3+5+1 = 9 outcomes out of 36, so 36 = 14 .
Question 16: Which model is most sensitive to outliers?
A) Naive Bayes
B) Decision Tree
C) KNN
D) Logistic Regression
Answer: C — KNN bases prediction on nearby points, so outliers distort distance-based decisions.
Question 17: Let f (x) = x2 sin x. What is f ′′ (x)?
A) x2 cos x − 4x sin x + 2 cos x
B) 2 cos x − x2 sin x
C) 2 sin x + 4x cos x − x2 sin x
D) 2 sin x + x2 cos x
Answer: C — f ′ (x) = 2x sin x + x2 cos x, then f ′′ (x) = 2 sin x + 2x cos x + 2x cos x − x2 sin x = 2 sin x +
4x cos x − x2 sin x.
Question 18: A binary classifier shows the following results on a test set of 1000 samples:
True Positives (TP) = 200, False Positives (FP) = 50, False Negatives (FN) = 100, True Negatives (TN)
= 650
What is the F1-score?
A) 0.73
B) 0.80
C) 0.60
D) 0.67
Answer: A — F1 = 2·0.8·0.67
0.8+0.67 ≈ 0.73
Question 19: In XGBoost, what does the regularization term in the objective function help prevent?
A) Gradient vanishing
B) Early stopping
C) Overfitting
D) Underfitting
Answer: C — regularization penalizes complexity to reduce overfitting.
https://github.com/cu-sanjay
Question 20: Given: Var(X) = 1, Var(Y ) = 4, Var(2X − 3Y ) = 34. Find the correlation coefficient
ρXY .
A) 0
B) 0.5
C) 0.25
D) -0.5
Answer: C — Use identity:√Var(aX + bY ) = a2 Var(X) + b2 Var(Y ) + 2ab Cov(X, Y ).
So, 34 = 4 + 36 + 2(2)(−3)ρ 1 · 4 ⇒ ρ = 0.25
Section 2: DSA Type Coding Section
TEST INSTRUCTIONS
• GENERAL
◦ This is a timed test. Please keep track of the time remaining at the top of the page.
◦ If you feel the question is unclear, try out different inputs and check the expected output for each of
them.
• CODE IMPLEMENTATION
◦ You only need to implement the given function.
◦ Do not read input; instead use the arguments to the function.
◦ Do not print the output; instead return values as specified.
◦ Still have a question? Check out Sample Codes for more details.
• PLAGIARISM
◦ Your code submission will be checked for plagiarism after you’re finished.
◦ If the code is found to be similar to another, it will be reported as appropriate.
◦ To prevent plagiarism, we discourage switching tabs or windows during the test. Any such activity will
be recorded and will be available for the company contact to see.
Q1. Streetlight Motion Detection Duration
Problem Description
In a city, a streetlight turns on automatically and stays on for exactly B seconds each time it detects
motion. If it detects motion again before turning off, the timer resets, and it stays on for another B seconds
from the new detection time.
https://github.com/cu-sanjay
You have a list A where each element A[i] indicates the time when the streetlight detects motion, and an
integer B. Calculate the total time the streetlight remains on.
Problem Constraints
1 ≤ A.length ≤ 105 0 ≤ A[i], B ≤ 109 A is sorted in non-decreasing order.
Input Format
First Argument is an Integer Array, A denoting the time when the streetlight detects motion.
Second Argument is an Integer, B denoting the duration in seconds.
Output Format
Return an Integer, denoting the total time the streetlight remains on.
Example Input
Input 1: A = [1, 4], B = 2
Input 2: A = [1, 2], B = 2
Example Output
Output 1: 4
Output 2: 3
Example Explanation
Explanation 1: At second 1, the streetlight detects motion and turns on for seconds 1 and 2. At second
4, the streetlight detects motion again and turns on for seconds 4 and 5. The streetlight is on for seconds 1,
2, 4, and 5, which is 4 seconds in total.
Explanation 2: At second 1, the streetlight detects motion and turns on for seconds 1 and 2. At second
2, the streetlight detects motion again and resets the timer. It stays on for seconds 2 and 3. The streetlight
is on for seconds 1, 2, and 3, which is 3 seconds in total.
Solution:
1 int Solution :: findTotalTime (vector <int > &A, int B) {
2 long long totalTime = 0;
3 long long lastOnTime = -1;
4
5 for (int time : A) {
6 if (time > lastOnTime ) {
7 totalTime += B;
8 } else {
9 totalTime += time + B - lastOnTime ;
10 }
11 lastOnTime = time + B;
12 }
13
14 return totalTime ;
15 }
https://github.com/cu-sanjay
Q2. Recover Binary Search Tree
Problem Description
Two elements of a Binary Search Tree (BST), represented by root A, are swapped by mistake. Tell us
the 2 values, when swapped, will restore the Binary Search Tree (BST).
A solution using O(n) space is pretty straightforward. Could you devise a constant space solution?
Note: The 2 values must be returned in ascending order.
Problem Constraints
1 ≤ size of tree ≤ 100000
Input Format
First and only argument is the head of the tree, A.
Output Format
Return the 2 elements which need to be swapped.
Example Input
Input 1: A binary search tree where the root is 1, its left child is 2, and its right child is 3.
Input 2: A binary search tree where the root is 2, its left child is 3, and its right child is 1.
Example Output
Output 1: [2, 1]
Output 2: [3, 1]
Example Explanation
Explanation 1: Swapping 1 and 2 will change the BST to be a valid BST where the root is 2, its left child
is 1, and its right child is 3.
Explanation 2: Swapping 1 and 3 will change the BST to be a valid BST where the root is 2, its left child
is 1, and its right child is 3.
https://github.com/cu-sanjay
Solution:
1 vector <int > Solution :: recoverTree ( TreeNode * A) {
2 TreeNode *curr = A, *prev = nullptr ;
3 TreeNode *first = nullptr , * second = nullptr ;
4
5 while (curr) {
6 if (! curr ->left) {
7 if (prev && prev ->val > curr ->val) {
8 if (! first) first = prev;
9 second = curr;
10 }
11 prev = curr;
12 curr = curr -> right ;
13 } else {
14 TreeNode *temp = curr ->left;
15 while (temp -> right && temp -> right != curr) {
16 temp = temp -> right;
17 }
18 if (! temp -> right) {
19 temp -> right = curr;
20 curr = curr ->left;
21 } else {
22 temp -> right = nullptr ;
23 if (prev && prev ->val > curr ->val) {
24 if (! first ) first = prev;
25 second = curr;
26 }
27 prev = curr;
28 curr = curr -> right;
29 }
30 }
31 }
32
33 vector <int > result = {first ->val , second ->val };
34 sort( result .begin (), result .end ());
35 return result ;
36 }
Important Note
These questions are provided by Scaler for practice for the ML School 2025 Selection Test.
You will receive a sample test invitation link after applying and submitting the required form.
For more content and guidance, visit my GitHub: https://github.com/cu-sanjay
If you find it helpful, please star the repository and follow the account.
All rights are reserved by Amazon and Scaler (InterviewBit).
Thank you. I wish you the best for the ML Summer School exam and program.
https://github.com/cu-sanjay