1. According to the core guidelines, where should you set the default values for member variables in a class?
2. According to the core guidelines, what is a good technique to reduce the number of parameters to a function?
Point
std::pair
3. How do you speed up your compilation using CPU architecture-specific optimizations?
-march
-march=native
-Oarch
4. Which of the following is NOT a difference between enum and enum class?
enum
enum class
int
5. When should you use the override keyword?
override
6. We should always mark a member function as const if it doesn't change the objects value. Which of the following is NOT a reason for this?
7. If two variables are defined as const int * x and int const * y, what is the difference in their types?
const int * x
int const * y
x
y
nullptr
8. What is the difference between default initialization of a variable and value initialization?
9. What is the advantage of using std::make_unique or std::make_shared over constructing your unique/shared pointers directly?
std::make_unique
std::make_shared
10. Andrei Alexandrescu's short string optimization is often given as an example of really clever problem solving. What did he gain when he swapped string size for _remaining_ string size?
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.