EXL interview prep
6 practice questions on the topics candidates reported from EXL interviews, with answers. The questions are ours; each one links to the interview report that names its topic.
DSA 1
-
For which of these problems does a greedy choice always give an optimal answer?
- 0/1 knapsack, always taking the most valuable item that still fits
- The most meetings that fit in one room without overlap, always taking the meeting that ends earliest
- Making 6 from coins of 1, 3 and 4 with the fewest coins, always taking the largest coin
- The longest simple path in a graph, always taking the heaviest edge
Show the answer
B. The most meetings that fit in one room without overlap, always taking the meeting that ends earliest
Earliest-finish-first is provably optimal for activity selection. Greedy fails the others: coins 4 + 1 + 1 uses 3 coins where 3 + 3 uses 2, and 0/1 knapsack needs dynamic programming.
This topic is named in a candidate’s interview report: On-campus interview, 2020, on GeeksforGeeks.
DBMS and SQL 2
-
Which of these SQL functions is an aggregate function rather than a scalar one?
- UPPER(name)
- LENGTH(name)
- AVG(salary)
- ROUND(price, 2)
Show the answer
C. AVG(salary)
An aggregate function such as AVG, SUM, COUNT, MIN or MAX turns many rows into one value. A scalar function works on one value per row, as UPPER, LENGTH and ROUND do.
This topic is named in a candidate’s interview report: Analytics on-campus interview, 2015, on GeeksforGeeks.
-
Which query finds employees named "rahul" whatever the letter case is in the table (Rahul, RAHUL, rahul)?
- SELECT * FROM emp WHERE name = 'RAHUL' OR 'rahul';
- SELECT * FROM emp WHERE name LIKE 'rahul' CASE OFF;
- SELECT * FROM emp WHERE CASE(name) = 'rahul';
- SELECT * FROM emp WHERE LOWER(name) = 'rahul';
Show the answer
D. SELECT * FROM emp WHERE LOWER(name) = 'rahul';
Lower-casing the column makes the comparison case-insensitive in any database. (In MySQL with a default case-insensitive collation, a plain = already ignores case, but LOWER works everywhere.)
This topic is named in a candidate’s interview report: Analytics on-campus interview, 2015, on GeeksforGeeks.
Aptitude 3
-
Using each of 8, 8, 3 and 3 exactly once, with +, -, * and / and brackets, which expression equals 24?
- (8 + 8) * 3 / 3
- 8 * 3 - 8 + 3
- 8 / (3 - 8 / 3)
- (8 - 3) * (8 - 3)
Show the answer
C. 8 / (3 - 8 / 3)
8 / 3 is 8/3, so 3 - 8/3 = 1/3, and 8 divided by 1/3 is 24. The others give 16, 19 and 25. The trick is that the answer needs a fraction on the way.
This topic is named in a candidate’s interview report: Analytics on-campus interview, 2017, on GeeksforGeeks.
-
You have a 4-litre and a 7-litre jug and unlimited water. Fill the 4 and pour it into the 7. Fill the 4 again and pour into the 7 until the 7 is full. How much is left in the 4-litre jug?
- 1 litre
- 0 litres
- 3 litres
- 2 litres
Show the answer
A. 1 litre
The 7 holds 4 after the first pour, so it takes only 3 more, leaving 1 in the 4-litre jug. Empty the 7, pour in that 1 litre, then fill the 4 and pour it in: the 7 now holds exactly 5 litres.
This topic is named in a candidate’s interview report: Analytics on-campus interview, 2015, on GeeksforGeeks.
-
How many squares of any size are there on an 8 x 8 chessboard?
- 64
- 204
- 196
- 260
Show the answer
B. 204
There are (9 - k)^2 squares of side k: 64 + 49 + 36 + 25 + 16 + 9 + 4 + 1 = 204.
This topic is named in a candidate’s interview report: Analytics on-campus interview, 2015, on GeeksforGeeks.