Exam 6: Arrays and Arraylists

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Assume array items contains the integer values 0, 2, 4, 6 and 8. Which of the following uses the enhanced for loop to display each value in array items?

Free
(Multiple Choice)
4.9/5
(32)
Correct Answer:
Verified

C

Consider array items, which contains the values 0, 2, 4, 6 and 8. If method changeArray is called with the method call changeArray(items, items[2]), what values are stored in items after the method has finished executing? Public static void changeArray(int[] passedArray, int value) { PassedArray[value] = 12; Value = 5; }

Free
(Multiple Choice)
4.9/5
(38)
Correct Answer:
Verified

D

Which method call converts the value in variable stringVariable to an integer?

Free
(Multiple Choice)
4.9/5
(32)
Correct Answer:
Verified

C

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

(Multiple Choice)
4.9/5
(33)

Which of the following statements is false?

(Multiple Choice)
4.8/5
(29)

Which statement below initializes array items to contain 3 rows and 2 columns?

(Multiple Choice)
4.8/5
(33)

Consider the class below: Public class Test { Public static void main(String[] args) { Int[] a = {99, 22, 11, 3, 11, 55, 44, 88, 2, -3}; Int result = 0; For (int i = 0; i < A.length; i++) { If (a[i] > 30) Result += a[i]; } System.out.printf("Result is: %d%n", result); } } The output of this Java program will be:

(Multiple Choice)
4.9/5
(36)

Which command below runs TestProgram, and passes in the values files.txt and 3?

(Multiple Choice)
4.9/5
(35)

In Java, multidimensional arrays ________.

(Multiple Choice)
4.9/5
(37)

The preferred way to traverse a two-dimensional array is to use .

(Multiple Choice)
4.9/5
(36)

Which of the following statements is false?

(Multiple Choice)
5.0/5
(38)

Class Arrays methods sort, binarySearch, equals and fill are overloaded for primitive-type arrays and Object arrays. In addition, methods __________ and __________ are overloaded with generic versions.

(Multiple Choice)
4.8/5
(31)

Reference-type variables (called references) store ________ in memory.

(Multiple Choice)
4.9/5
(37)

Which of the following initializer lists would correctly set the elements of array n?

(Multiple Choice)
4.8/5
(36)

Types in Java are divided into two categories. The primitive types are boolean, byte, char, short, int, long, float and double. All other types are ________ types.

(Multiple Choice)
4.8/5
(35)

A(n) ________ indicates a problem that occurs while a program executes.

(Multiple Choice)
4.8/5
(46)

Consider the code segment below. Which of the following statements is false? Int[] g; G = new int[23];

(Multiple Choice)
5.0/5
(41)

For the array that was the correct answer in the previous question, what is the value returned by items[1][0]?

(Multiple Choice)
4.7/5
(40)

Which set of statements totals the items in each row of two-dimensional array items, and displays each row's total?

(Multiple Choice)
4.8/5
(32)

When you pass an array or an individual array element of a reference type to a method, the called method receives ________. When you pass an individual element of a primitive type, the called method receives ________.

(Multiple Choice)
4.9/5
(36)
Showing 1 - 20 of 48
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)