SUN MICRO SYSTEM PLACEMENT QUESTION ON C

Sun micro system placement interview question on c

(1) Give the output of the following program
main() {
char *s;
s="hot java"; 
strcpy(s,"solarrs java")
}

(2) Give the output of the following program
main() {
printf("hot java");
fork()
exit(0);
}

(i). When redirected to a screen what will be printed. (ii). When redirected to file what will be printed.

(3). Give the output of the following program
main() {
int ret;
ret=fork();
ret=fork();
ret=fork();
ret=fork();
if(!ret)
printf("sun");
else 
printf("solaris");

(4). Give the output of the following program
main() {
char *p='a'; 
int *i=100/*p;
}
what will be the value of *i= 1

(5) Which data structure gives efficient search 1 B-tree 2 binary trees 3 array 4 linked lists?

(6). Find the error in the following program
struct point {
struct point *next; 
int data;
} x;

main() {
int i;
for(x=p;x!=0;)
x=x->next,x++; 
freelist(x); }
freelist(x) {
free(x);
return
}

(7) Pick up the correct function declaration.
void *[] name();
2. void int[][] name();
3. void ** name();
4. none of the above.

(8)For the following program.
struct XXX {
int a;
float b;
char *s;
}X;

If optimization :X not used in compiler then unused bits_________________.  Give your assumption_______________.

(9)Give the output of the following program
struct XXX {
int a:6;
float b:4;
char s;
}structure;
size of (structure);
Post a Comment