Multiple Choice Quiz

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?

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?

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?

6. Which of the following is _NOT_ an instance of undefined behavior in C++?

7. Which of the following is a requirement for the source and destination types when using std::bit_cast?

8. A std::shared_ptr can use the same operators as a raw pointer (e.g., * or ->). How is this accomplished?

9. What does overloading operator new and operator delete allow you to do?

10. What happens if you try to use dynamic_cast to convert a pointer, but the cast fails?


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.