Placement Papers
TCS, Infosys, Wipro, Cognizant actual papers
654 Questions 12 Topics Take Test
Advertisement
Showing 61–70 of 654 questions
Q.61 Medium Capgemini Questions Capgemini
What will be the output of the following code snippet?
int x = 5;
int y = ++x + x++ + x;
System.out.println(y);
A 18
B 19
C 20
D 21
Correct Answer:  B. 19
EXPLANATION

++x makes x=6, then 6 is added. x++ uses 6 then increments to 7. Finally +x adds 7. So: 6 + 6 + 7 = 19.

Take Test
Q.62 Easy Capgemini Questions Capgemini
Four friends A, B, C, and D have different salaries. C earns more than A but less than D. B earns more than D. Who has the highest salary?
A A
B B
C C
D D
Correct Answer:  B. B
EXPLANATION

From given conditions: A < C < D and D < B. This means B > D > C > A. Therefore, B has the highest salary.

Take Test
Q.63 Easy Capgemini Questions Capgemini
If PAPER is coded as 16-1-16-5-18, then PENCIL would be coded as?
A 16-5-14-3-9-12
B 16-5-13-3-9-12
C 15-5-14-3-9-12
D 16-5-14-2-9-12
Correct Answer:  A. 16-5-14-3-9-12
EXPLANATION

Each letter is coded as its position in the alphabet: P=16, A=1, P=16, E=5, R=18. Similarly, PENCIL: P=16, E=5, N=14, C=3, I=9, L=12.

Take Test
Q.64 Easy Capgemini Questions Capgemini
In a sequence, each term is obtained by adding the previous two terms. If the 1st term is 2 and 2nd term is 3, what is the 6th term?
A 20
B 21
C 13
D 34
Correct Answer:  B. 21
EXPLANATION

Fibonacci-like sequence: T1=2, T2=3, T3=5, T4=8, T5=13, T6=21. Each term = sum of previous two terms.

Take Test
Q.65 Medium Capgemini Questions Capgemini
A train travels from City A to City B at 60 km/h and returns from B to A at 40 km/h. If the total journey time is 10 hours, what is the distance between City A and City B?
A 240 km
B 300 km
C 280 km
D 320 km
Correct Answer:  A. 240 km
EXPLANATION

Let distance = d km. Time A to B = d/60 hours, Time B to A = d/40 hours. Total time: d/60 + d/40 = 10. LCM(60,40)=120, so (2d + 3d)/120 = 10, giving 5d/120 = 10, thus d = 240 km.

Take Test
Advertisement
Q.66 Easy Amazon Questions Amazon
What does the SELECT * query do in SQL?
A Selects the first row
B Selects all columns from all rows
C Selects only the primary key
D Deletes all data
Correct Answer:  B. Selects all columns from all rows
EXPLANATION

SELECT * retrieves all columns and rows from a table. * is a wildcard meaning 'all columns'.

Take Test
Q.67 Easy Amazon Questions Amazon
Which protocol is used for secure data transmission over the internet?
A HTTP
B HTTPS
C FTP
D SMTP
Correct Answer:  B. HTTPS
EXPLANATION

HTTPS (HTTP Secure) encrypts data in transit using SSL/TLS. Other protocols lack this encryption.

Take Test
Q.68 Medium Amazon Questions Amazon
What is the time complexity of accessing an element in a balanced Binary Search Tree?
A O(1)
B O(log n)
C O(n)
D O(n²)
Correct Answer:  B. O(log n)
EXPLANATION

In a balanced BST, the height is log n, so searching takes O(log n) time.

Take Test
Q.69 Hard Amazon Questions Amazon
If a HashMap has 1000 entries and the load factor is 0.75, at what capacity will it resize?
A 750
B 1000
C 1333
D Cannot be determined
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

Take Test
Q.70 Easy Amazon Questions Amazon
What is the purpose of the 'try-catch' block in Java?
A To improve code performance
B To handle exceptions gracefully
C To declare variables
D To create loops
Correct Answer:  B. To handle exceptions gracefully
EXPLANATION

try-catch blocks allow you to handle exceptions without crashing the program, providing graceful error handling.

Take Test
IGET
iget AI
Online · Ask anything about exams
Hi! 👋 I'm your iget AI assistant.

Ask me anything about exam prep, MCQ solutions, study tips, or strategies! 🎯
UPSC strategy SSC CGL syllabus Improve aptitude NEET Biology tips