Home / CSE MCQs / C-MCQs :: C Functions

CSE MCQs :: C-MCQs

  1. What is the output of this C code?

    int main()
    {
    void foo(), f();
    f();
    }
    void foo()
    {
    printf("2 ");
    }
    void f()
    {
    printf("1 ");
    foo();
    }
  2. A.
    Compile time error as foo is local to main
    B.
    1   2
    C.
    2   1
    D.
    Compile time error due to declaration of functions inside main

  3. What is the output of this C code?

    int main()
    {
    void foo();
    void f()
    {
    foo();
    }
    f();
    }
    void foo()
    {
    printf("2 ");
    }
  4. A.
    2   2
    B.
    2
    C.
    Compile time error
    D.
    Depends on the compiler

  5. What is the output of this C code?

    void foo();
    int main()
    {
    void foo();
    foo();
    return 0;
    }
    void foo()
    {
    printf("2 ");
    }
  6. A.
    Compile time error
    B.
    2
    C.
    Depends on the compiler
    D.
    Depends on the standard

  7. What is the output of this C code?

    void foo();
    int main()
    {
    void foo(int);
    foo(1);
    return 0;
    }
    void foo(int i)
    {
    printf("2 ");
    }
  8. A.
    2
    B.
    Compile time error
    C.
    Depends on the compiler
    D.
    Depends on the standard

  9. What is the output of this C code?

    void foo();
    int main()
    {
    void foo(int);
    foo();
    return 0;
    }
    void foo()
    {
    printf("2 ");
    }
  10. A.
    2
    B.
    Compile time error
    C.
    Depends on the compiler
    D.
    Depends on the standard

  11. What is the output of this C code?

    int main()
    {
    void foo(), f();
    f();
    }
    void foo()
    {
    printf("2 ");
    }
    void f()
    {
    printf("1 ");
    foo();
    }
  12. A.
    Compile time error as foo is local to main
    B.
    1   2
    C.
    2   1
    D.
    Compile time error due to declaration of functions inside main

  13. What is the output of this C code?

    int main()
    {
    void foo();
    void f()
    {
    foo();
    }
    f();
    }
    void foo()
    {
    printf("2 ");
    }
  14. A.
    2   2
    B.
    2
    C.
    Compile time error
    D.
    Depends on the compiler

  15. What is the output of this C code?

    void foo();
    int main()
    {
    void foo();
    foo();
    return 0;
    }
    void foo()
    {
    printf("2 ");
    }
  16. A.
    Compile time error
    B.
    2
    C.
    Depends on the compiler
    D.
    Depends on the standard

  17. What is the output of this C code?

    void foo();
    int main()
    {
    void foo(int);
    foo(1);
    return 0;
    }
    void foo(int i)
    {
    printf("2 ");
    }
  18. A.
    2
    B.
    Compile time error
    C.
    Depends on the compiler
    D.
    Depends on the standard

  19. What is the output of this C code?

    void foo();
    int main()
    {
    void foo(int);
    foo();
    return 0;
    }
    void foo()
    {
    printf("2 ");
    }
  20. A.
    2
    B.
    Compile time error
    C.
    Depends on the compiler
    D.
    Depends on the standard