int x = 98; char ch = (char)x; what is the value in ch?

ICSE Class 10 Computer Applications PYQ · 2024 Paper · Section A

1(ii)1 Mark · 2024 · Section A · 2024 Paper

int x = 98; char ch = (char)x; what is the value in ch?

Show SolutionHide Solution↓

b

Reason — In Java, when an int value is cast to char, it is converted based on the ASCII code. Since, 98 is the ASCII code of the letter b, hence value of ch is 'b'.

← Previous questionNext question →

Browse the free Computer Applications sample bank