Which statement about C++ references is correct?
Correct answer D. A reference must be initialised when declared and cannot later be made to refer to another object
Subject / 929 questions
Page 6 of Programming multiple-choice questions with answers. Tap an option to check yourself.
Page 6 of 47
Correct answer D. A reference must be initialised when declared and cannot later be made to refer to another object
Correct answer C. Both the if branch and the else branch
Correct answer C. 20 21
Correct answer C. 3 1 3.5
Correct answer D. The number of template arguments in the pack
Correct answer B. It cannot be used for implicit conversions or copy-initialisation
Correct answer C. afp
Correct answer D. ptr
Correct answer B. LRR
Correct answer A. std::string
Correct answer A. operator= (assignment)
Correct answer A. To avoid copying and object slicing so the derived exception's behaviour is preserved
Correct answer C. It throws std::bad_alloc
Correct answer C. public
Correct answer D. That the function must override a base class virtual function, or compilation fails
Correct answer D. A copy constructor and a copy assignment operator
Correct answer A. 15
Correct answer A. It may be defined in several translation units without violating the one-definition rule
Correct answer A. std::deque
Correct answer B. A reference cycle prevents either object being freed; make one link a std::weak_ptr