Q: What will be the output of the following code :
main()
{
int i=10;
i=!i>14;
Printf ("i=%d",i);
}Solution: The correct answer is: i=0
Q: What will be the output of the following code :
main()
{
extern i;
printf("%d
",i);
{
int i=20;
printf("%d
",i);
}
}Solution: The correct answer is: Linked Error
Q: What will be the output of the following code:
//assume all header files are included
main()
{
float i=1.5;
switch(i)
{
case 1: printf("1");
case 2: print("2");
default : printf("0");
}
}
Solution: The correct answer is: compiler error
Q: What will be the output of the following code :
// assume all header files are included
main()
{
int c=- -2;
printf("c=%d",c);
}Solution: The correct answer is: c=2;
Q: What will be the output of the following C code?
#include < stdio.h >
int x:
void main()
{
if (x)
print("hi");
else
printf("how are u");
}Solution: The correct answer is: how are you
Q: What will be the output of the following C code?
#include< stdio.h >
void main()
{
int x=5;
if (x<1)
printf("hello");
if(x==5)
printf("hi");
else
printf("no");
}
Solution: The correct answer is: hi
Q: What will be the output of the following code :
#include < stdio.h >
main()
{
const int i=4;
float j;
j = ++i;
printf("%d %f", i,++j);
} Solution: The correct answer is: Runtime Error
Q: What will be the output of the following code :
int i,j;
for(i=0;i<=10;i++)
{
j+=5;
assert(i<5);
}
Solution: The correct answer is: Runtime Error
Q: What will be the output of the following code :
//assume all header files are included
main()
{
int *ptr;
ptr=(int*)malloc(sizeof(int));
*ptr=200;
printf("the value of allocated object in %d",*ptr);
}Solution: The correct answer is: The value of allocated object is 200
Q: What will be the output of the following code?
#include < stdio.h >
void main()
{
int x=5;
if(true);
printf("hello");
}
Solution: The correct answer is: It will throw an error
| You Have Score    | /10 |