71. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int i = 0;
do
{
i++;
if (i == 2)
continue;
printf("In while loop ");
} while (i < 2);
printf("%d\n", i);
}
#include <stdio.h>
int main()
{
int i = 0;
do
{
i++;
if (i == 2)
continue;
printf("In while loop ");
} while (i < 2);
printf("%d\n", i);
}
72. What will be the output of the following C code?
#include <stdio.h>
void main()
{
int k;
for (k = -3; k < -5; k++)
printf("Hello");
}
#include <stdio.h>
void main()
{
int k;
for (k = -3; k < -5; k++)
printf("Hello");
}
73. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int x = 0;
if (x == 1)
if (x >= 0)
printf("true\n");
else
printf("false\n");
}
#include <stdio.h>
int main()
{
int x = 0;
if (x == 1)
if (x >= 0)
printf("true\n");
else
printf("false\n");
}
74. What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input)
#include <stdio.h>
void main()
{
int ch;
printf("enter a value between 1 to 2:");
scanf("%d", &ch);
switch (ch, ch + 1)
{
case 1:
printf("1\n");
break;
case 2:
printf("2");
break;
}
}
#include <stdio.h>
void main()
{
int ch;
printf("enter a value between 1 to 2:");
scanf("%d", &ch);
switch (ch, ch + 1)
{
case 1:
printf("1\n");
break;
case 2:
printf("2");
break;
}
}
75. What will be the output of the following C code?
#include <stdio.h>
void main()
{
double k = 0;
for (k = 0.0; k < 3.0; k++)
printf("Hello");
}
#include <stdio.h>
void main()
{
double k = 0;
for (k = 0.0; k < 3.0; k++)
printf("Hello");
}
76. How many times i value is checked in the following C code?
#include <stdio.h>
int main()
{
int i = 0;
while (i < 3)
i++;
printf("In while loop\n");
}
#include <stdio.h>
int main()
{
int i = 0;
while (i < 3)
i++;
printf("In while loop\n");
}
77. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int i = 0;
do {
i++;
printf("In while loop\n");
} while (i < 3);
}
#include <stdio.h>
int main()
{
int i = 0;
do {
i++;
printf("In while loop\n");
} while (i < 3);
}
78. How many times i value is checked in the following C code?
#include <stdio.h>
int main()
{
int i = 0;
do {
i++;
printf("in while loop\n");
} while (i < 3);
}
#include <stdio.h>
int main()
{
int i = 0;
do {
i++;
printf("in while loop\n");
} while (i < 3);
}
79. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int x = 1;
if (x > 0)
printf("inside if\n");
else if (x > 0)
printf("inside elseif\n");
}
#include <stdio.h>
int main()
{
int x = 1;
if (x > 0)
printf("inside if\n");
else if (x > 0)
printf("inside elseif\n");
}
80. What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input)
#include <stdio.h>
void main()
{
int ch;
printf("enter a value between 1 to 2:");
scanf("%d", &ch);
switch (ch)
{
case 1:
printf("1\n");
default:
printf("2\n");
}
}
#include <stdio.h>
void main()
{
int ch;
printf("enter a value between 1 to 2:");
scanf("%d", &ch);
switch (ch)
{
case 1:
printf("1\n");
default:
printf("2\n");
}
}
Read More Section(Control Structures)
Each Section contains maximum 100 MCQs question on Control Structures. To get more questions visit other sections.