Does this C code compile without error?
#include <stdio.h>
int main()
{
for (int k = 0; k < 10; k++);
return 0;
}
Does this C code compile without error?
#include <stdio.h>
int main()
{
int k;
{
int k;
for (k = 0; k < 10; k++);
}
}
Comment on the output of this C code?
#include <stdio.h>
int main()
{
int i, n, a = 4;
scanf("%d", &n);
for (i = 0; i < n; i++)
a = a * 2;
}
The following code ‘for(;;)’ in C/C++ represents an infinite loop. It can be terminated by __________ statement.
Which for loop has range of similar indices of ‘i’ used in for (i = 0;i < n; i++) in C/C++?
What is the output of this C code?
#include <stdio.h>
int main()
{
short i;
for (i = 1; i >= 0; i++)
printf("%d\n", i);
}
What is the output of this C code?
#include <stdio.h>
int main()
{
int k = 0;
for (k < 3; k++)
printf("Hello");
}
What is the output of this C code?
#include <stdio.h>
int main()
{
while ()
printf("In while loop ");
printf("After loop\n");
}
What is the output of this C code?
#include <stdio.h>
int main()
{
int i = 0;
do {
i++;
printf("In while loop\n");
} while (i < 3);
}
How many times value of i is checked in the below C code?
#include <stdio.h>
int main()
{
int i = 0;
do {
i++;
printf("in while loop\n");
} while (i < 3);
}
What is the output of this C code?
#include <stdio.h>
int main()
{
int a = 0, i = 0;
for (i = 0;i < 5; i++)
{
a++;
continue;
}
printf("%d",a);
}
What is the output of this C code?
#include <stdio.h>
int main()
{
int i = 0, j = 0;
for (i = 0;i < 5; i++)
{
for (j = 0;j < 4; j++)
{
if (i > 1)
break;
}
printf("Hi \n");
}
}
What is the output of the C code given below?
#include <stdio.h>
int main()
{
printf("%d ", 1);
goto l1;
printf("%d ", 2);
l1:goto l2;
printf("%d ", 3);
l2:printf("%d ", 4);
}
What is output of C code given below?
#include <stdio.h>
int main()
{
int i = 0, j = 0;
while (i < 2)
{
l1 : i++;
while (j < 3)
{
printf("Loop\n");
goto l1;
}
}
}