Samsung Interview Questions | Output Questions | C/C++/Java
1. What will be the output of the program ?
#include< stdio.h >void fun(void *p);int i;int main(){void *vptr;vptr = &i;fun(vptr);return 0;}void fun(void *p){int **q;q = (int**)&p;printf("%d ", **q);}
2. Output value or run-time error or compile time error ?
test(){return 3;}void main(){int i=2;for(test();test();test();){printf("2");}
3. what will be output ?
class z { };
class x { int a; };
int main() {
std::cout << sizeof(X) << 'n';
std::cout << sizeof(z) << 'n';
}
4. what is the return value of the function that returns int, but isn’t returning anything explicitly.
for instance output of
int fun() {
printf("ncrap");
}
void main() {
printf("n return value of fun %d", fun());
}