Placement Papers — Cognizant Questions
TCS, Infosys, Wipro, Cognizant actual papers
Showing 1–1 of 1 questions
in Cognizant Questions
What will be the output? int x = 5; System.out.println(++x + x++);
Correct Answer:
B. 12
EXPLANATION
++x increments x to 6 first, then x++ uses 6 and increments to 7. So 6 + 6 = 12