45. What will be the output of following code :
// Assume all header files are included
main()
{
printf("%d", out);
}
int out=100;
A. 0
B. 100
C. Compiler error: undefined symbol out in function main.
D. Runtime Error
View Answer & Explanation
Ans. c
Explanation : The rule is that a variable is available for use from the point of declaration. Even though a is a global variable, it is not available for main. Hence an error.
46. What will be the output of following code :
// Assume all header files are included
int i,j;
for(i=0;i<=10;i++)
{
j+=5;
assert(i<5);
}
A. 89
B. 0
C. compile time error
D. Runtime Error
View Answer & Explanation
Ans. d
Explanation :
asserts are used during debugging to make sure that certain conditions are satisfied.
