57. What will be the output of following code :
// Assume all header files are included
main()
{
float i=1.5;
switch(i)
{
case 1: printf("1");
case 2: printf("2");
default : printf("0");
}
}
A. 1
B. No output
C. compiler error
D. Runtime Error
View Answer & Explanation
Ans. c
Explanation : Switch statements can be applied only to integral types
58. What will be the output of following code :
// Assume all header files are included
main()
{
extern i;
printf("%d\n",i);
{
int i=20;
printf("%d\n",i);
}
}
A. 1
B. No output
C. Linked Error
D. Runtime Error
View Answer & Explanation
Ans. c
Explanation :
The identifier i is available in the inner block and so using extern has no use in resolving it.