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

CSE MCQs :: C-MCQs

  1. What is the output of this C code?

    void m()
    {
    printf("hi");
    }
    void main()
    {
    m();
    }
  2. A.
    hi
    B.
    Run time error
    C.
    Nothing
    D.
    Varies

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. What is the output of this C code?

    void m();
    void n()
    {
    m();
    }
    void main()
    {
    void m()
    {
    printf("hi");
    }
    }
  4. A.
    hi
    B.
    Compile time error
    C.
    Nothing
    D.
    Varies

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. What is the output of this C code?

        void main()
        {
            m();
            void m()
            {
                printf("hi");
            }
        }

  6. A.
    hi
    B.
    Compile time error
    C.
    Nothing
    D.
    Varies

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. What is the output of this C code?

        void main()
        {
            m();
        }
        void m()
        {
            printf("hi");
            m();
        }


  8. A.
    Compile time error
    B.
    hi
    C.
    Infinite hi
    D.
    Nothing

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. What is the output of this C code?

        void main()
        {
            static int x = 3;
            x++;
            if (x <= 5)
            {
                printf("hi");
                main();
            }
        }
  10. A.
    Run time error
    B.
    hi
    C.
    infinite hi
    D.
    hi  hi

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. Which of the following is a correct format for declaration of function?
  12. A.
    return-type function-name(argument type);
    B.
    return-type function-name(argument type) {}
    C.
    return-type (argument type)function-name;
    D.
    Both (a) and (b)

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. Which of the following function declaration is illegal?
  14. A.
    int 1bhk(int);
    B.
    int 1bhk(int a);
    C.
    int 2bhk(int*, int []);
    D.
    All of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. Which function definition will run correctly?
  16. A.
    int sum(int a, int b)
       return (a + b);
    B.
    int sum(int a, int b)
        {return (a + b);}
    C.
    int sum(a, b)
         return (a + b);
    D.
    Both (a) and (b)

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. Can we use a function as a parameter of another function? [ Eg: void wow(int func()) ]
  18. A.
    Yes, and we can use the function value conveniently
    B.
    Yes, but we call the function again to get the value, not as convenient as in using variable
    C.
    No, C does not support it.
    D.
    This case is compiler dependent

    View Answer

    Workspace

    Discuss Discuss in Forum


  19. The value obtained in the function is given back to main by using ________ keyword?
  20. A.
    return
    B.
    static
    C.
    new
    D.
    volatile

    View Answer

    Workspace

    Discuss Discuss in Forum