[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

# SAP Labs Coding Questions

1 / 18

Sort a list of dates in ascending order given the data format shown below:

Each date is in the form ddmmmyyyy where
dd is the set {0-31}
mmm is in the set {Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec)
yyyy is four digits.

Example
dates = {'01 Mar 2017';'03 Feb 2017';'15 Jan 1998']
The array dates sort to ['15 Jan 1998';'03 Feb 2017';'01 Mar 2017';]

Input : {'01 Mar 2017';'03 Feb 2017';'15 Jan 1998']

Output :

|  Strings | | | |  Fresher
Please Login to view the answer

Tags:SAP Labs

2 / 18

Given two vectors. One contains array element "ele" and other indexes "ind" to push the corresponding element at that index in new array shifting all elements to its right.

Example:
Intput:
ele = {0, 1, 2, 3, 4} ind ={0, 1, 2, 1, 2}

Output: {0, 3, 4, 1, 2}

Input : ele: {0, 1, 2} ind: {0, 1, 0}

Output :

|  Array | | | |  Fresher
Please Login to view the answer

Tags:SAP Labs

3 / 18

Write a program to generate a simple pattern.
1
12
123
1234
123
12
1

Input : 4

Output :

|  Basics | | | |  Fresher
Please Login to view the answer

Tags:SAP Labs

4 / 18

Given an array, print the Next Greater Element (NGE) for every element. The Next greater Element for an element x is the first greater element on the right side of x in the array. Elements for which no greater element exist, consider next greater element as -1.

Input : NA

Output : NA

|  Basics | | | |  Fresher
Please Login to view the answer

Tags:SAP Labs

5 / 18

Given a binary tree and at any moment of time, a given node starts to fire, after one-second fire reaches to all the nodes which are directly connected with given node so the fire cycle continues as same. You need to find minimum time at which whole tree will be burnt.

Input : NA

Output : NA

|  Trees | | | |  Fresher
Please Login to view the answer

Tags:SAP Labs

6 / 18

Given an array with n elements and a sum x, need to count all pairs of elements in the array whose sum is equal to x. Told two approaches one using binary search and other using two pointers.

Input : NA

Output : NA

|  Array | | | |  Fresher
Please Login to view the answer

Tags:SAP Labs

7 / 18

Given an array and integer K, find the number of pairs such that a[i]+K=a[j]

Input : NA

Output : NA

|  Array | | | |  Fresher
Please Login to view the answer

Tags:SAP Labs

8 / 18

Given a string. Find the number of substrings which consists of vowels only and contain all vowels at least once.

Input : NA

Output : NA

|  Strings | | | |  Fresher
Please Login to view the answer

Tags:SAP Labs

9 / 18

Write a function to check whether two given strings are an anagram of each other or not.

Hint:An anagram of a string is another string that contains same characters, only the order of characters can be different.

Example: "abcd" and "dabc" are anagram of each other.

Input : LISTEN

Output :

|  Strings | | | |  Fresher
Please Login to view the answer

Tags:SAP Labs

10 / 18

Write a recursive program to reverse a string without using any extra variable.

Input : NA

Output : NA

|  Strings | | | |  Fresher
Please Login to view the answer

Tags:SAP Labs

Q4I highly advised to practice all the basics and standard program asked at freshers or experienced level job interview in SAP Labs. Practice our hand-picked coding interview questions asked in SAP Labs. You can programed the given question in any language, you can post your answer and same time you can review the other answer. It is always recommanded to write your own program first and then refer others answers. At this page we have covers all the SAP Labs coding questions in 2020 and previously asked in their Interview round or coding rounds.

+ Contribute Programming Qs.

Baig
1