Which of the following statements is correct about the C++ programming language?

2023

Which of the following statements is correct about the C++ programming language?

Answer: D. More than one of the aboveStep 1: Examine each statement individually. Step 2: "Both static and dynamic type checking are allowed" is true — C++ checks types at compile time (static)…

  1. A.

    In C++, both static and dynamic type checking are allowed.

  2. B.

    In C++, member functions are allowed to be of type const.

  3. C.

    In C++, dynamic checking is allowed.

  4. D.

    More than one of the above

  5. E.

    None of the above

Attempted by 229 students.

Show answer & explanation

Correct answer: D

Step 1: Examine each statement individually. Step 2: "Both static and dynamic type checking are allowed" is true — C++ checks types at compile time (static) and also supports run-time type checking through virtual functions, RTTI and dynamic_cast (dynamic). Step 3: "Member functions are allowed to be of type const" is true — a non-static member function can be declared const so that it does not modify the object's state. Step 4: "Dynamic checking is allowed" is true on its own, for the same run-time mechanisms noted in Step 2. Step 5: Since more than one of the listed statements is individually correct, the right answer is the option stating that more than one of the above is correct.

Explore the full course: Bpsc

Loading lesson…