InternDoor

Oracle interview prep

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

Practise them as a timed round

DSA 3

  1. DSAMedium

    With a sieve of Eratosthenes up to 100, you look for two primes that add up to 100, trying the smaller prime from 2 upwards. Which pair do you find first?

    1. 11 and 89
    2. 47 and 53
    3. 17 and 83
    4. 3 and 97
    Show the answer

    D. 3 and 97

    The sieve marks every prime up to 100 in O(n log log n). Then try p = 2, 3, 5, ...: 100 - 2 = 98 is not prime, but 100 - 3 = 97 is, so the first pair is 3 and 97. Each check is a lookup in the sieve, so the search is O(n) on top of it.

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

  2. DSAHard

    What is the sum of the XORs of every subset of [1, 5, 6]? The empty subset counts as 0.

    1. 28
    2. 24
    3. 36
    4. 12
    Show the answer

    A. 28

    Any bit set in at least one element is set in exactly half of the 2^n subset XORs, so the sum is (OR of all elements) x 2^(n-1) = 7 x 4 = 28. Listing them: 0, 1, 5, 6, 1^5 = 4, 1^6 = 7, 5^6 = 3 and 1^5^6 = 2, which add up to 28.

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

  3. DSAEasy

    A linked list holds the bits of a binary number, most significant first: 1 -> 0 -> 1 -> 1. Walking it once with value = value * 2 + bit, what number do you get?

    1. 13
    2. 3
    3. 8
    4. 11
    Show the answer

    D. 11

    value goes 0 -> 1 -> 2 -> 5 -> 11. Doubling shifts what you have one place left, so a single pass works without knowing the length first. 1011 in binary is 8 + 2 + 1 = 11.

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

Python 1

  1. PythonEasy

    What does this print?

    def leap(y):
        return y % 4 == 0 and (y % 100 != 0 or y % 400 == 0)
    
    print([y for y in (1900, 2000, 2024, 2100) if leap(y)])
    1. [1900, 2000, 2024, 2100]
    2. [2000, 2024]
    3. [2024]
    4. [1900, 2024]
    Show the answer

    B. [2000, 2024]

    Every 4th year is a leap year except centuries, unless the century divides by 400. So 2000 and 2024 are leap years; 1900 and 2100 are not. Date arithmetic without libraries depends on this rule.

    This topic is named in a candidate’s interview report: Application engineering intern assessment, 2025, on Reddit.

C and C++ 1

  1. C and C++Hard

    What does this print?

    #include <stdio.h>
    
    void swap(int *a, int *b) {
        *a = *a ^ *b;
        *b = *a ^ *b;
        *a = *a ^ *b;
    }
    
    int main(void) {
        int x = 3, y = 5;
        swap(&x, &y);
        printf("%d %d ", x, y);
        swap(&x, &x);
        printf("%d\n", x);
        return 0;
    }
    1. 5 3 5
    2. 5 3 0
    3. 3 5 3
    4. 5 3 3
    Show the answer

    B. 5 3 0

    The XOR swap works for two different variables: 3 and 5 become 5 and 3. With both pointers on x, the first line sets x = x ^ x = 0, and every later line keeps it 0. Swapping with a temporary has no such trap, and compilers make it just as fast.

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

DBMS and SQL 1

  1. DBMS and SQLEasy

    Which statement about SQL and NoSQL databases is most accurate?

    1. SQL databases cannot run on more than one machine
    2. NoSQL databases cannot store structured data
    3. SQL databases store tables with a fixed schema, joins and strong transactions; NoSQL databases (document, key-value, column, graph) trade some of that for flexible schemas and easy horizontal scaling
    4. NoSQL means the database has no query language
    Show the answer

    C. SQL databases store tables with a fixed schema, joins and strong transactions; NoSQL databases (document, key-value, column, graph) trade some of that for flexible schemas and easy horizontal scaling

    Choose SQL when data is relational and correctness across rows matters, as in payments. NoSQL suits flexible, very large or simple-lookup data, such as sessions in a key-value store.

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

Operating systems 4

  1. Operating systemsHard

    One resource type has 3 free units. P1 holds 1 and may still need 2 more, P2 holds 2 and may need 4 more, P3 holds 1 and may need 1 more. Using the banker's algorithm, which is a safe order?

    1. P2, P1, P3
    2. P3, P1, P2
    3. No safe order exists
    4. P2, P3, P1
    Show the answer

    B. P3, P1, P2

    P3 needs 1 of the 3 free and returns 2 (3 - 1 + 2 = 4 free). P1 then needs 2 and returns 3 (5 free). P2 needs 4 and can finish. Starting with P2 fails, because it needs 4 and only 3 are free.

    This topic is named in a candidate’s interview report: Application engineering intern assessment, 2025, on Reddit.

  2. Operating systemsEasy

    How does multithreading differ from multitasking?

    1. Multitasking runs several threads inside one process; multithreading runs several programs
    2. Multitasking is the OS running several processes by switching between them; multithreading is one process running several threads that share its memory
    3. They mean the same thing
    4. Multithreading needs several CPUs and multitasking needs one
    Show the answer

    B. Multitasking is the OS running several processes by switching between them; multithreading is one process running several threads that share its memory

    Multitasking keeps a browser, an editor and a music player going at once, each in its own address space. Multithreading splits one program, such as a browser rendering a page while downloading a file, into threads that share the same memory. Both work on one core by switching, and both use several cores when they can.

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

  3. Operating systemsMedium

    A counting semaphore starts at 7. Then 20 wait (P) operations and 15 signal (V) operations are carried out. What is its final value?

    1. -8
    2. 12
    3. 2
    4. 0
    Show the answer

    C. 2

    Each wait subtracts 1 and each signal adds 1, so 7 - 20 + 15 = 2. In the textbook version a negative value counts the processes blocked on the semaphore; here the final 2 means two more waits can go through without blocking.

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

  4. Operating systemsHard

    A bounded buffer uses semaphores empty = N, full = 0 and mutex = 1. The producer runs wait(mutex) and then wait(empty) before adding an item. What can go wrong?

    1. When the buffer is full, the producer sleeps on empty while holding mutex, so the consumer can never take mutex to remove an item: a deadlock
    2. Nothing; the order of the two waits does not matter
    3. Items get added twice
    4. The consumer reads from an empty buffer
    Show the answer

    A. When the buffer is full, the producer sleeps on empty while holding mutex, so the consumer can never take mutex to remove an item: a deadlock

    The correct order is wait(empty) then wait(mutex): wait for a free slot first, and hold the lock only while touching the buffer. The consumer mirrors it with wait(full) then wait(mutex). Never block on a condition while holding the lock that the other side needs to change it.

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

Aptitude 1

  1. AptitudeMedium

    Three ants sit on the three corners of a triangle. Each picks one of its two edges at random and walks along it at the same speed. What is the probability that at least two ants collide?

    1. 1/4
    2. 1/2
    3. 3/4
    4. 1/8
    Show the answer

    C. 3/4

    There are 2^3 = 8 equally likely choices. The ants avoid each other only if all go clockwise or all go anticlockwise: 2 cases, probability 2/8 = 1/4. So a collision has probability 1 - 1/4 = 3/4. With n ants on an n-sided shape it is 1 - 2/2^n.

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

Prep for other employers

All employers
See who is hiring after Oracle

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