Computer Applications
State the number of bytes and bits occupied by a character array of 20 elements.
Java Arrays
5 Likes
Answer
A char data type occupies 2 bytes in memory.
Total memory occupied by an array of 20 elements = 2 x 20 = 40 bytes.
Since 1 byte = 8 bits, memory occupied by an array of 20 elements = 40 x 8 = 320 bits.
Answered By
3 Likes
Related Questions
Assertion (A) The private access specifier achieves the lowest level of accessibility.
Reason (R) The private methods and fields can be accessed only within the same class to which the methods and fields belong.- Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of Assertion (A).
- Both Assertion (A) and Reason (R) are true and Reason (R) is not a correct explanation of Assertion (A).
- Assertion (A) is true and Reason (R) is false.
- Assertion (A) is false and Reason (R) is true.
State the data type after the following is executed :
char ch = '9'; res = Character.isDigit(ch);
- int
- char
- string
- boolean
If
String x = "Computer"; String y = "Science";
What will the following return?
(a) System.out.print(x.substring(2,6));
(b) System.out.print(x.indexOf(x.charAt(5)));
Write the Java statement for the following mathematical expression :
x =