Exam 9: Advanced Array Concepts

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

int[][] myVals = {{2, 4, 6, 8},                   {20, 40, 60, 80} }; Using the above two-dimensional array, what is the value of myVals[1][2] ?

(Multiple Choice)
4.9/5
(44)

double[][] empSales = new double[5][]; The above statement declares a(n) ____ array.

(Multiple Choice)
4.8/5
(31)

In Java, you create an enumerated data type in a statement that uses the keyword ____.

(Multiple Choice)
4.8/5
(43)

Programmers often refer to a ____ search as a "divide and conquer" procedure.

(Multiple Choice)
4.9/5
(38)

Which of the following describes a data type for which only appropriate behaviors are allowed?

(Multiple Choice)
4.7/5
(36)

The ArrayList class ____ method returns the current ArrayList size.

(Multiple Choice)
4.8/5
(47)

How would you create an array named someNumbers that holds three rows and four columns?

(Multiple Choice)
4.8/5
(38)

Write the statement to declare a three-by-four array of integers with the elements initialized to zero. Name the array myArray .

(Short Answer)
4.8/5
(32)
Match each term with the correct statement below.
Premises:
Two-dimensional array
Responses:
two-dimensional array
Enumerated data type
multidimensional array
Correct Answer:
Verified
Premises:
Responses:
Two-dimensional array
two-dimensional array
(Matching)
4.7/5
(31)

The  Arrays  class ____ method assigns the specified value to each element of the specified array.

(Multiple Choice)
4.9/5
(47)

import java.util.*; public class myArray {     public static void main(String[] args)     {       int myVals = new int[4];       -----Code here-----       display("My values are: ", myVals);     }     public static void display(String message, int array[])     {        int arraySize = array.length;        System.out.print(message);        for(int x = 0; x < arraySize; ++x)           System.out.print(array[x] + " ");     } } Using the above code, complete the indicated section with a fill method() to fill each array element with a value of 2. What will be displayed after the display() method is executed?

(Essay)
4.8/5
(53)

enum Color {RED, GREEN, BLUE} public class EnumOrdinal {     public static void main(String[] args)    {      ---Code here---      ---Code here---      ---Code here---     } } The above code demonstrates the use of the enum ordinal() method to get the ordinal value of an enum constant. Fill in the indicated lines with println() statements that will get the ordinal of the enumeration constant. Describe the output that will display when the code is executed.

(Essay)
4.9/5
(42)

When you pass a two-dimensional array to a method, you pass the array name just as you do with a one-dimensional array.

(True/False)
4.8/5
(44)
Match each term with the correct statement below.
Premises:
Two or more columns of values
Responses:
set() method
bubble sort
dynamically resizable
Correct Answer:
Verified
Premises:
Responses:
Two or more columns of values
set() method
(Matching)
4.8/5
(42)

When working with two-dimensional arrays, the length field holds the number of rows in an array and each row has a length field that holds the number of columns in the row.

(True/False)
4.9/5
(49)
Match each term with the correct statement below.
Premises:
Alters an item at a specified ArrayList location
Responses:
java.util
fill() method
Enumerated data type
Correct Answer:
Verified
Premises:
Responses:
Alters an item at a specified ArrayList location
java.util
(Matching)
4.9/5
(31)

int[][] studentScores = {{70, 82, 90, 68}, {95, 75, 67, 89}, {98, 79, 57, 81}}; Using the above two-dimensional array, what is the value of studentScores[0][0] ? What is the value of studentScores[2][3] ? What is the value of studentScores[1][2] ? Describe how arrays reference values with subscripts.

(Essay)
4.7/5
(34)

A method that receives a two-dimensional array uses two ____ pairs following the data type in the parameter list of the method header.

(Multiple Choice)
4.9/5
(44)

An ArrayList 's ____ is the number of items it can hold without having to increase its size.

(Multiple Choice)
4.7/5
(42)

Since the ArrayList class is part of the java.util package, you can use the java.util.*; import statement to access it.

(True/False)
4.7/5
(37)
Showing 61 - 80 of 80
close modal

Filters

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