Loops


  1. What will be the output of the following C code?
    #include <stdio.h>
    void main()
    {
    int k = 0;
    while (++k)
    {
    printf("Interview Mania");
    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    "Interview Mania" infinite times


  1. What will be the output of the following C code?
    #include <stdio.h>
    void main()
    {
    int k = 1;
    do
    {
    printf("Interview Mania");
    } while (k != 1);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    "Interview Mania" one time



  1. What will be the output of the following C code?
    #include <stdio.h>
    void main()
    {
    char *S = "";
    do
    {
    printf("Krishana");
    } while (S);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    "Krishana" infinite times


  1. What will be the output of the following C code?
    #include <stdio.h>
    void main()
    {
    int k = 0;
    while (k < 3)
    {
    k++;
    printf("Hello\n");
    while (k < 5)
    {
    k++;
    printf("Interview Mania\n");
    }
    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Hello is printed 1 times, Interview Mania 4 times



  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    int p = 0, k = 0, q = 1;
    for (k = 0; k < 10; k++)
    {
    p++;
    q++;
    continue;
    }
    printf("%d, %d", p, q);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    10, 11