Loops
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
printf("Hello ");
goto Level1;
printf("Hey ");
Level1:goto Level2;
printf("Welcome");
Level2:printf("Interview Mania");
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
Hello Interview Mania
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
printf("Interview");
continue;
printf(" Mania");
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Compilation Error
main.c: In function ‘main’:
main.c:5:9: error: continue statement not within a loop
continue;
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int k = 0;
char ch = 'U';
while (k < 2)
{
k++;
switch (ch)
{
case 'U':
printf("%c ", ch);
break;
break;
}
}
printf("\nInterview Mania");
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
U U
Interview Mania
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int k = 0;
while (k < 5)
{
if (k == 2)
break;
k++;
if (k == 2)
continue;
printf("Interview Mania In while loop\n");
}
printf("Interview Mania After loop\n");
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Interview Mania In while loop
Interview Mania After loop
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int k = 0, L = 0;
for (k; k < 3; k++)
{
for (L = 0; L < 5; L++)
{
printf("Interview\n");
break;
}
printf("Mania\n");
}
printf("Interview Mania\n");
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Interview
Mania
Interview
Mania
Interview
Mania
Interview Mania