Control Structures - Study Mode
[#106] What will be the output of the following C code? #include <stdio.h>
void main()
{
int x = 0
if (x == 0)
printf("hi")
else
printf("how are u")
printf("hello")
}
Correct Answer
(D) hihello
[#107] What will be the output of the following C code? #include <stdio.h>
void main()
{
int i = 0, k
if (i == 0)
goto label
for (k = 0
k < 3
k++)
{
printf("hi ")
label: k = printf("%03d", i)
}
}
Correct Answer
(D) 000
[#108] What will be the output of the following C code? #include <stdio.h>
int main()
{
int i = 0, j = 0
while (i < 5, j < 10)
{
i++
j++
}
printf("%d, %d
", i, j)
}
Correct Answer
(C) 10, 10
[#109] What will be the output of the following C code? #include <stdio.h>
void main()
{
int x = 5
if (true)
printf("hello")
}
Correct Answer
(B) It will throw an error
[#110] 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
")
goto l1
}
}
}
Correct Answer
(B) Compilation error