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

CSE MCQs :: C-MCQs

  1. Which of the following storage class supports char data type?
  2. A.
    register
    B.
    static
    C.
    auto
    D.
    All of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. The variable declaration with no storage class specified is by default:
  4. A.
    auto
    B.
    extern
    C.
    static
    D.
    register

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. What is the output of this C code?

        int x = 5;
        void main()
        {
            int x = 3;
            printf("%d", x);
            {
                x = 4;
            }
            printf("%d", x);
        }
  6. A.
    Run time error
    B.
    3   3
    C.
    3   5
    D.
    3   4

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. What is the scope of an external variable?
  8. A.
    Whole source file in which it is defined
    B.
    From the point of declaration to the end of the file in which it is defined
    C.
    Any source file in a program
    D.
    From the point of declaration to the end of the file being compiled

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. What is the scope of a function?
  10. A.
    Whole source file in which it is defined
    B.
    From the point of declaration to the end of the file in which it is defined
    C.
    Any source file in a program
    D.
    From the point of declaration to the end of the file being compiled

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. Which variable has the longest scope?

        int b;
        int main()
        {
            int c;
            return 0;
        }
        int a;
  12. A.
    a
    B.
    b
    C.
    c
    D.
    Both (a) and (b)

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. Array sizes are optional during array declaration by using ______ keyword.
  14. A.
    auto
    B.
    static
    C.
    extern
    D.
    register

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. What is the output of this C code?


        int x = 5;
        void main()
        {
            int x = 3;
            m();
            printf("%d", x);
        }
        void m()
        {
            x = 8;
            n();
        }
        void n()
        {
            printf("%d", x);
        }

  16. A.
    8   3
    B.
    8   5
    C.
    3   8
    D.
    5   3

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. What is the output of this C code?


        void main()
        {
            m();
            m();
        }
        void m()
        {
            static int x = 5;
            x++;
            printf("%d", x);
        }

  18. A.
    6   7
    B.
    6   6
    C.
    5   5
    D.
    5   6

    View Answer

    Workspace

    Discuss Discuss in Forum


  19. What is the output of this C code?

        void main()
        {
            static int x;
            if (x++ < 2)
            main();
        }
  20. A.
    Infinite calls to main
    B.
    Run time error
    C.
    Varies
    D.
    main is called twice

    View Answer

    Workspace

    Discuss Discuss in Forum