Predict the output type Questions of C Language:

1. Find the output of the following code?
void main()
{
int i=10;
i = !i > 14;
printf(“i=%d”,i);
}


2. Find the output of the following code?
void main()
{
int i=0, j=1, k=2,m;
m = i++ || j++ || k++;
printf(%3d%3d%3d%3d”, m, i, j, k);
}

3. Find the output of the following code?
void main()
{
int main=3;
printf(“%d”, main);
}

4. Find the output of the following code?
void main()
{
int k;
k = ‘a’ > 60;
printf(“%d”, k);
}

5. Find the output of the following code?
void main()
{
printf(“iare\rcollege\n”);
}

6. Find the output of the following code?
void main()
{
int const k = 5;
k++;
printf(“k is %d”, k);
}

7. Find the output of the following code?
int x;
void main()
{
if (x)
printf("hi");
else
printf("how are u");
}

8. Find the output of the following code?
void main()
{
int x = 0;
if (x == 0)
printf("hi");
else
printf("how are u");
printf("hello");
}

9. Find the output of the following code?
void main()
{
int x = 5;
if (x < 1);
printf("Hello");
}

10. Find the output of the following code?
void main()
{
int ch;
printf("enter a value btw 1 to 2:");
scanf("%d", &ch);
switch (ch)
{
case 1: printf("1\n");
default:printf("2\n");
}
}

11. Find the output of the following code?
void main()
{
char ch;
int i;
ch = 'G';
i = ch-'A';
printf("%d", i);
}

12. Find the output of the following code?
void main()
{
int i=065, j=65;
printf(%4d%4d”,i, j);
}

13. Find the output of the following code?
void main()
{
unsigned int a = 10;
a = ~a;
printf(“%d\n”, a);
}

14. Find the output of the following code?
void main()
{
int x = 97;
int y = sizeof(x++);
printf(“x is %d”,x);
}

15. Find the output of the following code?
void main()
{
int x = 4, y, z;
y = --x;
z = x--;
printf(“%3d%3d%3d”, x, y, z);
}
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: