31. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int i = 0, j = 0;
while (l1: i < 2)
{
i++;
while (j < 3)
{
printf("loop\n");
goto l1;
}
}
}
#include <stdio.h>
int main()
{
int i = 0, j = 0;
while (l1: i < 2)
{
i++;
while (j < 3)
{
printf("loop\n");
goto l1;
}
}
}
32. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int i = 0, j = 0;
while (i < 2)
{
l1 : i++;
while (j < 3)
{
printf("Loop\n");
goto l1;
}
}
}
#include <stdio.h>
int main()
{
int i = 0, j = 0;
while (i < 2)
{
l1 : i++;
while (j < 3)
{
printf("Loop\n");
goto l1;
}
}
}
33. What is an example of iteration in C?
34. What will be the output of the following C code?
#include <stdio.h>
void main()
{
int i = 5, k;
if (i == 0)
goto label;
label: printf("%d", i);
printf("Hey");
}
#include <stdio.h>
void main()
{
int i = 5, k;
if (i == 0)
goto label;
label: printf("%d", i);
printf("Hey");
}
35. What will be the output of the following C code?
#include <stdio.h>
int main()
{
for (int i = 0;i < 1; i++)
printf("In for loop\n");
}
#include <stdio.h>
int main()
{
for (int i = 0;i < 1; i++)
printf("In for loop\n");
}
36. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int i = 0;
for (; ; ;)
printf("In for loop\n");
printf("After loop\n");
}
#include <stdio.h>
int main()
{
int i = 0;
for (; ; ;)
printf("In for loop\n");
printf("After loop\n");
}
37. Which of the following cannot be used as LHS of the expression in for (exp1;exp2; exp3)?
38. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int i = 0, j = 0;
for (i; i < 2; i++){
for (j = 0; j < 3; j++)
{
printf("1\n");
break;
}
printf("2\n");
}
printf("after loop\n");
}
#include <stdio.h>
int main()
{
int i = 0, j = 0;
for (i; i < 2; i++){
for (j = 0; j < 3; j++)
{
printf("1\n");
break;
}
printf("2\n");
}
printf("after loop\n");
}
39. Comment on the output of the following C code.
#include <stdio.h>
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);
}
#include <stdio.h>
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);
}
40. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int a = 1, b = 1;
switch (a)
{
case a*b:
printf("yes ");
case a-b:
printf("no\n");
break;
}
}
#include <stdio.h>
int main()
{
int a = 1, b = 1;
switch (a)
{
case a*b:
printf("yes ");
case a-b:
printf("no\n");
break;
}
}
Read More Section(Control Structures)
Each Section contains maximum 100 MCQs question on Control Structures. To get more questions visit other sections.