71. What will be the final value of j in the following C code?
#include <stdio.h>
int main()
{
int i = 0, j = 0;
if (i && (j = i + 10))
//do something
;
}
#include <stdio.h>
int main()
{
int i = 0, j = 0;
if (i && (j = i + 10))
//do something
;
}
72. Will the following C code compile without any error?
#include <stdio.h>
int main()
{
int k;
{
int k;
for (k = 0; k < 10; k++);
}
}
#include <stdio.h>
int main()
{
int k;
{
int k;
for (k = 0; k < 10; k++);
}
}
73. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int x = 0, y = 2;
int z = ~x & y;
printf("%d\n", z);
}
#include <stdio.h>
int main()
{
int x = 0, y = 2;
int z = ~x & y;
printf("%d\n", z);
}
74. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int a = 4, n, i, result = 0;
scanf("%d", &n);
for (i = 0;i < n; i++)
result += a;
}
#include <stdio.h>
int main()
{
int a = 4, n, i, result = 0;
scanf("%d", &n);
for (i = 0;i < n; i++)
result += a;
}
75. What will be the output of the following C code?
#include<stdio.h>
enum hello
{
a,b=99,c,d=-1
};
main()
{
enum hello m;
printf("%d\n%d\n%d\n%d\n",a,b,c,d);
}
#include<stdio.h>
enum hello
{
a,b=99,c,d=-1
};
main()
{
enum hello m;
printf("%d\n%d\n%d\n%d\n",a,b,c,d);
}
76. What will be the output of the following C code?
#include <stdio.h>
int main()
{
j = 10;
printf("%d\n", j++);
return 0;
}
#include <stdio.h>
int main()
{
j = 10;
printf("%d\n", j++);
return 0;
}
77. What will be the output of the following C code?
#include <stdio.h>
#define MAX 2
enum bird {SPARROW = MAX + 1, PARROT = SPARROW + MAX};
int main()
{
enum bird b = PARROT;
printf("%d\n", b);
return 0;
}
#include <stdio.h>
#define MAX 2
enum bird {SPARROW = MAX + 1, PARROT = SPARROW + MAX};
int main()
{
enum bird b = PARROT;
printf("%d\n", b);
return 0;
}
78. What will be the output of the following C code?
#include<stdio.h>
enum shyam
{
a=2,b=3.56
};
enum shyam s;
main()
{
printf("%d%d",a,b);
}
#include<stdio.h>
enum shyam
{
a=2,b=3.56
};
enum shyam s;
main()
{
printf("%d%d",a,b);
}
79. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int a[5] = {1, 2, 3, 4, 5};
int i;
for (i = 0; i < 5; i++)
if ((char)a[i] == '5')
printf("%d\n", a[i]);
else
printf("FAIL\n");
}
#include <stdio.h>
int main()
{
int a[5] = {1, 2, 3, 4, 5};
int i;
for (i = 0; i < 5; i++)
if ((char)a[i] == '5')
printf("%d\n", a[i]);
else
printf("FAIL\n");
}
80. One of the major difference between typedef and #define is that typedef interpretation is performed by the . . . . . . . . whereas #define interpretation is performed by the . . . . . . . .
Read More Section(C Fundamentals)
Each Section contains maximum 100 MCQs question on C Fundamentals. To get more questions visit other sections.