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

CSE MCQs :: C++ - MCQs

  1. The constants are also called as
  2. A.
    const
    B.
    preprocessor
    C.
    literals
    D.
    none of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. What are the parts of the literal constants?
  4. A.
    integer numerals
    B.
    floating-point numerals
    C.
    strings and boolean values
    D.
    all of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. How the constants are declared?
  6. A.
    const keyword
    B.
    #define preprocessor
    C.
    both a and b
    D.
    None of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. What is the output of this program?

    #include

    using namespace std;

    int main()

    {

    int  const  p = 5;

    cout << ++p;

    return 0;

    }

  8. A.
    5
    B.
    6
    C.
    Error
    D.
    None of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. What is the output of this program?

    #include < iostream >

    using namespace std;

    #define PI 3.14159

    int main ()

    {

    float r = 2;

    float circle;

    circle = 2 * PI * r;

    cout << circle;

    return 0;

    }


  10. A.
    12.566
    B.
    13.566
    C.
    10
    D.
    compile time error

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. Which of the following statement is true about preprocessor directives?
  12. A.
    hese are lines read and processed by the preprocessor
    B.
    They do not produce any code by themselves
    C.
    These must be written on their own line
    D.
    They end with a semicolon

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. Regarding following statement which of the statements is true?

         const int a = 100;

  14. A.
    Declares a variable a with 100 as its initial value
    B.
    Declares a construction a with 100 as its initial value
    C.
    Declares a constant a whose value will be 100
    D.
    Constructs an integer type variable with a as identifier and 100 as value

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. The difference between x and 'x' is
  16. A.
    The first one refers to a variable whose identifier is x and the second one refers to the character constant x
    B.
    The first one is a character constant x and second one is the string literal x
    C.
    Both are same
    D.
    None of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. How to declare a wide character in string literal?
  18. A.
    L prefix
    B.
    l prefix
    C.
    W prefix
    D.
    none of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum