Computer Science · Java Programming
What is the output produced by the following Java code segment? int a = 4; int b = a; int c = b; a = a + 1; b = b + 2; c = c + 3; b = a; a = b; System.out.println('a: ' + a + ' b: ' + b + ' c: ' + c);
- 1a: 5 b: 5 c: 7✓
- 2a: 5 b: 5 c: 5
- 3a: 7 b: 7 c: 7
- 4a: 6 b: 5 c: 7
Correct answer
a: 5 b: 5 c: 7
Download Single Question PDF
Save this question and verified answer as a clean study sheet with live clickable link.
Share with Friends & Study Groups
Challenge your peer aspirants on WhatsApp or Telegram to solve this question!
Preparing for Computer Science?
Practice full-length mock tests with real exam timers, instant score analysis, and all-India ranking.
Want more practice questions on Java Programming?
Solve complete topic-wise tests with detailed solutions on GkGet.
Related Practice Questions
Recommended practice questions in Computer Science · Java Programming