a and b are shadowed in the foo function so the function only acts on the shadowed (and copied) variables. Once you return from foo, the const a and b are unchanged.
Not a great question as a pass or fail test imho because if you use shadowed names often enough to be able to parse this code in your head, you’re writing bad code. There is a reason why shadowing names is a bad practice: it’s hard to figure out what the end result is and account for side effects! But as a discussion on all the points above then it would teach the recruiter something about what the candidate knows rather than using this as a trivia question.