81. What will be the output of the following C code?
#include <stdio.h>
enum example {a = 1, b, c};
enum example example1 = 2;
enum example answer()
{
return example1;
}
int main()
{
(answer() == a)? printf("yes"): printf("no");
return 0;
}
#include <stdio.h>
enum example {a = 1, b, c};
enum example example1 = 2;
enum example answer()
{
return example1;
}
int main()
{
(answer() == a)? printf("yes"): printf("no");
return 0;
}
82. Point out the error (if any) in the following C code?
#include<stdio.h>
enum hello
{
a,b,c;
};
main()
{
enum hello m;
printf("%d",m);
}
#include<stdio.h>
enum hello
{
a,b,c;
};
main()
{
enum hello m;
printf("%d",m);
}
83. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int x = -2;
if (!0 == 1)
printf("yes\n");
else
printf("no\n");
}
#include <stdio.h>
int main()
{
int x = -2;
if (!0 == 1)
printf("yes\n");
else
printf("no\n");
}
84. String handling functions such as strcmp(), strcpy() etc can be used with enumerated types.
85. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int y = 1, x = 0;
int l = (y++, x++) ? y : x;
printf("%d\n", l);
}
#include <stdio.h>
int main()
{
int y = 1, x = 0;
int l = (y++, x++) ? y : x;
printf("%d\n", l);
}
86. The name of the variable used in one function cannot be used in another function.
87. Do logical operators in the C language are evaluated with the short circuit?
88. Which operators of the following have same precedence?
P. "!=", Q. "+=", R. "<<="
P. "!=", Q. "+=", R. "<<="
89. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int x = 0, y = 2;
if (!x && y)
printf("true\n");
else
printf("false\n");
}
#include <stdio.h>
int main()
{
int x = 0, y = 2;
if (!x && y)
printf("true\n");
else
printf("false\n");
}
90. What will be the output of the following C code?
#include <stdio.h>
int main()
{
if (~0 == 1)
printf("yes\n");
else
printf("no\n");
}
#include <stdio.h>
int main()
{
if (~0 == 1)
printf("yes\n");
else
printf("no\n");
}
Read More Section(C Fundamentals)
Each Section contains maximum 100 MCQs question on C Fundamentals. To get more questions visit other sections.