InternDoor

SAP interview prep

8 practice questions on the topics candidates reported from SAP 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 1

  1. DSAMedium

    You find the integer square root of n (the largest m with m * m <= n) by binary search over 0 to n. What do you do when m * m <= n?

    1. Return m at once
    2. Search the left half
    3. Keep m as the best answer so far and search the right half
    4. Restart the search from m
    Show the answer

    C. Keep m as the best answer so far and search the right half

    m fits, but a larger value might too, so remember it and look right. When m * m > n, look left. It takes O(log n) steps. Compare m <= n / m, or use 64-bit numbers, so m * m cannot overflow.

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

OOP 3

  1. OOPEasy

    Which kind of inheritance does Java not allow between classes?

    1. Single inheritance
    2. Hierarchical inheritance
    3. Multilevel inheritance
    4. Multiple inheritance: a class can extend only one class, though it can implement many interfaces
    Show the answer

    D. Multiple inheritance: a class can extend only one class, though it can implement many interfaces

    Extending two classes would raise the diamond problem: which parent's fields and method win. Java allows one superclass and any number of interfaces; since Java 8, a clash between two default methods must be resolved in the class.

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

  2. OOPMedium

    Classes B and C both inherit from A, and D inherits from both B and C. What is the diamond problem, and how does C++ deal with it?

    1. D cannot be written in any language
    2. C++ quietly uses B's copy of A
    3. D inherits nothing from A
    4. D would hold two copies of A, so using A's members through D is ambiguous; C++ solves it with virtual inheritance (class B : virtual public A), which shares one A
    Show the answer

    D. D would hold two copies of A, so using A's members through D is ambiguous; C++ solves it with virtual inheritance (class B : virtual public A), which shares one A

    Without virtual inheritance, D has an A inside B and another inside C, and d.x does not compile. Java avoids the problem by allowing only one superclass; when two interfaces give the same default method, the class must override it and choose.

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

  3. OOPEasy

    Which kinds of inheritance between classes does Java allow?

    1. Only single
    2. Single, multilevel and hierarchical, but not multiple
    3. Single, multiple and hybrid
    4. Every kind, including multiple
    Show the answer

    B. Single, multilevel and hierarchical, but not multiple

    Single: B extends A. Multilevel: C extends B extends A. Hierarchical: B and C both extend A. A class cannot extend two classes, which avoids the diamond problem, but it may implement many interfaces. C++ allows multiple inheritance of classes.

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

Machine learning 2

  1. Machine learningHard

    Why should features be scaled before running k-means or k-nearest neighbours?

    1. Distances would otherwise be dominated by the feature with the largest numeric range
    2. Scaling makes the algorithms run in linear time
    3. Both algorithms only accept values between 0 and 1
    4. Scaling removes outliers
    Show the answer

    A. Distances would otherwise be dominated by the feature with the largest numeric range

    Both rely on distances. If salary is in lakhs and age in years, salary decides every distance and age barely counts. Standardising puts features on a comparable scale.

    This topic is named in a candidate’s interview report: AI/ML engineer (STAR) campus interview, 2026, on Reddit.

  2. Machine learningMedium

    How does the elbow method help choose k for k-means?

    1. It chooses the k with the lowest total within-cluster distance, which is always the largest k
    2. You plot the within-cluster sum of squares against k and pick the point after which more clusters improve it only a little
    3. It sets k to the number of features
    4. It tries random k values and averages them
    Show the answer

    B. You plot the within-cluster sum of squares against k and pick the point after which more clusters improve it only a little

    The sum of squares always falls as k grows, reaching 0 when every point is its own cluster, so the lowest value is useless. The bend shows where extra clusters stop explaining much. The silhouette score is another check, and the use the clusters are for matters most.

    This topic is named in a candidate’s interview report: AI/ML engineer (STAR) campus interview, 2026, on Reddit.

Aptitude 2

  1. AptitudeHard

    Four people must cross a bridge at night with one torch. At most two cross at a time, the pair moves at the slower one's pace, and the torch must be carried back. They take 1, 2, 5 and 10 minutes. What is the shortest total time?

    1. 19 minutes
    2. 18 minutes
    3. 17 minutes
    4. 16 minutes
    Show the answer

    C. 17 minutes

    1 and 2 cross (2), 1 returns (1), 5 and 10 cross together (10), 2 returns (2), 1 and 2 cross (2): 17. Letting the fastest walk everyone over gives 10 + 1 + 5 + 1 + 2 = 19. The trick is sending the two slowest together.

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

  2. AptitudeMedium

    One of 1,000 bottles is poisoned, and a rat that drinks any poison dies within a day. You have one day. What is the fewest rats that always finds the bottle?

    1. 999
    2. 100
    3. 20
    4. 10
    Show the answer

    D. 10

    Number the bottles in binary; 10 bits cover up to 1,023. Rat k drinks from every bottle whose bit k is 1. Next day, the dead rats spell out the poisoned bottle's number in binary. Each rat gives one yes/no answer, and 2^10 >= 1,000.

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

Prep for other employers

All employers
See who is hiring after SAP

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