[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.

Placement Questions & Answers :: SAP Labs

21. What sorting algos have their best and worst case times equal ?

Answer: merge sort and heap sort

Explanation:

O(nlogn) for mergesort and heap sort

Workspace

Tags:

Wipro SAP Labs 

22. The time complexity of insertion sort in worst case is?

Answer: n(n-1)/2

Explanation:

Here is no explanation for this answer

Workspace

Tags:

SAP Labs 

23. The Average case occur in linear search algorithm

Answer: When Item is somewhere in the middle of the array

Explanation:

Here is no explanation for this answer

Workspace

Tags:

SAP Labs 

24. #include
int main()
{
int j,ans;
j = 4;
ans = count(4);
printf("%d\n",ans);
return 0;
}
int count(int i)
{
if ( i < 0)
return(i);
else
return( count(i-2) + count(i-1));
}

Answer: -18

Explanation:

Here is no explanation for this answer

Workspace

Tags:

SAP Labs 

25. #include

int main() {
int factorial(int n);
int i,ans;
ans = factorial(5);
printf("\nFactorial by recursion = %d\n", ans);
return 0;
}
int factorial(int n)
{
if (n <= 1)
return (1);
else
return ( n * factorial(n-1));
}

Answer: 120

Explanation:

Here is no explanation for this answer

Workspace

Tags:

SAP Labs 

26. When a function is recursively called, all automatic variables

Answer: are initialized during each execution of the function

Explanation:

Here is no explanation for this answer

Workspace

Tags:

SAP Labs 

27. Consider a linked list of n elements. What is the time taken to insert an element after an element pointed by some pointer?

Answer: O(1)

Explanation:

Here is no explanation for this answer

Workspace

Tags:

Sopra Steria Societe Generale SAP Labs