C++ Interview Question 9 Answer

Bjarne-stroustrup
 

Answer

This question is compilable and deterministic.

Its output is “428”.

Explanation

When f() is called with a as both parameters, both arguments refer to the same variable. This is known as aliasing. First, a is set to 3, then a is set to 4, then 4+4 is returned. b is never modified.

SOURCE