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

CSE MCQs :: C-MCQs

  1. Which part of the program address space is p stored in the code given below?

        int *p = NULL;
        int main()
        {
            int i = 0;
            p = &i;
            return 0;
        }
  2. A.
    Code/text segment
    B.
    Data segment
    C.
    Bss segment
    D.
    Stack

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. Which part of the program address space is p stored in the code given below?

        int *p;
        int main()
        {
            int i = 0;
            p = &i;
            return 0;
        }
  4. A.
    Code/text segment
    B.
    Data segment
    C.
    Bss segment
    D.
    Stack

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. Property of external variable to be accessed by any source file is called by C90 standard as:
  6. A.
    external linkage
    B.
    external scope
    C.
    global scope
    D.
    global linkage

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. What is the output of this C code?

        int *i;
        int main()
        {
            if (i == NULL)
                printf("true\n");
            return 0;
        }
  8. A.
    true
    B.
    true only if NULL value is 0
    C.
    Compile time error
    D.
    Nothing

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. What is the output of this C code?

        int *i;
        int main()
        {
            if (i == 0)
                printf("true\n");
            return 0;
        }
  10. A.
    true
    B.
    true only if NULL value is 0
    C.
    Compile time error
    D.
    Nothing

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. What is the output of this C code?

        void main()
        {
            m();
            m();
        }
        void m()
        {
            static int x = 5;
            x++;
            printf("%d", x);
        }
  12. A.
    6   7
    B.
    6   6
    C.
    5   5
    D.
    5   6

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. What is the output of this C code?

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

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. Which of following is not accepted in C?
  16. A.
    static a = 10; //static as
    B.
    static int func (int); //parameter as static
    C.
    static static int a; //a static variable prefixed with static
    D.
    All of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. Which of the following cannot be static in C?
  18. A.
    Variables
    B.
    Functions
    C.
    Structures
    D.
    None of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  19. The scope of an automatic variable is:
  20. A.
    Within the block it appears
    B.
    Within the blocks of the block it appears
    C.
    Until the end of program
    D.
    Both (a) and (b)

    View Answer

    Workspace

    Discuss Discuss in Forum