SAPLAB Previous Years Solved Sample Placement Papers
-
Consider the function:
Find(int x, int y)
{
return ((x}
The call find(a, b) can be used to find:
A. Maximum of a, b
B. Positive difference of a, b Answer: Option B
C. Sum of a, b
D. Minimum of a, b
-
If abc is the input, the following program fragment:
char x, y, z;
printf("%d",scanf("%c%c%c", &x, &y, &z));
Results in:
A. A syntax error
B. A fatal error
C. Segmentation violation
D. Printing of 3 Answer: Option D
-
Consider the statements:
putchar(getchar());
putchar(getchar());
If "ab" is the input, the output will be:
A. An error message
B. This can’t be input
C. ab
D. a b Answer: Option D
-
The operators , || < = arranged in ascending order of precedence:
A. , || < =
B. = < || ,
C. = || < ,
D. < || = , Answer: Option D
-
The following program fragment:
unsigned i = -1;
int j = -4;
printf("%u", i + j);
Prints:
A. Garbage
B. -3
C. An integer that changes from machine to machine
D. None of the above Answer: Option C
-
The following program fragment:
for(i = 3; i < 15; i += 3);
printf("%d", i);
Results in:
A. A syntax error
B. An execution error
C. Printing of 12
D. Printing of 15 Answer: Option D
-
Pick the wrong statement from the following program:
int main(void) {
int i = 100;
int *pi = &i;
int **dpi = π;
}
A. dpi to store a pointer with the address for pi is a double pointer
B. (*pi == i) is true
C. (*pi == **dpi) is true
D. (*dpi == 100) is true Answer: Option D
-
Below, please find the results for the program:
int counter = 0, i;
for(i = 0;; i++) {
if(i < 100) continue;
counter++;
if(counter == 100) break;
}
printf("%d%d", i, counter);
A. 199 100
B. 200 100 Answer: Option B
C. 199 99
D. 200 0