SAP Labs interview experience Real time questions & tips from candidates to crack your interview

Senior Software Developer

SAP Labs
upvote
share-icon
4 rounds | 13 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 6 months
Topics: Data Structures, Algorithms, System Design, Aptitude, OOPS
Tip
Tip

Tip 1 : Must do Previously asked Interview as well as Online Test Questions.
Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 3 : Do at-least 2 good projects and you must know every bit of them.

Application process
Where: Other
Eligibility: Above 7 CGPA
Resume Tip
Resume tip

Tip 1 : Have at-least 2 good projects explained in short with all important points covered.
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects and experiences more.

Interview rounds

01
Round
Easy
Video Call
Duration60 minutes
Interview date17 Feb 2015
Coding problem6

This was a technical round. The interviewer asked me some programming based questions and some questions on database management systems.

1. Sum Of Max And Min

Easy
10m average time
90% success
0/40
Asked in companies
SAP LabsOracleFlexiEle Consulting Services (FE)

You are given an array “ARR” of size N. Your task is to find out the sum of maximum and minimum elements in the array.

Follow Up:
Can you do the above task in a minimum number of comparisons?
Problem approach

This can be solved by simply traversing the array once and updating the max and min by comparing it with every element. Steps :
1. Initialize min and max with the value of the first element of the array 
2. Run a loop from index 1 to n-1 :
For every element, compare it with max and min. Update max and min accordingly. 
This approach has O(n) time complexity and O(1) auxiliary space.

Try solving now

2. Binary Tree from Parent Array

Easy
15m average time
80% success
0/40
Asked in companies
SAP LabsTraveloka

Given an array parent which represents a binary tree such that parent-child relationship is defined by ('PARENT'[i], 'i') which means that parent of i is 'PARENT'[i]. The value of the root node will be i if -1 is present at 'PARENT'[i].

For example:

For the parent array {1, -1, 1}, the tree will be:- 

1

As, parent of 0 is 'PARENT'[0] i.e. 1.
1 is the root as 'PARENT'[1] = -1.
Parent of 2 is 'PARENT'[2] i.e. 1.

Similarly for the parent array { 1, 2, -1}, the tree will be:-

2

Your task is to create the Binary tree from the given parent array.

Note:

From the parent array, multiple binary trees may be possible. You have to create a binary tree in such a way that these conditions satisfy:-

If the node has a left child as well as a right child, make sure the left child is smaller than the right child. 

If the node has only one child, make sure it has an only left child. 

For {1, -1, 1}, the accepted tree will be:- 

3

And for {1, -1}, the accepted tree will be, 

4

Instead of 

5

Problem approach

The idea here is to repeatedly find out the children of a particular node, attach them with their 'PARENT' node and work on the child nodes separately. 

This can be achieved by:- 

Find out the 'ROOT' node by searching for ‘-1’ in the given 'PARENT' array. Pass this 'ROOT' node as well as the 'PARENT' array into a helper function. The helper function returns us the final 'ROOT' of the binary tree by doing the following things:- If the 'ROOT' is 'NULL', i.e. we are given the 'PARENT' array of a 'NULL' tree, returns 'NULL'. Otherwise, traverses the 'PARENT' array and finds out the children of the current 'ROOT'. Let us store 'LEFT' child in 'FIRST' and 'RIGHT' child in Second. Assigns 'FIRST' to the 'LEFT' child of 'ROOT' and recursively calls for the creation of subtree which has 'FIRST' as its 'ROOT'. Assigns Second to the 'RIGHT' child of 'ROOT' and recursively calls for the creation of subtree which has Second as its 'ROOT'. Return the 'ROOT' fetched from the helper function.

Try solving now

3. DBMS Question

What is a primary key? What is a unique key?

Problem approach

A primary key is a special relational database table column(s) designated to uniquely identify each table record.
A primary key’s main features are:
1) It must contain a unique value for each row of data.
2)It cannot contain null values.
3)Every row must have a primary key value.

A unique key is a group of one or more than one columns of a table which uniquely identify database record. A unique key is the same as a primary key, but it can accept one null value for a table column. It also cannot contain identical values.

4. DBMS Question

Can unique key be a primary key?

Problem approach

No, a unique key cannot always be a primary key as unique key can accept null values but primary key cannot.

5. DBMS Question

What is foreign key? Can a foreign key be Null ?

Problem approach

A foreign key column in a table points to a column with unique values in another table to create a way of cross-referencing the two tables.
Yes, a foreign key can have a NULL value.

6. DBMS Question

Is Normalized form is better or storing in a single table/ 2 tables is better?

Problem approach

Tip1 : Discuss the advantages and disadvantages of normalization.
Advantages :
1. Greater overall database organization
2. Reduction of redundant data
3.Data consistency within the database
Disadvantages :
1. Tables will contain codes rather than real data as the repeated data will be stored as lines of codes rather than the true data. 
2. More tables to join as by spreading out data into more tables, the need to join table’s increases and the task becomes more tedious.
3. Data model becomes extremely difficult to query against as the data model is optimized for applications, not for ad hoc querying.

02
Round
Medium
Video Call
Duration60 minutes
Interview date17 Feb 2015
Coding problem1

The interviewer had good work experience. She was polite and calm. After brief introduction she straight jumped into my current projects and she covered my entire CV.

1. System Design Question

Design a parking lot? Design should include :
1. Logic Flow Diagram 
2. E-R diagram (very important) 
3. DB tables with relations between them, preferably normalized 
4. Commands for transaction with tables

Problem approach

Tip 1 : Make all necessary assumptions required to create the relations and tables
Tip 2 : Identify all the main entities of the database management system and their relationships with each other.
Tip 3 : For each entity, define all the necessary attributes.

03
Round
Easy
Video Call
Duration45 minutes
Interview date17 Feb 2015
Coding problem5

This was a technical round involving questions on OOPS concepts and puzzles.

1. Puzzle

Number of squares on a chessboard

Problem approach

Counting and adding all squares in a 8*8 chessboard : 
1 × 1 squares - 8 squares across the width and 8 squares along the length = 8 × 8 = 64
2 × 2 squares - with the size of the square increasing by 1 square the number of squares across the width will be down to 7 and the ones along the length will also be down to 7. So, there are 7 × 7 = 49 (2 × 2) squares.
3 × 3 squares - 6 squares across the width and 6 along the length = 6 × 6 = 36 (3 × 3) squares.
4 × 4 squares - 5 squares across the width and 5 along the length = 5 × 5 = 25 (4 × 4) squares.
5 × 5 squares - 4 squares across the width and 4 along the length = 4 × 4 = 16 (5 × 5) squares.
6 × 6 squares - 3 squares across the width and 3 along the length = 3 × 3 = 9 (6 × 6) squares.
7 × 7 squares - 2 squares across the width and 2 along the length = 2 × 2 = 4 (7 × 7) squares.
8 × 8 squares - 1 square across the width and 1 along the length = 1 × 1 = 1 (8 × 8) square.
Therefore, the total number of squares in a chess board = 64 + 49 + 36 + 25 + 16 + 9 + 4 + 1 = 204 squares.
If you figured that the number of squares is the summation of squares of natural numbers up to 8, thus the formula n(n+1)(2n+1)6 can be used.

2. OOPS Questions

What is C++?

Problem approach

C++ is general-purpose object-oriented programming (OOP) language developed by Bjarne Stroustrup. C++ is considered an intermediate-level language, as it includes both high and low-level language features.

3. OOPS Question

Difference between deep and shallow copy?

Problem approach

A shallow copy of a collection is a copy of the collection structure, not the elements. With a shallow copy, two collections now share the individual elements.
Deep copies duplicate everything. A deep copy of a collection is two collections with all of the elements in the original collection duplicated.

4. OOPS Question

Different versions of polymorphism? How to solve the problem of multiple inheritance?

Problem approach

Polymorphism is of two types :
1. Compile Time Polymorphism : 
Invokes the overloaded functions by matching the number and type of arguments. The information is present during compile-time. This means the C++ compiler will select the right function at compile time. It is achieved through function overloading and operator overloading.
2. Run Time Polymorphism : 
This happens when an object’s method is called during runtime rather than during compile time. Runtime polymorphism is achieved through function overriding. The function to be called is established during runtime.

5. OOPS Question

What are Template classes? Write a program for operator = for template class such that it behaves differently for int and char *

Problem approach

Templates are a way of making your classes more abstract by letting you define the behavior of the class without actually knowing what datatype will be handled by the operations of the class. Templates can be used in conjunction with abstract datatypes in order to allow them to handle any type of data. For example, you could make a templated stack class that can handle a stack of any datatype, rather than having to create a stack class for every different datatype for which you want the stack to function. The basic syntax for declaring a templated class is as follows:
template class a_class {...};

04
Round
Easy
HR Round
Duration30 minutes
Interview date17 Feb 2015
Coding problem1

This was a 30 minute HR round. The interviewer asked me a number of questions to know more about me.

1. Basic HR Questions

Questions about my weakness and strength, my previous company, reason to change etc

Problem approach

Tip 1 : Be sure to do your homework on the organization and its culture before the interview.
Tip 2 : Employers want to understand how you use your time and energy to stay productive and efficient. Be sure to emphasize that you adhere to deadlines and take them seriously.
Tip 3 : Talk about a relevant incident that made you keen on the profession you are pursuing and follow up by discussing your education.

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

How do you remove whitespace from the start of a string?

Choose another skill to practice
Similar interview experiences
company logo
SDE - 1
3 rounds | 3 problems
Interviewed by SAP Labs
2657 views
0 comments
0 upvotes
company logo
Developer Associate
5 rounds | 8 problems
Interviewed by SAP Labs
2218 views
0 comments
0 upvotes
company logo
SDE - 2
5 rounds | 7 problems
Interviewed by SAP Labs
0 views
0 comments
0 upvotes
company logo
SDE - 2
3 rounds | 4 problems
Interviewed by SAP Labs
8825 views
0 comments
0 upvotes