#Include : Void Int Int Int
#Include : Void Int Int Int
#Include : Void Int Int Int
1.
#include <stdio.h>
2.
void foo(int*);
3.
int main()
4.
5.
int i = 10;
6.
foo((&i)++);
7.
8.
9.
10.
11.
printf("%d\n", *p);
}
a) 10
b) Some garbage value
c) Compile time error
d) Segmentation fault/code crash
View Answer
Answer:c
2. What is the output of this C code?
1.
#include <stdio.h>
2.
void foo(int*);
3.
int main()
4.
5.
6.
foo(p++);
7.
8.
9.
10.
11.
printf("%d\n", *p);
}
a) 10
b) Some garbage value
c) Compile time error
d) Segmentation fault
View Answer
Answer:a
3. What is the output of this C code?
1.
#include <stdio.h>
2.
3.
int main()
4.
5.
6.
foo(&i);
7.
8.
9.
10.
11.
printf("%f\n", *p);
}
a) 10.000000
b) 0.000000
c) Compile time error
d) Undefined behaviour
View Answer
Answer:b
4. What is the output of this C code?
1.
#include <stdio.h>
2.
int main()
3.
4.
5.
foo(&i);
6.
7.
8.
9.
10.
int j = 2;
11.
p = &j;
12.
13.
a) 2 97
b) 2 2
c) Compile time error
d) Segmentation fault/code crash
View Answer
Answer:a
5. What is the output of this C code?
1.
#include <stdio.h>
2.
int main()
3.
4.
5.
foo(&p);
6.
7.
return 0;
8.
9.
10.
11.
int j = 2;
12.
*p = &j;
13.
14.
a) 2 2
b) 2 97
c) Undefined behaviour
d) Segmentation fault/code crash
View Answer
Answer:a
6. What is the output of this C code?
1.
#include <stdio.h>
2.
int main()
3.
4.
int i = 11;
5.
int *p = &i;
6.
foo(&p);
7.
8.
9.
10.
11.
int j = 10;
12.
*p = &j;
13.
14.