Multiple choice technology programming languages

13 Which of the following statements are true?

  1. a. The elements in a Java array can only be of primitive types, not objects

  2. b. Arrays elements are initialized to default values wherever they are created using the keword new

  3. c. An array may be dynamically resized using the setSize method

  4. d. You can find out the size of an array using the size method

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Java arrays of objects are valid (String[], Object[], etc.), contradicting A. Array elements ARE initialized to default values (null for objects, 0 for numbers, false for boolean) when created with 'new' - B is true. Arrays have fixed length and cannot be resized - C is false (no setSize method). Array length is a field 'arr.length', not a method - D is false.