Answer This question is compilable and deterministic. Its output is "abcBCA". Explanation §3.6.2¶4 in the standard: "It is implementation
Continue ReadingC++ Interview Question 12 Answer
Answer This question is compilable and deterministic. Its output is "acbBCA". Explanation §3.6.2¶4 in the standard: "It is implementation
Continue ReadingC++ Interview Question 11 Answer
Answer This question is compilable and deterministic. Its output is "0". Explanation Since a is a static local variable, it is automatically
Continue ReadingC++ Interview Question 10 Answer
Answer This question is compilable and deterministic. Its output is "0". Explanation Since a has static storage duration and no initializer,
Continue ReadingC++ Interview Question 9 Answer
Answer This question is compilable and deterministic. Its output is "428". Explanation When f() is called with a as both parameters, both ar
Continue ReadingC++ Interview Question 8 Answer
Answer This question is compilable and deterministic. Its output is "A". Explanation g(A a) takes an object of type A by value, not by refer
Continue ReadingC++ Interview Question 7 Answer
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 Reading