Siemens Previous Years Solved Sample Placement Papers
-
The prototype declaration for a pointer to a function which returns a pointer to an integer is:
- int (**pfi)();
- int (*)(*pfi)();
- (*int) pfi ();
- int * (*pfi)();
-
main() { static int a[20]; int i=0; a[i]=i++; printf("%d%d%d", a[0],a[i],i ); }
- 0 0 0
- 0 0 1
- 1 1 1
- Error
-
void f(int x,int &y) { x++; y++; } void main() { int i=1,j=1; f(i,j); cout << i << j; }
- 1 1
- 1 2
- 2 1
- 2 2
-
void main(void) { FILE *p; p=fopen("c:\\tc\\trial", "w"); if(!fp) { exit(0); } fclose(p); }
- fopen() not used correctly
- path should be C:\\tc\\trial
- file pointer incorrect
- error
-
void main(void) { int y=128; const int x=y; printf("%d",x); }
- 128
- Garbage
- 0
- Error
-
When do preprocessor directives get executed:
- before compilation
- during compilation
- after compilation
- none
-
Which kind of function can access private data members:
- friend functions
- private member functions
- public member function
- all
-
Which of the following will be automatically generated by the compiler:
- default constructor,default destructor,copy constructor,assignment operator.
- Default constructor,copy constructor.
- Address operator,assignment operator
- B & C.
-
Difference between C++ struct and C++ class is:
- both are same.
- Struct defaults to public member access while class defaults to private member access.
- Struct defaults to public base class inheritance while class defaults to private base class inheritance.
- B & C.
-
Static member functions can access “this” pointer:
- true
- false
- compiler dependent
- none
-
main() { char arr[12]; printf("%d",sizeof(arr)); }
- 24
- 12
- 36
- 2
-
char *p; short i; long l; (long)i= l;
- both 1 & 2 are correct
- both 1 & 2 are incorrect
- Statement 1 is correct
- Statement 2 is correct
-
main() { int I; I=010; printf("%d",i); }
- 2
- 8
- 10
- 4
-
main() { const int val=5; const int *ptrval; ptrval=&val; *ptrval=10; printf("%d",val); }
- 5
- 10
- Garbage
- Error
-
void main(void) { int x=2; int y=4; cout << x++ << ++y << endl; cout << x++ << y++; }
- 2 4
3 4 - 3 3
3 4 - 2 3
2 4 - 2 3
3 3
- 2 4