employer cover photo
employer logo
employer logo

Tata Consultancy Services

Part of Tata Group

Is this your company?

Tata Consultancy Services Interview Question

If a = 6 Evaluate expression a++ + ++a + a++ + ++a

Interview Answer

Anonymous

Oct 11, 2018

32 (There are two pre increment operators, so before the expression is evaluated, "a" will be incremented twice, so a = 8 then expression is evaluated to 32 then "a" will be incremented twice again after evaluation of expression due to two post increment operators, so a = 10)