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?
- A.
In C++, both static and dynamic type checking are allowed.
- B.
In C++, member functions are allowed to be of type const.
- C.
In C++, dynamic checking is allowed.
- D.
More than one of the above
- E.
None of the above
Attempted by 111 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.