Ask Question
27 February, 16:43

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.

+5
Answers (1)
  1. 27 February, 20:39
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers