What is the result of using const_cast to remove const and then modifying an object that was originally defined as const?
Correct answer B. Undefined behaviour
Subject / 929 questions
Page 7 of Programming multiple-choice questions with answers. Tap an option to check yourself.
Page 7 of 47
Correct answer B. Undefined behaviour
Correct answer D. 12
Correct answer B. DCD
Correct answer B. Ba
Correct answer D. 11
Correct answer C. void f(int a = 1, int b);
Correct answer A. 30
Correct answer A. const data members and reference members
Correct answer C. By using virtual inheritance for the common base class
Correct answer A. std::sort needs random-access iterators but std::list provides only bidirectional iterators
Correct answer A. 1
Correct answer A. BC
Correct answer B. 8
Correct answer C. It rethrows the exception currently being handled
Correct answer D. std::initializer_list<int>
Correct answer D. 30 20 40
Correct answer B. std::terminate is called
Correct answer D. A constexpr variable must be initialised with a constant expression evaluated at compile time
Correct answer C. When the class declares any constructor of its own
Correct answer B. std::terminate is called, which by default aborts the program