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

CSE MCQs :: C-MCQs

  1. What is the output of this C code?

        double foo();
        int main()
        {
            foo();
            return 0;
        }
        foo()
        {
            printf("2 ");
            return 2;
        }

  2. A.
    2
    B.
    Compile time error
    C.
    Depends on the compiler
    D.
    Depends on the standard

  3. functions can return structure in c?
  4. A.
    true
    B.
    false
    C.
    Depends on the compiler
    D.
    Depends on the standard

  5. functions can return enumeration constants in c?
  6. A.
    true
    B.
    false
    C.
    depends on the compiler
    D.
    depends on the standard

  7. What is the output of this C code?

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

  9. What is the output of this C code?

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

  11. Functions in C are ALWAYS:
  12. A.
    Internal
    B.
    External
    C.
    Both Internal and External
    D.
    External and Internal are not valid terms for functions

  13. Global variables are:
  14. A.
    Internal
    B.
    External
    C.
    Both (a) and (b)
    D.
    None of the mentioned.

  15. Which of the following are an external variable?

        int func (int a)
        {
            int b;
            return b;
        }
        int main()
        {
            int c;
            func (c);
        }
        int d;

  16. A.
    a
    B.
    b
    C.
    c
    D.
    d

  17. What will be the output?

        int main()
        {
            printf("%d", d++);
        }
        int d = 10;

  18. A.
    9
    B.
    10
    C.
    11
    D.
    Compile time error

  19. What will be the output?

        double var = 8;
        int main()
        {
            int var = 5;
            printf("%d", var);
        }
  20. A.
    5
    B.
    8
    C.
    Compile time error due to wrong format identifier for double
    D.
    Compile time error due to redeclaration of variable with same name