Home / CSE MCQs / C-MCQs :: Variable Names

CSE MCQs :: C-MCQs

  1. What is the output of this C code?

    int main()
    {
    printf("Hello World! %d \n", x);
    return 0;
    }
  2. A.
    Hello World! x;
    B.
    Hello World! followed by a junk value
    C.
    Compile time error
    D.
    Hello World!

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. What is the output of this C code?

    int main()
    {
    int y = 10000;
    int y = 34;
    printf("Hello World! %d\n", y);
    return 0;
    }
  4. A.
    Compile time error
    B.
    Hello World! 34

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. Which of the following is not a valid variable name declaration?
  6. A.
    float PI = 3.14;
    B.
    double PI = 3.14;
    C.
    int PI = 3.14;
    D.
    #define PI 3.14

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. What will happen if the below program is executed?

    int main()
    {
    int main = 3;
    printf("%d", main);
    return 0;
    }
  8. A.
    It will cause a compile-time error
    B.
    It will cause a run-time error
    C.
    It will run without any error and prints 3
    D.
    It will experience infinite looping

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. What is the problem in following variable declaration?
          float 3Bedroom-Hall-Kitchen?;
  10. A.
    The variable name begins with an integer
    B.
    The special character '-'
    C.
    The special character '?'
    D.
    All of the mentioned.

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. Which of the following cannot be a variable name in C?
  12. A.
    Volatile
    B.
    True
    C.
    friend
    D.
    export

    View Answer

    Workspace

    Discuss Discuss in Forum