Q: What is the numerical range of a byte data type in Java?
-
A
-128 to 127
-
B
0 to 255
-
C
-32768 to 32767
-
D
0 to 65535
A
Answer:
A
Explanation:
The byte data type in Java is an 8-bit signed integer that can represent values ranging from -128 to 127. This range allows the byte type to efficiently store small integer values within a compact memory space. The lower bound (-128) represents the smallest value that can be stored in a byte, while the upper bound (127) represents the largest value. This makes the byte type suitable for conserving memory when working with large arrays or collections of small integers where the full range of a larger integer type is unnecessary.
Related Topic:
Share Above MCQ