Deloitte interview prep
3 practice questions on the topics candidates reported from Deloitte interviews, with answers. The questions are ours; each one links to the interview report that names its topic.
DSA 1
-
Euclid's algorithm replaces (a, b) with (b, a mod b) until b is 0. Starting from (252, 105), how many steps does it take, and what is the HCF?
- 2 steps; HCF 7
- 3 steps; HCF 21
- 3 steps; HCF 7
- 4 steps; HCF 21
Show the answer
B. 3 steps; HCF 21
(252, 105) -> (105, 42) -> (42, 21) -> (21, 0): three steps, and the HCF is 21. The values at least halve every two steps, so it runs in O(log min(a, b)).
This topic is named in a candidate’s interview report: Business technology analyst interview, 2021, on GeeksforGeeks.
C and C++ 1
-
What does this print?
#include <iostream> struct A { A() { std::cout << "A"; } ~A() { std::cout << "a"; } }; struct B : A { B() { std::cout << "B"; } ~B() { std::cout << "b"; } }; int main() { B obj; }- ABab
- BAba
- ABba
- BAab
Show the answer
C. ABba
The base part is built first, so A then B. Destruction runs in reverse: B's destructor, then A's, when obj goes out of scope.
This topic is named in a candidate’s interview report: Analyst on-campus interview, 2023, on GeeksforGeeks.
DBMS and SQL 1
-
Which query finds customers whose name starts with "Ra"?
- SELECT * FROM customer WHERE name = 'Ra*';
- SELECT * FROM customer WHERE name LIKE 'Ra%';
- SELECT * FROM customer WHERE name LIKE '%Ra';
- SELECT * FROM customer WHERE name LIKE 'Ra_';
Show the answer
B. SELECT * FROM customer WHERE name LIKE 'Ra%';
In LIKE, % matches any run of characters, including none, and _ matches exactly one. '%Ra' would find names ending in Ra, and 'Ra_' only three-letter names.
This topic is named in a candidate’s interview report: Analyst on-campus interview, 2023, on GeeksforGeeks.