InternDoor

Quest Global interview prep

12 practice questions on the topics candidates reported from Quest Global interviews, with answers. The questions are ours; each one links to the interview report that names its topic.

Practise them as a timed round13 roles open at Quest Global

DSA 7

  1. DSAMedium

    Two singly linked lists join at some node and share every node after it. Two pointers walk the lists, and each jumps to the head of the other list when it reaches the end. Why do they meet at the joining node?

    1. Because the two lists always have the same length
    2. Before reaching the shared part, both have walked the same distance: the first list's own nodes plus the second list's own nodes plus the shared tail once
    3. Because one pointer moves twice as fast as the other
    4. They do not; this only detects a cycle
    Show the answer

    B. Before reaching the shared part, both have walked the same distance: the first list's own nodes plus the second list's own nodes plus the shared tail once

    If the lists are a + c and b + c long, with c shared, one pointer walks a + c + b and the other b + c + a before entering the shared part, so they arrive together. O(m + n) time, O(1) space. If the lists never join, both reach null at the same moment.

    This topic is named in a candidate’s interview report: QA engineer on-campus interview, 2022, on Code360.

  2. DSAMedium

    Kadane's algorithm finds the maximum sum of a contiguous subarray. For [-2, 1, -3, 4, -1, 2, 1, -5, 4], what is that sum and which indices does it cover?

    1. 6, indices 3 to 6
    2. 7, indices 3 to 8
    3. 5, indices 0 to 6
    4. 4, index 3 only
    Show the answer

    A. 6, indices 3 to 6

    Keep the best sum ending at each index: extend the previous run if it is positive, otherwise start again. The best run is 4, -1, 2, 1 at indices 3 to 6, summing to 6, in one O(n) pass.

    This topic is named in a candidate’s interview report: SDE on-campus interview, 2022, on Code360.

  3. DSAMedium

    Houses in a row hold 2, 7, 9, 3, 1. A thief cannot rob two adjacent houses. What is the most they can take?

    1. 11
    2. 10
    3. 12
    4. 13
    Show the answer

    C. 12

    best[i] = max(best[i-1], best[i-2] + house[i]) gives 2, 7, 11, 11, 12. Robbing houses 1, 3 and 5 (2 + 9 + 1) is 12. This is LeetCode 198, and it needs only two running values, so O(n) time and O(1) space.

    This topic is named in a candidate’s interview report: QA engineer on-campus interview, 2022, on Code360.

  4. DSAMedium

    In how many ways can a 2 x 5 board be tiled with 2 x 1 tiles, each placed upright or flat?

    1. 8
    2. 5
    3. 10
    4. 13
    Show the answer

    A. 8

    The first column holds one upright tile (leaving 2 x (n-1)) or two flat tiles stacked (leaving 2 x (n-2)), so ways(n) = ways(n-1) + ways(n-2) with ways(1) = 1 and ways(2) = 2: 1, 2, 3, 5, 8. It is the Fibonacci sequence.

    This topic is named in a candidate’s interview report: SDE on-campus interview, 2022, on Code360.

  5. DSAMedium

    What is the left view of a binary tree, and how is it found?

    1. Every node in the left subtree of the root
    2. The leftmost leaf only
    3. The first node met on each level when the tree is seen from the left: a level-order traversal that keeps the first node of each level, or a DFS visiting left before right that records the first node at each new depth
    4. The inorder traversal
    Show the answer

    C. The first node met on each level when the tree is seen from the left: a level-order traversal that keeps the first node of each level, or a DFS visiting left before right that records the first node at each new depth

    A node deep in the right subtree is in the left view if nothing to its left reaches its depth. Both methods visit each node once, O(n) time, with O(width) or O(height) extra space.

    This topic is named in a candidate’s interview report: QA engineer on-campus interview, 2022, on Code360.

  6. DSAHard

    fib(n) is computed by raising the matrix [[1, 1], [1, 0]] to the n-th power with repeated squaring. How many 2 x 2 matrix multiplications does that take?

    1. O(n)
    2. O(1)
    3. O(n^2)
    4. O(log n)
    Show the answer

    D. O(log n)

    The power's top-right entry is fib(n), and squaring halves the exponent each step, the same trick as fast exponentiation for numbers. Each multiplication is 8 products, so the whole thing is O(log n), and with arithmetic mod 1e9 + 7 it stays exact.

    This topic is named in a candidate’s interview report: Trainee engineer on-campus interview, 2019, on Code360.

  7. DSAMedium

    What is the length of the longest strictly increasing subsequence of [10, 9, 2, 5, 3, 7, 101, 18]?

    1. 3
    2. 5
    3. 4
    4. 2
    Show the answer

    C. 4

    For example 2, 3, 7, 101 (or 2, 5, 7, 18). The O(n^2) DP tries every earlier element; the O(n log n) method keeps, for each length, the smallest possible tail and binary searches where each number goes.

    This topic is named in a candidate’s interview report: QA engineer on-campus interview, 2022, on Code360.

DBMS and SQL 4

  1. DBMS and SQLEasy

    Which of these is a DML command rather than a DDL command?

    1. CREATE
    2. ALTER
    3. DROP
    4. UPDATE
    Show the answer

    D. UPDATE

    DML (data manipulation) changes the rows: INSERT, UPDATE, DELETE and, by most definitions, SELECT. DDL (data definition) changes the structure: CREATE, ALTER, DROP and TRUNCATE.

    This topic is named in a candidate’s interview report: SDE on-campus interview, 2022, on Code360.

  2. DBMS and SQLMedium

    What does adding an index on a column usually do?

    1. Speeds up queries that search or sort on that column, at the cost of extra storage and slower inserts and updates
    2. Speeds up every query on the table, with no cost
    3. Prevents duplicate values in the column
    4. Compresses the table to save space
    Show the answer

    A. Speeds up queries that search or sort on that column, at the cost of extra storage and slower inserts and updates

    A B-tree index lets the database find matching rows in O(log n) instead of scanning the table. Every write must also update the index, so indexes go on columns that are searched often. Only a UNIQUE index stops duplicates.

    This topic is named in a candidate’s interview report: Software engineer interview, 2021, on Code360.

  3. DBMS and SQLEasy

    A students table has a skills column holding values like "Python, SQL, Java". Which normal form does that break, and what is the fix?

    1. BCNF; split the table by primary key
    2. None; text columns may hold lists
    3. Third normal form; add an index on skills
    4. First normal form, which needs atomic values; move skills to a separate table with one row per student and skill
    Show the answer

    D. First normal form, which needs atomic values; move skills to a separate table with one row per student and skill

    1NF wants one value per cell. With a list in a cell you cannot index, join or count skills cleanly, and "find every SQL student" needs string matching. A student_skills table, keyed on (student_id, skill), fixes it.

    This topic is named in a candidate’s interview report: Trainee engineer on-campus interview, 2019, on Code360.

  4. DBMS and SQLEasy

    Which query lists every email that appears more than once in users?

    1. SELECT email, COUNT(*) FROM users GROUP BY email HAVING COUNT(*) > 1;
    2. SELECT email FROM users WHERE COUNT(*) > 1;
    3. SELECT DISTINCT email FROM users;
    4. SELECT email FROM users ORDER BY email;
    Show the answer

    A. SELECT email, COUNT(*) FROM users GROUP BY email HAVING COUNT(*) > 1;

    Group the rows by email and keep the groups with more than one row. WHERE runs before grouping and cannot use an aggregate, so the first query is an error; DISTINCT lists every email once, duplicated or not.

    This topic is named in a candidate’s interview report: Trainee engineer on-campus interview, 2025, on Code360.

Operating systems 1

  1. Operating systemsHard

    n processes share m identical resource units. Process i may hold at most S_i units at once and requests and releases them one at a time. Which condition guarantees no deadlock?

    1. The sum of all S_i is less than m
    2. The sum of all S_i is at most m * n
    3. Every S_i is less than m
    4. The sum of all S_i is less than m + n
    Show the answer

    D. The sum of all S_i is less than m + n

    The worst case is every process holding S_i - 1 units and waiting for its last one. If the sum of S_i - 1 is at most m - 1, at least one unit is still free, someone gets it, finishes and frees everything it held. That sum is (sum of S_i) - n, which gives sum of S_i < m + n.

    This topic is named in a candidate’s interview report: Software engineer interview, 2021, on Code360.

Prep for other employers

All employers
See who is hiring after Quest Global

Engineering internships and entry-level jobs in India, newest first.