Siemens Previous Years Solved Sample Placement Papers
-
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 the 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
-
Static member functions can access "this" pointer
A. true
B. false Answer: Option B
C. compiler dependent
D. none
-
main() { char arr[12]; printf("%d", sizeof(arr)); }
A. 24
B. 12 Answer: Option B
C. 36
D. 2
-
char *p; short i; long l; (long)i = l;
A. both 1 & 2 are correct
B. both 1 & 2 are incorrect Answer: Option B
C. statement 1 is correct
D. statement 2 is correct
-
main() { int i; i = 010; printf("%d", i); }
A. 2
B. 8 Answer: Option B
C. 10
D. 4
-
main() { const int val = 5; const int *ptrval; ptrval = &val; *ptrval = 10; printf("%d", val); }
A. 5
B. 10
C. Garbage
D. Error Answer: Option D
-
void main(void) { int x = 2; int y = 4; cout << x++ << --y; cout << x << y; }
A. 2 4, 3 4
B. 3 3, 3 4
C. 2 3, 2 4
D. 2 3, 3 3 Answer: Option D
-
A page fault occurs when:
A. system crashes due to lack of memory
B. page referred belongs to a different program
C. request for the page currently made is not in memory Answer: Option C
D. 1 & 2