Exam 7: Arrays and the Arraylist Class

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

What would be the results of the following code? int[] array1 = new int[25]; … // Code that will put values in array1 Int value = array1[0]; For (int a = 1; a < array1.length; a++) { If (array1[a] < value) Value = array1[a]; }

(Multiple Choice)
4.9/5
(34)

The ArrayList class is in this package.

(Multiple Choice)
4.9/5
(37)

An ArrayList object automatically expands in size to accommodate the items stored in it.

(True/False)
4.8/5
(29)

Given the following two-dimensional array declaration, which statement is true? int [][] numbers = new int [6] [9];

(Multiple Choice)
4.9/5
(32)

If numbers is a two-dimensional int array that has been initialized and total is an int that has been set to 0, which of the following will sum all the elements in the array?

(Multiple Choice)
5.0/5
(28)

What do you call the number that is used as an index to pinpoint a specific element within an array?

(Multiple Choice)
4.9/5
(33)

Given that String[] str has been initialized, to get a copy of str[0] with all characters converted to upper case, use the following statement:

(Multiple Choice)
4.9/5
(35)

When an array of objects is declared, but not initialized, the array values are set to null.

(True/False)
4.8/5
(35)

The String[] args parameter in the main method header allows the program to receive arguments from the operating system command-line.

(True/False)
4.8/5
(33)

What will be the value of x[1] after the following code is executed? int[] x = {22, 33, 44}; ArrayProcess(x); … Public static void arrayProcess(int[] a) { For(int k = 0; k < 3; k++) { A[k] = a[k] + 5; } }

(Multiple Choice)
4.9/5
(42)

In memory, an array of String objects

(Multiple Choice)
4.8/5
(27)

In Java, you do not use the new operator when you use a(n):

(Multiple Choice)
4.8/5
(42)

Which of the following is a correct method header for receiving a two-dimensional array as an argument?

(Multiple Choice)
4.7/5
(34)

What will be the value of x[8] after the following code has been executed? final int SUB = 12; Int[] x = new int[SUB]; Int y = 100; For(int i = 0; i < SUB; i++) { X[i] = y; Y += 10; }

(Multiple Choice)
4.7/5
(35)

An array can hold multiple values of several different data types simultaneously.

(True/False)
4.9/5
(28)

What will be returned from the following method? public static float[] getValue(int x)

(Multiple Choice)
4.9/5
(42)

Which of the following is a correct method header for receiving a two-dimensional array as an argument?

(Multiple Choice)
4.9/5
(36)

Any items typed on the command-line, separated by space, after the name of the class are considered to be one or more arguments that are to be passed into the main method.

(True/False)
4.8/5
(32)

What will be the value of x[8] after the following code has been executed? final int SUB = 12; Int[] x = new int[SUB]; Int y = 20; For(int i = 0; i < SUB; i++) { X[i] = y; Y += 5; }

(Multiple Choice)
4.9/5
(39)

Which of the following is a valid declaration for a ragged array?

(Multiple Choice)
4.8/5
(41)
Showing 21 - 40 of 64
close modal

Filters

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