Short answerEasy2 marks
State the number of bytes occupied by char and int data types.
Topic: Size of data types
Previous-year question practice database
Answer
Exam answer
char = 2 bytes int = 4 bytes
Explanation
char occupies 2 bytes in Java, not 1 as in C or C++, because Java stores Unicode rather than plain ASCII — that is worth adding as the reason. Learn the full table: byte 1, short 2, int 4, long 8, float 4, double 8, char 2, boolean 1. Watch the unit in the question. If it asks for BITS, multiply by 8 — so char would be 16 bits.
More from Revision Tour I
The full form of JVM is:2026Which of the following occupies 2 bytes of storage?2026In a statement c = c + (x * d + e); which variable is an accumulator?2026Assertion (A): The result of the Java expression 3 + 7/2 is 6.
Reason (R): According to the hierarchy of operators in Java, addition is done first followed by division.2026Evaluate the Java expression:
x = a * b % (++c) + (++a) + (--b);
if a = 7, b = 8, c = 22026System.out.println('Z' + 32); will display:2025