Answer the following statements true (T) or false (F)

a) To refer to a particular location or element within an array, we specify the name of the array and the value of the particular element.
b) An array declaration reserves space for the array.
c) To indicate that 100 locations should be reserved for integer array p, you write the declaration
d) An application that initializes the elements of a 15-element array to zero must contain at least one for statement.
e) An application that totals the elements of a two-dimensional array must contain nested for statements.

a) False. The name of the array and the index are specified. ANS: False. Arrays must be dynamically allocated with new in Java. p[100];
b) False. The correct declaration is int p[] = new int[100];
c) False. Numeric arrays are automatically initialized to zero. Also, a member initializer list can be used.
d) False. It is possible to total the elements of a two-dimensional array with nested while
statements, nested do…while statements or even individual totaling statements.

Computer Science & Information Technology

You might also like to view...

Create focus on slides with large pictures that help the audience relate to the topic

Indicate whether the statement is true or false

Computer Science & Information Technology

A container where files are stored is a

A) folder. B) task pane. C) Ribbon. D) toolbar.

Computer Science & Information Technology