Home / CSE MCQs / C-MCQs :: Constants - C

CSE MCQs :: C-MCQs

  1. What is the output of this C code?

    int main()
    {
    enum {ORANGE = 12, MANGO, BANANA = 11, APPLE};
    printf("APPLE = %d\n", APPLE);
    }
  2. A.
    APPLE= 11
    B.
    APPLE= 12
    C.
    APPLE= 23
    D.
    APPLE= 0

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. What is the output of this C code?

    int main()
    {
    printf("C programming %s", "Class by\n%s AllIndiaExams", "SUPER");
    }
  4. A.
    C programming Class by SUPER AllIndiaExams
    B.
    C programming Class by\n%s AllIndiaExams
    C.
    C programming Class by %s AllIndiaExams
    D.
    Compilation error

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. For the following code snippet:
    char *str = "AllIndiaExams.in\0? "training classes;
    The character pointer str holds reference to string:
  6. A.
    AllIndiaExams.in
    B.
    AllIndiaExams.in training classes
    C.
    AllIndiaExams.in\0training classes
    D.
    Syntax error

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. What is the output of this C code?

    #define a 20
    int main()
    {
    const int a = 50;
    printf("a = %d\n", a);
    }
  8. A.
    a = 50
    B.
    a = 20
    C.
    Run time error
    D.
    Compilation Error

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. What is the output of this C code?

    int main()
    {
    int var = 010;
    printf("%d", var);
    }
  10. A.
    2
    B.
    8
    C.
    9
    D.
    10

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. enum types are processed by?
  12. A.
    Compiler
    B.
    Preprocessor
    C.
    Linker
    D.
    Assembler

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. What is the output of this C code?

    int main()
    {
    printf("AllIndiaExams\r\nclass\n");
    return 0;
    }
  14. A.
    AllIndiaExamsclass
    B.
    AllIndiaExams
          class
    C.
    classundry
    D.
    AllIndiaExams

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. What is the output of this C code?

    int main()
    {
    const int a;
    a = 32;
    printf("a is %d", a);
    return 0;
    }
  16. A.
    a is 32
    B.
    Compile time error
    C.
    Run time error
    D.
    none

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. Which is false?
  18. A.
    Constant variables need not be defined as they are declared and can be defined later
    B.
    Global constant variables are initialised to zero
    C.
    const keyword is used to define constant values
    D.
    You cannot reassign a value to a constant variable

    View Answer

    Workspace

    Discuss Discuss in Forum


  19. Whats is the output of this C code?

    void main()
    {
    int const k = 11;
    k++;
    printf("k is %d", k);
    }
  20. A.
    k is 12
    B.
    Error because const and int are used together
    C.
    garbage value
    D.
    Error, because a constant variable cannot be changed

    View Answer

    Workspace

    Discuss Discuss in Forum