2016-11-10


Placement papers of SAP 2016-2017. Learn and practice the placement papers and interview questions answers of SAP and find out how much you score before you appear for your next interview and written test.

SAP Placement Papers - Interview Questions:

1. If int is 2 bytes wide.What will be the output of the program?
#include
void fun(char**);
int main()
{
char *argv[] = {"ab", "cd", "ef", "gh"};
fun(argv);
return 0;
}
void fun(char **p)
{
char *t;
t = (p+= sizeof(int))[-1];
printf("%s\n", t);
}

A.ab            B.cd            C.ef            D.gh

Answer: B

2. What will be the output of the program if the array begins at 65486 and each integer occupies 2 bytes?
int main()
{
int arr[] = {12, 14, 15, 23, 45};
printf("%u, %u\n", arr+1, &arr+1);
return 0;
}

A.12, 65490        B.14, 65492        C.65488, 65496        D.64490, 65498

Answer: C

Explanation:
Here, the base address(also the address of first element) of the array is 65486. => Here, arr is reference to arr has type "pointer to int". Therefore, arr+1 is pointing to second element of the array arr memory location. Hence 65486 + 2 bytes     = 65488 => Then, &arr is "pointer to array of 5 ints". Therefore, &arr+1 denotes "5 ints * 2 bytes * 1 = 10 bytes". Hence, begining address 65486 + 10 = 65496. So, &arr+1 = 65496. Hence the output of the program is 65488, 65496.

3. Recursive functions are executed in a

A.last in first out order        B.first in First out order        C.Are maintained in a stack        D.none of the above

Answer: A

4. What will be the output of the program?
#include
int main()
{
int i=3, j=4, k, l;
k = addmult(i, j);
l = addmult(i, j);
printf("%d %d\n", k, l);
return 0;
}
int addmult(int ii, int jj);
{
int kk, ll;
kk = ii + jj;
ll = ii * jj;
return (kk, ll);
}

A.Function addmult()return 7 and 12        B.No output        C.Error: Compile error        D.None of above

Answer: C

Explanation:
There is an error in this statement int addmult(int ii, int jj);. We have to remove the semi-colon, because it was an definition of the function addmult()

5. Point out the error if any in the while loop.

main()
{
int i =0;
while()
{
printf("%d",i++);
if(i>10)
break;
}
}

A.the condition in the while loop is a must        B.the while lop must be replaced by a for loop

Answer: A

6. What will be the output of the program?
#include
void fun(int);
int main()
{
int a=3;
fun(a);
return 0;
}
void fun(int n)
{
if(n > 0)
{
fun(--n);
printf("%d,", n);
fun(--n);
}
}

A.0, 2, 1, 0            B.1, 1, 2, 0            C.0, 1, 0, 2            D.0, 1, 2, 0

Answer: D

7. What will be output of following c program?

int main()
{
for(printf("1");!printf("0");printf("2")) printf("Sachin");
return 0;
}

A.10sachin2        B.10sachin        C.10sachin210sachin2            D.10

Answer: D

8. What will be the output of the program?
#include
int main()
{
int fun();
int i;
i = fun();
printf("%d\n", i);
return 0;
}
int fun()
{
_AX = 1990;
}

A.Garbage value            B.0 (Zero)        C.1990            D.No output

Answer: C

Explanation:
The return value of the function is taken from the Accumulator _AX=1990.

9. What will be output of following c program?
void main()
{
int a[]={5,10,15};
int i=0,num;
num=a[++i]+ ++i+(++i);
printf("%d",num);
}

A.6            B.17            C.16            D.12

Answer:A

10. What will be the output of the program?
#include
int main()
{
int i = 5;
while(i-- >= 0)
printf("%d,", i);
i = 5;
printf("\n");
while(i-- >= 0)
printf("%i,", i);
while(i-- >= 0)
printf("%d,", i);
return 0;
}

A. 4, 3, 2, 1, 0, -1
4, 3, 2, 1, 0, -1

B. 5, 4, 3, 2, 1, 0
5, 4, 3, 2, 1, 0

C. Error

D. 5, 4, 3, 2, 1, 0
5, 4, 3, 2, 1, 0
5, 4, 3, 2, 1, 0

A.A            B.B            C.C            D.D

Answer: A

You can also see: Polaris Placement Papers

11. Point out the error in the following program.
#include
int main()
{
char str[] = "Freshersworld";
printf("%.#s %2s", str, str);
return 0;
}

A.in Array declaration        B.printf statement        C.unspecified character in printf        D.No error

Answer: D

12. Find the output of following snippet?
# include
void main()
{
char letter = 'Z';
printf("%c",letter);
}

A.Z        B.90            C.Garbage Value            D.error

Answer: A

13. What will be the output of the program?
#include
#define SQR(x)(x*x)
int main()
{
int a, b=3;
a = SQR(b+2);
printf("%d\n", a);
return 0;
}

A.25            B.11            C.Error            D.Garbage value

Answer: B

Explanation:
11 Answer: 11 Explanation: a = SQR(b+2); becomes, => a = b+2 * b+2; Here SQR(x) is replaced by macro to x*x . => a = 3+2 * 3+2; => a = 3 + 6 + 2; => a = 11;

14. What will be the output of the program if value 25 given to scanf()?
#include
int main()
{
int i;
printf("%d\n", scanf("%d", &i));
return 0;
}

A.1            B.2            C.5            D.25

Answer: A

Explanation:
The scanf function returns the number of input is given. printf("%d\n", scanf("%d", &i)); The scanf function returns the value 1(one). Therefore, the output of the program is '1'.

15. void main()
{
char far *farther, *farthest;
printf("%d..%d",sizeof(farther),sizeof(farthest));
}

What is the ouput of above snippet?

A.2.4            B.syntax error        C.compiler error        D.4.2

Answer: D

16. What will be the content of 'file.c' after executing the following program?
#include
int main()
{
FILE *fp1, *fp2;
fp1=fopen("file.c", "w");
fp2=fopen("file.c", "w");
fputc('A', fp1);
fputc('B', fp2);
fclose(fp1);
fclose(fp2);
return 0;
}

A.B            B.A B            C.B B            D.Error in opening file 'file1.c'

Answer: A

17. What is the output of following snippet?
main()
{
int c[] = { 2.8,3.4,4,6.7,5};
int j,*p=c,*q=c;
for(j=0;j<5;j++)
{
printf("%d",*c);
++q;
}
for (j =0; j<5;j++)
{
printf("%d",*p);
++p;
}
}

A.syntax error        B.compiler error            C.2 2 2 2 2 2 3 4 6 5        D.5 6 4 5 2 2 2 2

Answer: C

18. What will be the output of the program ?
#include
int main()
{
float arr[] = {12.4, 2.3, 4.5, 6.7};
printf("%d\n", sizeof(arr)/sizeof(arr[0]));
return 0;
}

A.4            B.5            C.6            D.7

Answer: A

Explanation:
The variable arr has 4 elements. The size of the float variable is 4 bytes. Hence 4 elements x 4 bytes = 16 bytes sizeof(arr[0]) is 4 bytes Hence 16/4 is 4 bytes Hence the output of the program is '4'.

19. main()
{
char *p;
p ="Hello";
printf ("%c\n"' *&*p);
}
What is the output of above snippet ?

A.H            B.syntax error        C.compiler error            D.E

Answer: A

You can also see: Mphasis Placement Papers

20. main()
{
int i;
print("%d",scanf("%d",&i));
// value 10 is given to the input here
}
What is the ouput of above snippet?

A.1        B.compiler error            C.syntax error            D.2

Answer: A

21. What will be output of following c program?
void main()
{
int a,i=4;
a=- -i+- -i+- -5;
printf("%d %d",a,i);
}

A.13 4            B.-3 2            C.7 2            D.-13 4

Answer: A

22. Find the output from following program?
#include
int main()
{
int a = 10, b;
a >=5 ? b=100: b=200;
printf("%d\n", b);
return 0;
}

A.100            B.200            C.Error: L value required for b        D.Garbage value

Answer: C

Explanation:
variable b is not assigned

23. What will be output of following c program?
void main()
{
int z;
z=(5,3,2);
printf("%d",z);
}

A.5            B.3            C.2            D.10

Answer: C

24. What will be the output of the program?
#include
int main()
{
unsigned int i = 65535;
/* Assume 2 byte integer*/
while(i++ != 0)
printf("%d",++i);
printf("\n");
return 0;
}

A.Infinite loop        B.0 1 2 ... 65535        C.0 1 2 ... 32767 - 32766 -32765 -1 0        D.No output

Answer: A

25. What will be output of following c program?
int main()
{
float **(*ptr)[4]=(float **(*)[4]);
ptr+=5;
printf("%d %d",ptr,sizeof ptr); return 0;
}

A.0 2            B.5 2            C.4 2            D.40 2

Answer: D

26. What will be output of following c program?
struct myStruct
{
int a;
char b;
}
*ptr;
int main()
{
struct myStruct ms={400,'A'};
printf("%d %d",ptr->a,ptr->b);
return 0;
}

A.400 A            B.400 65            C.400 97            D.0 0

Answer: D

27. What will be the output of the program?
#include
int main()
{
int i;
i = printf("How r u\n");
i = printf("%d", i);
printf("%d", i);
return 0;
}

A.How r u 7 2        B.How r u 8 2        C.How r u 1 1        D.Error: cannot assign printf to variable

Answer: B

28. What will be output of following c program?
#include "string.h"
typedef struct stu1
{
int roll;
char *name;
double marks;
}
STU1;
typedef struct stu2
{
int roll;
char *name;
double marks;
}
STU2;
void main()
{
STU1 s1={25,"Rohit",87.43},*p1;
STU2 *p2; p1=&s1;
memcpy(p2,p1,4);
printf("Roll : %d\n",p2->roll);
printf("Name : %s\n",p2->name);
printf("Marks : %lf",p2->marks);
}

A.Roll : 25 Name : Rohit Marks : 87.430000        B.Roll : 25 Name : Rohit Marks : 0.000000        C.Roll : 0 Name : Rohit Marks : 87.430000        D.Roll : 0 Name : null Marks : 0.000000

Answer: B

29. Assume integer is 2 bytes wide. How many bytes will be allocated for the following code?
#include
#include
#define MAXROW 3
#define MAXCOL 4
int main()
{
int (*p)[MAXCOL];
p = (int (*) [MAXCOL])malloc(MAXROW *sizeof(*p));
return 0;
}

A.56 bytes        B.128 bytes        C.24 bytes        D.12 bytes

Answer: C

30. What will be output when you will execute following c code?
void main()
{
volatile int a=11;
printf("%d",a);
}

A.Garbage        B.11            C.2            D.We cannot predict

Answer: D

SAP Placement Paper Syllabus:

Quantitative Aptitude Syllabus:

Probability

Permutations & Combinations

Algebra

Averages

Time Speed & Distance

Time & Work

Profit & Loss

Ratio & Proportion

Simple & Compound Interest

Percentage

Number Series

Mixtures & Alligations

Simplification

Number System

Heights and Distances

Geometry & Mensuration

Data Sufficiency

Logarithms

Progressions

LCM and HCL

Pipes and Cisterns

Partnership

Boats and Streams

Areas, Volumes

Reasoning Syllabus:

Number Series

Letter Series

Anologies

Puzzles

Syllogisms

Binary Logic

Clocks & Calendars

Cubes & Dice

Classification

Blood Relations

Coding-Decoding

Data Sufficiency

Seating Arrangement

Venn Diagrams

Problem Solving

Coded Inequalities

Double Lineup

Logical Deductions

Routes & Networks

Grouping & Selections

Evaluating Course of Action

Statements and Conclusions

Mathematical and Computer Operations

Critical Reasoning

Inferences

Situation Reaction Test

Decision Making

Symbols and Notations

Direction Sense Test

Logical Sequence Of Words

Assertion and Reason

Verification of Truth of the Statement

Statements and Assumptions

Data Interpretation

Verbal Ability Syllabus:

Synonyms

Antonyms

Sentence Completion

Spelling Test

Passage Completion

Sentence Arrangement

Idioms and Phrases

Para Completion

Error Correction (Underlined Part)

Fill in the blanks

Synonyms

Prepositions

Active and Passive Voice

Spotting Errors

Substitution

Transformation

Sentence Improvement

Joining Sentences

Error Correction (Phrase in Bold)

Articles

Gerunds

Identify the Errors

Plural Forms

Odd Words

Prepositions

Suffix

Tense

Adjectives

Homophones

Identify the Sentences

Nouns

Prefix

Sentence Pattern

Tag Questions

Dear readers, the syllabus and SAP placement papers provided here are just for information purpose only. Sometimes companies may change their syllabus and exam pattern. So Please check official company website for latest syllabus.

Show more