InternDoor

Adobe interview prep

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

Practise them as a timed round1 role open at Adobe

DSA 4

  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: MTS on-campus interview, on GeeksforGeeks.

  2. DSAMedium

    You build a height-balanced binary search tree from a sorted array. Which element becomes the root?

    1. The first element
    2. The last element
    3. The middle element; the left half builds the left subtree and the right half the right subtree
    4. Any element, followed by rotations to balance it
    Show the answer

    C. The middle element; the left half builds the left subtree and the right half the right subtree

    Taking the middle each time splits what is left evenly, so the two sides of every node differ in height by at most one. Each element is placed once, in O(n) time.

    This topic is named in a candidate’s interview report: MTS on-campus interview, on GeeksforGeeks.

  3. DSAMedium

    A spell checker must say whether a word is in its dictionary and list the dictionary words that start with what was typed. Which data structure suits this best?

    1. A trie (prefix tree)
    2. A stack
    3. A min-heap
    4. A queue
    Show the answer

    A. A trie (prefix tree)

    A trie answers both "is this a word?" and "which words start with this?" in time proportional to the word's length. For "Did you mean" suggestions, spell checkers add an edit-distance search over the trie.

    This topic is named in a candidate’s interview report: MTS on-campus interview, on GeeksforGeeks.

  4. DSAHard

    Every tower's height must be raised or lowered by exactly k, once. To make the gap between the tallest and shortest tower as small as possible, the usual method sorts the heights first. Why does sorting help?

    1. Sorting makes all the heights equal
    2. Sorted heights can all be changed by k in O(1) total
    3. Some best answer raises a prefix of the sorted heights and lowers the rest, so only the n - 1 split points need trying
    4. Sorting lets binary search find k
    Show the answer

    C. Some best answer raises a prefix of the sorted heights and lowers the rest, so only the n - 1 split points need trying

    Raising a taller tower while lowering a shorter one never helps more than the opposite, so try each split: raise the first i towers, lower the others, and keep the smallest gap. The sort makes it O(n log n).

    This topic is named in a candidate’s interview report: MTS on-campus interview, on GeeksforGeeks.

Python 1

  1. PythonEasy

    What does this print?

    n = 3
    for i in range(1, n + 1):
        print(" " * (n - i) + "*" * (2 * i - 1))
    1. A right-angled triangle of 1, 2 and 3 stars
    2. Three rows of 3 stars
    3. A centred pyramid of 1, 3 and 5 stars
    4. An upside-down pyramid of 5, 3 and 1 stars
    Show the answer

    C. A centred pyramid of 1, 3 and 5 stars

    Row i has n - i leading spaces and 2i - 1 stars: " *", " ***" and "*****". The spaces shrink as the stars grow, which centres each row.

    This topic is named in a candidate’s interview report: CE-DX campus interview, 2024, on Reddit.

C and C++ 2

  1. C and C++Medium

    In C++, what does new do that malloc does not?

    1. It frees the memory automatically when the function returns
    2. It allocates on the stack instead of the heap
    3. It runs the object's constructor (and delete runs the destructor)
    4. It always returns NULL on failure instead of crashing
    Show the answer

    C. It runs the object's constructor (and delete runs the destructor)

    malloc only reserves raw bytes. new reserves memory and constructs the object in it, and delete destroys it before freeing. By default new throws std::bad_alloc on failure rather than returning null.

    This topic is named in a candidate’s interview report: MTS on-campus interview, on GeeksforGeeks.

  2. C and C++Medium

    In a C program, a function declares static int calls = 0; inside it. Where is calls stored?

    1. On the stack, created fresh on every call
    2. On the heap, freed when the function returns
    3. With the globals, in the data area (BSS here, since it starts at zero); it keeps its value between calls
    4. Only in a CPU register
    Show the answer

    C. With the globals, in the data area (BSS here, since it starts at zero); it keeps its value between calls

    Static and global variables live for the whole run, in the data segment, or BSS when they start at zero. Ordinary local variables sit on the stack and vanish when the function returns. Memory from malloc or new is on the heap until it is freed.

    This topic is named in a candidate’s interview report: MTS on-campus interview, on GeeksforGeeks.

DBMS and SQL 2

  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: CE-DX campus interview, 2024, on Reddit.

  2. DBMS and SQLEasy

    emp has rows for 6 employees in the cities Delhi, Pune, Delhi, Mumbai, Pune and Delhi. How many rows does SELECT DISTINCT city FROM emp; return?

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

    D. 3

    DISTINCT removes duplicate result rows, leaving Delhi, Pune and Mumbai. COUNT(DISTINCT city) would return the single number 3.

    This topic is named in a candidate’s interview report: CE-DX campus interview, 2024, on Reddit.

Prep for other employers

All employers
See who is hiring after Adobe

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