Answer This question is compilable and deterministic. Its output is "A". Explanation As long as A::f() is not virtual, A::f() will always be
Continue ReadingC++ Interview Question 6 Answer
Answer This question is compilable and deterministic. Its output is "012012". Explanation Whether you post-increment or pre-increment i, its
Continue ReadingC++ Interview Question 5 Answer
Answer This question is compilable and deterministic. Its output is "BA". Explanation The initialization order of member variables is determ
Continue ReadingC++ Interview Question 4 Answer
Answer This question is compilable and deterministic. Its output is "21". Explanation The type of a floating point literal is double. SOU
Continue ReadingC++ Interview Question 3 Answer
Answer This question has a compilation error. Explanation This overload is ambiguous. Why? There are two viable functions for the call f(-2.
Continue ReadingC++ Interview Question 2 Answer
Answer This question is compilable and deterministic. Its output is "22". Explanation A string literal is not a std::string, but a const cha
Continue ReadingC++ Interview Question 1 Answer
Answer This question is compilable and deterministic. Its output is "1". Explanation The templated function will be instantiated as void f(i
Continue Reading