InternDoor

Qualcomm interview prep

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

Practise them as a timed round39 roles open at Qualcomm

DSA 4

  1. DSAMedium

    The sorted array [4, 5, 6, 7, 0, 1, 2] has been rotated. A modified binary search looks for 0. Why can binary search still work, and how fast is it?

    1. At every step at least one half of the range is sorted, which tells you which half can hold the target; O(log n)
    2. You must scan for the rotation point, so it is O(n) at best
    3. The array must be sorted again first, so it takes O(n log n)
    4. It only works when the array has not been rotated
    Show the answer

    A. At every step at least one half of the range is sorted, which tells you which half can hold the target; O(log n)

    Compare the middle with the ends: one side is always in order. If the target lies within that sorted side's range, search there, otherwise search the other side. Each step halves the range.

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

  2. DSAEasy

    Two pointers start at the head of a singly linked list. Each step, one moves one node and the other moves two. When the fast one reaches the end, where is the slow one?

    1. At the head
    2. At the middle node
    3. At the last node
    4. At the second node
    Show the answer

    B. At the middle node

    The fast pointer covers twice the distance, so the slow one has gone half way. This finds the middle in one traversal; for an even length it lands on the first or second middle depending on the exact loop condition.

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

  3. DSAHard

    Bars have heights [0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1]. How many units of rain water are trapped between them?

    1. 5
    2. 7
    3. 8
    4. 6
    Show the answer

    D. 6

    Each bar holds min(highest bar to its left, highest bar to its right) minus its own height, if positive. That gives 1 at index 2, 1 at index 4, 2 at index 5, 1 at index 6 and 1 at index 9: 6 in all.

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

  4. DSAMedium

    How many palindromic substrings does "aaa" have, counting each starting position separately?

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

    A. 6

    Three single letters, two "aa" (positions 0-1 and 1-2) and one "aaa": 6. Expanding around each of the 2n - 1 centres counts them in O(n^2) time.

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

C and C++ 6

  1. C and C++Medium

    What does this print?

    #include <stdio.h>
    
    int main(void) {
        int n = 29;      /* 11101 in binary */
        int k = 2;
        printf("%d", n & ~(1 << k));
        return 0;
    }
    1. 25
    2. 29
    3. 27
    4. 21
    Show the answer

    A. 25

    1 << 2 is 00100. Its complement has every bit set except bit 2, so ANDing clears just that bit: 11101 becomes 11001, which is 25.

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

  2. C and C++Medium

    In C, what do int *a[9]; and int (*b)[9]; declare?

    1. Both are arrays of 9 pointers to int
    2. Both are pointers to an array of 9 ints
    3. a is a pointer to an array of 9 ints; b is an array of 9 pointers to int
    4. a is an array of 9 pointers to int; b is a pointer to an array of 9 ints
    Show the answer

    D. a is an array of 9 pointers to int; b is a pointer to an array of 9 ints

    [] binds tighter than *, so a is an array of 9 elements, each an int *. The parentheses in (*b) make b a pointer first, pointing at an int[9].

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

  3. C and C++Easy

    How does calloc(n, size) differ from malloc(n * size)?

    1. calloc sets every byte of the block to zero; malloc leaves the contents undefined
    2. malloc zeroes the memory and calloc does not
    3. calloc allocates on the stack
    4. calloc can only allocate arrays of int
    Show the answer

    A. calloc sets every byte of the block to zero; malloc leaves the contents undefined

    Both allocate from the heap. calloc also zero-fills the block and checks n * size for overflow; malloc's block holds whatever was there before.

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

  4. C and C++Medium

    You copy 8 bytes from buf to buf + 2 in the same array, so the source and destination overlap. Which C function is guaranteed to copy correctly?

    1. memmove, which behaves as if the bytes went through a temporary buffer
    2. memcpy, because it is faster
    3. Both memcpy and memmove
    4. Neither; overlapping copies cannot be done in C
    Show the answer

    A. memmove, which behaves as if the bytes went through a temporary buffer

    memcpy has undefined behaviour when the regions overlap. memmove handles overlap, usually by copying backwards when the destination is after the source.

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

  5. C and C++Medium

    Why would C code declare a memory-mapped hardware status register as volatile?

    1. So it is placed in read-only memory
    2. So every access is atomic and thread-safe
    3. So it is zero-initialised at start-up
    4. So the compiler reads it from memory on every access instead of keeping it in a register or removing reads it thinks are redundant
    Show the answer

    D. So the compiler reads it from memory on every access instead of keeping it in a register or removing reads it thinks are redundant

    Hardware can change the register behind the compiler's back. volatile forbids caching or dropping those reads and writes. It does not make access atomic or add any locking.

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

  6. C and C++Medium

    What does this print?

    #include <stdio.h>
    #include <stdlib.h>
    
    struct node { int v; struct node *next; };
    
    struct node *insert(struct node *head, int v) {
        struct node *n = malloc(sizeof *n);
        n->v = v;
        if (head == NULL || v < head->v) { n->next = head; return n; }
        struct node *p = head;
        while (p->next && p->next->v < v) p = p->next;
        n->next = p->next;
        p->next = n;
        return head;
    }
    
    int main(void) {
        struct node *h = NULL;
        int xs[] = {5, 1, 4, 2};
        for (int i = 0; i < 4; i++) h = insert(h, xs[i]);
        for (struct node *p = h; p; p = p->next) printf("%d ", p->v);
        return 0;
    }
    1. 5 1 4 2
    2. 1 2 4 5
    3. 5 4 2 1
    4. 1 4 2 5
    Show the answer

    B. 1 2 4 5

    A new smallest value becomes the new head; otherwise the walk stops at the last node smaller than v and links the new node after it. Returning the head handles the empty-list and new-head cases.

    This topic is named in a candidate’s interview report: Embedded intern interview, 2026, on Reddit.

Operating systems 4

  1. Operating systemsMedium

    How does a mutex differ from a counting semaphore?

    1. A mutex lets one holder in at a time and is released by its owner; a semaphore allows up to N and anyone may signal it
    2. They are two names for the same thing
    3. A semaphore can only be used between processes
    4. A mutex lets N threads in at once
    Show the answer

    A. A mutex lets one holder in at a time and is released by its owner; a semaphore allows up to N and anyone may signal it

    A mutex is for mutual exclusion over one resource, owned by the thread that locked it. A counting semaphore counts available slots, such as 5 database connections, and is also used for signalling between threads.

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

  2. Operating systemsMedium

    A low-priority task holds a lock that a high-priority task needs, while a medium-priority task keeps pre-empting the low one. What is this, and what is a standard fix?

    1. Priority inversion; priority inheritance temporarily raises the lock holder to the waiting task's priority
    2. Deadlock; kill one of the tasks
    3. Starvation; give every task the same priority
    4. Thrashing; add more memory
    Show the answer

    A. Priority inversion; priority inheritance temporarily raises the lock holder to the waiting task's priority

    The high-priority task is effectively waiting on the medium one. With priority inheritance the low task runs at high priority until it releases the lock, so the medium task cannot get in the way.

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

  3. Operating systemsEasy

    Which component translates a virtual address into a physical address on each memory access?

    1. The memory management unit (MMU), using the page table and caching recent translations in the TLB
    2. The compiler
    3. The linker
    4. The disk controller
    Show the answer

    A. The memory management unit (MMU), using the page table and caching recent translations in the TLB

    The MMU is hardware. It looks the page up in the TLB, walks the page table on a miss, and raises a page fault when the page is not in memory.

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

  4. Operating systemsEasy

    Which order runs from fastest to slowest?

    1. RAM, CPU cache, SSD
    2. SSD, RAM, CPU cache
    3. CPU cache, SSD, RAM
    4. CPU cache, RAM, SSD
    Show the answer

    D. CPU cache, RAM, SSD

    Cache sits on the CPU and answers in a few nanoseconds, RAM in tens of nanoseconds, and an SSD in tens of microseconds or more.

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

Aptitude 1

  1. AptitudeMedium

    100 bulbs start off. In round i, for i from 1 to 100, you toggle every i-th bulb. How many bulbs are on at the end?

    1. 50
    2. 0
    3. 10
    4. 1
    Show the answer

    C. 10

    Bulb n is toggled once for each divisor of n. Divisors come in pairs except for perfect squares, so only squares are toggled an odd number of times: 1, 4, 9, ..., 100, which is 10 bulbs.

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

Prep for other employers

All employers
See who is hiring after Qualcomm

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