choose the correct answer 1 When making an array of objects

choose the correct answer:

1. When making an array of objects (say, Oranges), what is an appropriate consideration?

a. The Oranges will automatically have defaults if we write a default constructor

b. We need to instantiate the Orange objects, and should write a for loop to do so for safety reasons

c. Arrays of objects have been deprecated in Java, in favor of using lists of objects

d. We cannot make arrays of objects

2. Why should we always use the current row\'s length in a 2D array when processing columns?

a. It is the Java standard

b. Arrays can be ragged, which means row lengths do not have to match each other

c. Not doing so breaks Java compilation rules and is a syntax error

d. We don\'t have to - this question is lying

4. In a worst case scenario, how many steps does the Sequential Search algorithm take?

a. Always, precisely, 42

b. It takes as half as many steps as there are elements in the array

c. It takes as many steps as there are elements in the array

d. We cannot answer this question without more information

a. The Oranges will automatically have defaults if we write a default constructor

b. We need to instantiate the Orange objects, and should write a for loop to do so for safety reasons

c. Arrays of objects have been deprecated in Java, in favor of using lists of objects

d. We cannot make arrays of objects

Solution

1. option (a) is correct i.e., The Oranges will automatically have defaults if we write a default constructor.

2. option (b) is correct i.e.,  Arrays can be ragged, which means row lengths do not have to match each other.

3. option (c) is correct i.e., It takes as many steps as there are elements in the array or we can say O(n).

choose the correct answer: 1. When making an array of objects (say, Oranges), what is an appropriate consideration? a. The Oranges will automatically have defau

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site