1. Which of the following is NOT a difference between deterministic problems in your code and non-deterministic problems?
2. What happens if you use const_cast to cast away the constness of an object that was originally defined as const and then modify it?
const_cast
const
3. Assume our API specifies the following integer exponentiation function declaration, and we have been asked to test it (this is a raised to the b power): int Exponentiate(int a, int b); Assuming the function declaration will not change, which of the following is not a useful test case?
a
b
REQUIRE(Exponentiate(-1, 3) == -1);
REQUIRE(Exponentiate(3, 0) == 1);
REQUIRE(Exponentiate(2, -1) == 0.5);
REQUIRE(Exponentiate(2, 3) == 8);
REQUIRE(Exponentiate(3, 2) == 9);
4. Which of the following is NOT a productive development practice for preventing bugs in your code?
5. Why should you use std::make_unique instead of new when constructing a unique_ptr?
std::make_unique
new
unique_ptr
6. Which of the following is _NOT_ an instance of undefined behavior in C++?
std::vector
7. Which of the following is a requirement for the source and destination types when using std::bit_cast?
std::bit_cast
8. A std::shared_ptr can use the same operators as a raw pointer (e.g., * or ->). How is this accomplished?
std::shared_ptr
*
->
shared_ptr
9. What does overloading operator new and operator delete allow you to do?
operator new
operator delete
delete
10. What happens if you try to use dynamic_cast to convert a pointer, but the cast fails?
dynamic_cast
Click Check Answers to identify any errors and try again. Click Show Answers if you also want to know which answer is the correct one.