Placement Papers — Amazon Questions
TCS, Infosys, Wipro, Cognizant actual papers
Showing 1–5 of 5 questions
in Amazon Questions
A system processes 1000 requests per second. If 8% of requests fail and need retry, and each retry takes 2 seconds, approximately how many total seconds are needed to process 10,000 requests including retries (assuming sequential processing)?
Correct Answer:
B. 11.6 seconds
EXPLANATION
10,000 requests at 1000/sec = 10 seconds. Failed requests = 10,000 × 0.08 = 800. Retry time = 800 × 2/1000 = 1.6 seconds. Total ≈ 10 + 1.6 = 11.6 seconds.
If a HashMap has 1000 entries and the load factor is 0.75, at what capacity will it resize?
Correct Answer:
C. 1333
EXPLANATION
Resize occurs when entries exceed capacity × load factor. If 1000 entries at 0.75 load factor, capacity = 1000/0.75 = 1333
Which of the following is a characteristic of a good hash function?
Correct Answer:
D. All of the above
EXPLANATION
Good hash functions are deterministic (same input gives same output), uniformly distribute values, and minimize collisions.
What will be the output of the following code?
int x = 5;
int y = ++x + x++;
System.out.println(y);
int x = 5;
int y = ++x + x++;
System.out.println(y);
Correct Answer:
B. 12
EXPLANATION
++x makes x=6 (pre-increment). Then x++ uses 6 and increments to 7. So y = 6 + 6 = 12.
Statement: All managers are leaders. Some employees are managers. Conclusion: All employees are leaders.
Correct Answer:
C. Cannot be determined
EXPLANATION
Some employees are managers, but not all. So we cannot conclude that all employees are leaders.