wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Java 2 Quiz 9

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.
____ is the process of arranging a series of objects in some logical order.
a)
Passing
b)
Organizing
c)
Sorting
d)
Sending
2.
In a(n) ____, you repeatedly compare pairs of items, swapping them if they are out of order, eventually creating a sorted list.
a)
range match
b)
bubble sort
c)
enhanced for loop
d)
A.float sort
3.
An array that you can picture as a column of values, and whose elements you can access using one subscript, is a ____ array.
a)
single-dimensional
b)
two-dimensional
c)
parallel
d)
column
4.
When mathematicians use a two-dimensional array, they often call it a ____.
a)
grid
b)
net
c)
matrix
d)
mesh
5.
How would you create an array named someNumbers that holds three rows and four columns?
a)
int[ ][ ] someNumbers = new int[4][3]
b)
int[ ][ ] someNumbers = new int[3][4]
c)
int[ ] someNumbers = new int[3][4]
d)
double[ ][ ] someNumbers = new int[3][4]
6.
To declare a two-dimensional array in Java, you type two sets of ____ after the array type
a)
{ }
b)
[ ]
c)
( )
d)
< >
7.
With a two-dimensional array, the ____ field holds the number of rows in the array.
a)
size
b)
capacity
c)
row
d)
length
8.
Which Java statement creates a ragged array with six rows?
a)
double [ ][ ] sales = new double[6][4]
b)
double [ ][ ] sales = new double[4][6]
c)
A.double [ ][ ] sales = new double[6][ ]
d)
A.double [ ][ ] sales = new double[ ][6]
9.
The Arrays class ____ method puts a particular value in each element of the array.
a)
binarySearch
b)
fill
c)
equals
d)
search
10.
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
a)
compare
b)
equals
c)
parallelSort
d)
fill
11.
The negative integer returned by the binarySearch() method when the value is not found is the negative equivalent of the array ____.
a)
type
b)
size
c)
scope
d)
length
12.
Programmers often refer to a ____ search as a “divide and conquer” procedure.
a)
binary
b)
bubble
c)
division
d)
split
13.
You can add an item at any point in a(n) ____ container and the array size expands automatically to accommodate the new item.
a)
Array
b)
ArrayList
c)
ResizableArray
d)
array
14.
An ArrayList’s ____ is the number of items it can hold without having to increase its size.
a)
length
b)
buffer
c)
size
d)
capacity
15.
The ArrayList class ____ method removes an item from an ArrayList at a specified location
a)
delete
b)
get
c)
erase
d)
remove
16.
The ArrayList class ____ method retrieves an item from a specified location in an ArrayList.
a)
extract
b)
get
c)
peek
d)
retrieve
17.
The ArrayList class ____ method returns the current ArrayList size.
a)
size
b)
capacity
c)
length
d)
rows
18.
In Java, you create an enumerated data type in a statement that uses the keyword ____.
a)
new
b)
sequence
c)
collection
d)
enum
19.
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.
a)
valueAt
b)
positionOf
c)
positionOf
d)
indexOf
20.
Regarding enumerations, the ____ method returns the name of the calling constant object.
a)
toString
b)
constName
c)
ordinal
d)
nameOf