Home / CSE MCQs / C-MCQs :: Control Flow Statements

CSE MCQs :: C-MCQs

  1. Which keyword can be used for coming out of recursion?
  2. A.
    break
    B.
    return
    C.
    exit
    D.
    Both (a) and (b)

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. What is the output of this C code?

    int main()
    {
       int a = 0, i = 0, b;
       for (i = 0;i < 5; i++)
      {
         a++;
         continue;
       }
    }
  4. A.
    2
    B.
    3
    C.
    4
    D.
    5

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. What is the output of this C code?

        int main()

        {

            int a = 0, i = 0, b;

            for (i = 0;i < 5; i++)

            {

                a++;

                if (i == 3)

                    break;

            }

        }

  6. A.
    1
    B.
    2
    C.
    3
    D.
    4

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. The keyword 'break' cannot be simply used within:
  8. A.
    do-while
    B.
    if-else
    C.
    for
    D.
    while

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. Which keyword is used to come out of a loop only for that iteration?
  10. A.
    break
    B.
    continue
    C.
    return
    D.
    None of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. What is the output of this C code?

        void main()

        {

            int i = 0, j = 0;

            for (i = 0;i < 5; i++)

            {

                for (j = 0;j < 4; j++)

                {

                    if (i > 1)

                        break;

                }

                printf("Hi \n");

            }

        }

  12. A.
    Hi is printed 5 times
    B.
    Hi is printed 9 times
    C.
    Hi is printed 7 times
    D.
    Hi is printed 4 times

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. What is the output of this C code?


        void main()

        {

            int i = 0;

            int j = 0;

            for (i = 0;i < 5; i++)

            {

                for (j = 0;j < 4; j++)

                {

                    if (i > 1)

                        continue;

                        printf("Hi \n");

                }

            }

        }

  14. A.
    Hi is printed 9 times
    B.
    Hi is printed 8 times
    C.
    Hi is printed 7 times
    D.
    Hi is printed 6 times

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. What is the output of this C code?


        void main()

        {

            int i = 0;

            for (i = 0;i < 5; i++)

                if (i < 4)

                {

                    printf("Hello");

                    break;

                }

        }

  16. A.
    Hello is printed 5 times
    B.
    Hello is printed 4 times
    C.
    Hello
    D.
    Hello is printed 3 times

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. What is the output of this C code?


        void main()

        {

            int i = 0;

            if (i == 0)

            {

                printf("Hello");

                continue;

            }

        }

  18. A.
    Hello is printed infinite times
    B.
    Hello
    C.
    varies
    D.
    Compile time error

    View Answer

    Workspace

    Discuss Discuss in Forum


  19. What is the output of this C code?


        void main()

        {

            int i = 0;

            if (i == 0)

            {

                printf("Hello");

                break;

            }

        }

  20. A.
    Hello is printed infinite times
    B.
    Hello
    C.
    varies
    D.
    compile time error

    View Answer

    Workspace

    Discuss Discuss in Forum