Loops


  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    int k = 0, L = 0;
    while (k < 10, L < 15)
    {
    k++;
    L++;
    }
    printf("%d, %d\n", k, L);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    15, 15


  1. Which loop is most suitable to first perform the operation and then test the condition?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    do-while loop



  1. Which keyword can be used for coming out of recursion?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    return


  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



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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    10