Ask Question
23 August, 19:13

Which of the following statements about creating arrays and initializing their elements is false?

a. The new keyword should be used to create an array.

b. When an array is created, the number of elements must be placed in square brackets following the type of element being stored.

c. The elements of an array of integers have a value of null before they are initialized.

d. A for loop is commonly used to set the values of the elements of an array.

+4
Answers (1)
  1. 23 August, 21:40
    0
    b. When an array is created, the number of elements must be placed in square brackets following the type of element being stored.

    Explanation:

    In Java an uninitialized array contains null values. Thus statement c is true as well.

    Also generally for initializing and displaying array elements a for loop is used. Hence statement d is also correct.

    In Java syntax for declaring an array is as follows:

    Array declaration:

    type [] array_name;

    Array instantiation (memory allocation):

    type [] array_name = new array_name [size of array];

    From the above it can be seen that the statement a is true and statement b is false as number of elements in array are not mentioned after the type.

    Hence the correct answer is b.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Which of the following statements about creating arrays and initializing their elements is false? a. The new keyword should be used to ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers