39. What will be the output of following code :
// Assume all header files are included
enum colors {BLACK,BLUE,GREEN}
main()
{
printf("%d..%d..%d",BLACK,BLUE,GREEN);
return(1);
}
A. 0..1..2
B. 0..1..6
C. 0..4..1
D. Runtime Error
View Answer & Explanation
Ans. a
Explanation : enum assigns numbers starting from 0, if not explicitly defined.
40. What will be the output of following code :
// Assume all header files are included
void main()
{
int i=5;
printf("%d",i+++++i);
}
A. 89
B. y
C. compile time error
D. Runtime Error
View Answer & Explanation
Ans. c
Explanation : The expression i+++++i is parsed as i ++ ++ + i which is an illegal combination of operators.
