Showing 1–10 of 22 questions
in Capgemini Questions
A can complete a task in 12 days. B can complete the same task in 18 days. If both work together, in how many days will they complete the task?
A
7.2 days
B
6.8 days
C
7.5 days
D
8 days
Correct Answer:
A. 7.2 days
EXPLANATION
A's work rate = 1/12, B's work rate = 1/18. Combined rate = 1/12 + 1/18 = 3/36 + 2/36 = 5/36. Time = 36/5 = 7.2 days.
What will be the output of the following code snippet?
int x = 5;
int y = ++x + x++ + x;
System.out.println(y);
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.
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.
What is the time complexity of binary search algorithm?
A
O(n)
B
O(n²)
C
O(log n)
D
O(1)
Correct Answer:
C. O(log n)
EXPLANATION
Binary search has a time complexity of O(log n) because it divides the search space by half in each iteration. This works only on sorted arrays.
A vendor purchases apples at Rs. 50 per dozen and sells at Rs. 5 per apple. What is the profit percentage?
EXPLANATION
Cost per apple = 50/12 = Rs. 4.17. Selling price = Rs. 5. Profit = 5-4.17 = 0.83. Profit% = (0.83/4.17)×100 ≈ 20%.
What is the GCD of 24 and 36?
EXPLANATION
Factors of 24: 1,2,3,4,6,8,12,24. Factors of 36: 1,2,3,4,6,9,12,18,36. GCD = 12
Two numbers are in the ratio 3:4. If their sum is 70, what are the numbers?
A
30, 40
B
35, 35
C
20, 50
D
25, 45
Correct Answer:
A. 30, 40
EXPLANATION
Let numbers be 3x and 4x. 3x + 4x = 70. 7x = 70. x = 10. Numbers are 30 and 40
If 30% of a number is 45, what is the number?
EXPLANATION
Let number = x. 30% of x = 45. 0.30x = 45. x = 45/0.30 = 150
In CSS, what does the 'z-index' property control?
A
Font size
B
Text alignment
C
Stacking order of elements
D
Background color
Correct Answer:
C. Stacking order of elements
EXPLANATION
z-index controls the stacking order of overlapping elements on a webpage
What is the main difference between ArrayList and LinkedList in Java?
A
ArrayList is faster for random access
B
LinkedList is faster for random access
C
Both have same performance
D
ArrayList uses more memory
Correct Answer:
A. ArrayList is faster for random access
EXPLANATION
ArrayList provides O(1) random access, while LinkedList provides O(n) access