Loops


  1. What will be the output of the following C code?
    #include <stdio.h>
    void main()
    {
    int n = 5, L;
    if (n == 5)
    goto Read;
    Read: printf("%d ", n);
    printf("Interview Mania");
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    5 Interview Mania


  1. goto can be used to jump from main() to within a function.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    false



  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    printf("Ajit ");
    goto Label1;
    printf("Abhay ");
    Label1:goto Label2;
    printf("Sumi ");
    Label2:printf("Imroj ");
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Ajit Imroj


  1. What will be the output of the following C code?
     #include <stdio.h>
    int main()
    {
    int k = 0, L = 0;
    while (Level1: k < 5)
    {
    k++;
    while (L < 6)
    {
    printf("Interveiw Maina\n");
    goto Level1;
    }
    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Compilation Error

    main.c: In function ‘main’:
    main.c:5:16: error: ‘Level1’ undeclared (first use in this function)
    while (Level1: k < 5)
    ^~~~~~
    main.c:5:16: note: each undeclared identifier is reported only once for each function it appears in
    main.c:5:22: error: expected ‘)’ before ‘:’ token
    while (Level1: k < 5)
    ^
    main.c:11:17: error: label ‘Level1’ used but not defined
    goto Level1;



  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    printf("Krishna ");
    goto Label;
    printf("Imroj ");
    }
    void fun()
    {
    Label: printf("Abhay ");
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Compilation Error

    main.c: In function ‘main’:
    main.c:5:9: error: label ‘Label’ used but not defined
    goto Label;