1. Which C++ Commonplace did add in-class default member initializers?
2. Can you utilize auto
sort deduction for non-static information members?
3. Do you want to outline a static inline
information member in a cpp
file?
4. Can a static inline
variable be non-constant?
5. What is the output of the next code:
struct S {
int a { 10 };
int b { 42 };
};
S s { 1 };
std::cout << s.a << ", " << s.b;
6. Contemplate the next code:
struct C {
C(int x) : a(x) { }
int a { 10 };
int b { 42 };
};
C c(0);
Choose the true assertion:
7. What occurs whenever you throw an exception from a constructor?
8. What occurs whenever you compile this code?
struct Level { int x; int y; };
Level pt {.y = 10, .x = 11 };
std::cout << pt.x << ", " << pt.y;
9. Will this code work in C++11?
struct Person { std::string title = "unknown"; unsigned age { 0 }; };
Person u { "John", 101 };
10. Assume you’ve a std::map<string, int> m;
. Choose the one true assertion concerning the following loop:
for (const pair<string, int>& elem : m)