Exam 9: Advanced Array Concepts

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags
Match each term with the correct statement below.
Alters an item at a specified ArrayList location
java.util
Two or more columns of values
add() method
A programmer-created data type with a fixed set of values
static methods
Correct Answer:
Verified
Premises:
Responses:
Alters an item at a specified ArrayList location
java.util
Two or more columns of values
add() method
A programmer-created data type with a fixed set of values
static methods
Adds an item to the end of an ArrayList
Enumerated data type
Arrays with more than one dimension; allowed in Java
bubble sort
Use them with the class name without instantiating an object
set() method
A popularly known sorting method
two-dimensional array
A two-dimensional array that has rows of different lengths
ragged array
A package containing the Arrays class
multidimensional array
(Matching)
4.8/5
(29)

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

(Multiple Choice)
4.8/5
(39)

The ArrayList class ____ method removes an item from an ArrayList at a specified location.

(Multiple Choice)
4.9/5
(30)

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

(Multiple Choice)
4.9/5
(37)

What is the advantage of declaring an ArrayList with a specified type?

(Essay)
4.8/5
(43)

Write the statement to declare an ArrayList named myVals with a capacity of 15 items. Explain the importance of capacity when working with an ArrayList .

(Essay)
4.9/5
(42)

What are some of the advantages of creating an enumeration type?

(Essay)
4.9/5
(42)

Which Java statement creates a ragged array with six rows?

(Multiple Choice)
4.9/5
(29)

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.7/5
(29)

Write the code for bubble sorting a someNums array of integers.

(Essay)
4.8/5
(41)

How can you use the length field with a two-dimensional array? Show an example two-dimensional array declaration and provide the length values for the example array.

(Essay)
4.8/5
(29)

The bubble sort is the fastest and most efficient sorting technique.

(True/False)
4.7/5
(28)

The simplest possible sort involves two values that are out of order.

(True/False)
4.7/5
(31)

Regarding enumerations, the ____ method returns an integer that represents the constant's position in the list of constants; as with arrays, the first position is 0.

(Multiple Choice)
4.7/5
(44)

How can you sort arrays of objects?

(Essay)
4.8/5
(30)

import java.util.*; public class sortArray {      public static void main(String[] args)     {        double[] lengths = {120.0, 0.5, 0.0, 999.0, 77.3};        Arrays.sort(lengths);          System.out.println(Arrays.toString(lengths));     } } Using the above code, what will be the output of the println statement when the code is executed?

(Essay)
4.8/5
(36)

The negative integer returned by the binarySearch() method when the value is not found is the negative equivalent of the array ____.

(Multiple Choice)
4.8/5
(43)

____ is the process of arranging a series of objects in some logical order.

(Multiple Choice)
5.0/5
(30)

The Arrays class ____ methods are a new feature in Java 8 that makes sorting more efficient when thousands or millions of objects need to be sorted.

(Multiple Choice)
4.7/5
(33)

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

(Multiple Choice)
4.8/5
(40)
Showing 41 - 60 of 66
close modal

Filters

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