CSE MCQs :: C-MCQs
-
What is the output of this C code?
int main()
{
int x = 97;
switch (x)
{
case 'a':
printf("yes ");
break;
case 97:
printf("no\n");
break;
}
}
-
What is the output of this C code?
int main()
{
float f = 1;
switch (f)
{
case 1.0:
printf("yes\n");
break;
default:
printf("default\n");
}
}
-
What is the output of this C code?
const int a = 1, b = 2;
int main()
{
int x = 1;
switch (x)
{
case a:
printf("yes ");
case b:
printf("no\n");
break;
}
}
-
What is the output of this C code?
#define max(a) a
int main()
{
int x = 1;
switch (x)
{
case max(2):
printf("yes\n");
case max(1):
printf("no\n");
break;
}
}
-
What is the output of this C code?
int main()
{
switch (printf("Do"))
{
case 1:
printf("First\n");
break;
case 2:
printf("Second\n");
break;
default:
printf("Default\n");
break;
}
}
-
Comment on the output of this C code?
int main()
{
int a = 1;
switch (a)
case 1:
printf("%d", a);
case 2:
printf("%d", a);
case 3:
printf("%d", a);
default:
printf("%d", a);
}
-
Comment on the output of this C code?
int main()
{
int a = 1;
switch (a)
{
case a:
printf("Case A ");
default:
printf("Default");
}
}
-
What is the output of this C code?
int main()
{
while ()
printf("In while loop ");
printf("After loop\n");
}
-
What is the output of this C code?
int main()
{
do
printf("In while loop ");
while (0);
printf("After loop\n");
}