31. What will be the output of following code :
// Assume all header files are included
void main(){
int const * p=5;
printf("%d",++(*p));
}
A. 5
B. 6
C. 0
D. Compilation Error
View Answer & Explanation
Ans. D
Explanation :
p is a pointer to a “constant integer”. But we tried to change the value of the constant integer.
32. What will be the output of following code :
// Assume all header files are included
main()
{
float me = 1.1;
double you = 1.1;
if(me==you)
printf("I love U");
else
printf("I hate U");
}
A. “I love You”
B. “I hated U”
C. “I hate U”
D. Runtime Error
View Answer & Explanation
Ans. c
Explanation : Float takes 4 bytes and long double takes 10 bytes. So float stores 0.9 with less precision than long double.