7. What will be the output of following code :
// Assume all header files are included
#include.....
int a=30;
main(void)
{
a=43;
printf("%d", a);
}
A. 30
B. 43
C. 0
D. ERROR – Cannot Override Global variable.
View Answer & Explanation
Ans. b
Explanation : Initially, ‘a’ was provided with a value 30 which was later updated to 43.
8. What will be the output of following code :
// Assume all header files are included
#include.....
int find(int x)
{
return x+2;
}
int main(void)
{
int a=44;
int res;
res=find(a);
printf("%d",res);
return 0;
}
A. 46
B. 44
C. 0
D. ERROR – res variable can not hold integer value.
View Answer & Explanation
Ans. a
Explanation :
res = find(44)
find(44) : return (44 + 2)
res = 46