Sasken Previous Years Solved Sample Placement Papers
-
Point out the error, if any, in the program.
```c
#include
int main() { int a = 10; switch(a) { } printf("This is C program."); return 0; } ``` (a) Error: No case statement specified
(b) Error: No default specified
(c) No Error (Ans)
(d) Error: Infinite loop occurs
-
What will be the output of the program?
```c
#include
int addmult(int ii, int jj) { int kk, ll; kk = ii + jj; ll = ii * jj; return (kk, ll); } 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; } ``` (a) 12, 12 (Ans)
(b) 7, 7
(c) 7, 12
(d) 12, 7
-
In C, if you pass an array as an argument to a function, what actually gets passed?
(a) Value of elements in array
(b) First element of the array
(c) Base address of the array (Ans)
(d) Address of the last element of array
-
Out of fgets() and gets(), which function is safe to use?
(a) gets()
(b) fgets() (Ans)
-
In the following code, what is 'P'?
```c
typedef char *charp;
const charp P;
```
(a) P is a constant (Ans)
(b) P is a character constant
(c) P is character type
(d) None of the above
- What are the types of linkages?
(A) Internal and External
(B) External, Internal, and None
(C) External and None
(D) Internal
Ans: B
- Which of the following is not a type of constructor?
(A) Copy constructor
(B) Friend constructor
(C) Default constructor
(D) Parameterized constructor
Ans: B
- If C and G interchange their positions, which of the following will indicate A’s position?
(A) To the immediate right of G
(B) 4th to the right of C
(C) 2nd to the left of G
(D) To the immediate left of C
(E) None of these
Ans: D
- Which of the following statements should be used to obtain a remainder after dividing 3.14 by 2.1?
(A) rem = 3.14 % 2.1;
(B) rem = modf(3.14, 2.1);
(C) rem = fmod(3.14, 2.1);
(D) Remainder cannot be obtained in floating-point division.
Ans: C