Siemens Previous Years Solved Sample Placement Papers
-
func(int x, int& y) { x++; y++; } void main() { int a, b; a = b = 1; func(a, b); cout << a << b; }
Choices:
A. 1 1
B. 1 2 Answer: Option B
C. 2 1
D. 2 2
-
What is the operator for stream insertion?
A. >
B. >> Answer: Option B
C. <
D. <<
-
The prototype declaration for a pointer to a function which returns a pointer to an integer is:
A. int (**pfi)();
B. int (*)(*pfi)();
C. (*int) pfi ();
D. int * (*pfi)(); Answer: Option D
-
main() { static int a[20]; int i = 0; a[i] = i++; printf("%d%d%d", a[0], a[i], i); }
A. 0 0 0
B. 0 0 1 Answer: Option B
C. 1 1 1
D. Error
-
void f(int x, int &y) { x++; y++; } void main() { int i = 1, j = 1; f(i, j); cout << i << j; }
A. 1 1
B. 1 2 Answer: Option B
C. 2 1
D. 2 2
-
void main(void) { FILE *p; p = fopen("c:\\tc\\trial", "w"); if (!fp) { exit(0); } fclose(p); }
A. fopen() not used correctly
B. path should be C:\\tc\\trial Answer: Option B
C. file pointer incorrect
D. error
-
void main(void) { int y = 128; const int x = y; printf("%d", x); }
A. 128 Answer: Option A
B. Garbage
C. 0
D. Error
-
When do preprocessor directives get executed?
A. before compilation Answer: Option A
B. during compilation
C. after compilation
D. none
-
Which kind of function can access private data members?
A. friend functions
B. private member functions
C. public member function
D. all Answer: Option D
-
Which of the following will be automatically generated by the compiler?
A. default constructor, default destructor, copy constructor, assignment operator.
B. Default constructor, copy constructor.
C. Address operator, assignment operator
D. B & C. Answer: Option D
-
Difference between C++ struct and C++ class is:
A. both are same.
B. Struct defaults to public member access while class defaults to private member access.
C. Struct defaults to public base class inheritance while class defaults to private base class inheritance.
D. B & C. Answer: Option D