Deck 6: Using Arrays

Full screen (f)
exit full mode
Question
Arrays are useful when you need to store just one value in memory at a time.
Use Space or
up arrow
down arrow
to flip the card.
Question
The ____ operator is used to create objects.

A) new
B) save
C) initialize
D) reserve
Question
When you declare objects, their numeric fields initialize to ____.

A) null
B) '\u0000'
C) 0
D) false
Question
The ____ method arranges array items in ascending order.

A) Reverse()
B) BinarySearch()
C) Order()
D) Sort()
Question
You can assign nondefault values to array elements at declaration by specifying a list of values called a(n) ____.

A) value specification
B) array specification
C) initializer list
D) array initializer
Question
An array subscript can be an expression, as long as the expression evaluates to type ____.

A) int
B) float
C) double
D) boolean
Question
You can easily navigate through arrays using a for or while loop that varies a subscript from 0 to ____.

A) Array.Length - 2
B) Array.Length - 1
C) Array.Length
D) Array.Length + 1
Question
In C#, an array's elements are numbered beginning with 1.
Question
A search in which each array element is examined in order is called a ____ search.

A) sequential
B) parallel
C) binary
D) range match
Question
When you declare objects, their character fields initialize to ____.

A) ' '
B) false
C) 0
D) null
Question
In C#, arrays are objects.
Question
The ____ method can find the array position of a requested value in an array that is sorted with its elements in ascending order.

A) Sort()
B) BinarySearch()
C) Reverse()
D) IndexOf()
Question
When you instantiate an array, you can choose its location in memory.
Question
The power of arrays becomes apparent when you use subscripts that are variables rather than constant values.
Question
When you declare objects, their bool fields initialize to ____.

A) null
B) false
C) true
D) '\u0000'
Question
C# supports a ____ statement that you can use to cycle through every array element without using a subscript.

A) for
B) while
C) do-while
D) foreach
Question
With the foreach statement, you provide a temporary ____ that automatically holds each array value in turn.

A) iteration variable
B) index holder
C) subscript holder
D) iteration holder
Question
You can distinguish each element from the others in an array with a(n) ____.

A) element operator
B) object location
C) element ID
D) subscript
Question
In C#, an array subscript must be type ____.

A) float
B) char
C) int
D) double
Question
In an array that has many possible matches of a search value, the most efficient strategy is to place the ____ items first.

A) lowest
B) most unusual
C) highest
D) most common
Question
When you instantiate an array, you are creating a specific instance of a class that derives from the built-in class named ____________________.
Question
The list of values provided for an array is a(n) ____________________.
Question
A ____ array is a one-dimensional array in which each element is another one-dimensional array and each array can be a different length.

A) rectangular
B) matrix
C) jagged
D) table
Question
How can you assign nondefault values to array elements when the array is declared? Give an example.
Question
Explain how to use a for loop to perform an arithmetic operation on each element in an array.
Question
When using an array in a GUI program, if array values will change based on user input, the array must be ____ any method that reacts to the user's event.

A) stored inside
B) reset to 0 in
C) stored outside
D) redeclared in
Question
The ____________________ property is a member of the System.Array class and automatically holds an array's length.
Question
In a ____ array, each row has the same number of columns.

A) vector
B) rectangular
C) list
D) linear
Question
Briefly describe the Reverse() method.
Question
A(n) ____________________ array has the same number of elements as an existing array and uses the same subscript to access additional information.
Question
Describe the circumstances where you can use the foreach statement.
Question
Explain how to use a for loop to search an array for an exact match.
Question
To use the Sort() method, you pass the array name to ____.

A) List.Sort()
B) Collections.Sort()
C) Array.Sort()
D) Sort.Sort()
Question
A(n) ____________________ is an integer contained within square brackets that indicates the position of one of an array's elements.
Question
Under what circumstances does the BinarySearch() method prove inadequate?
Question
Explain how to assign a value to a specific array element and how to print it.
Question
How can you change the size of an array in C#?
Question
Write a small program that uses the Sort() method to sort an array of names into alphabetical order.
Question
The ____ method does not sort array elements; it only rearranges their positions to the opposite order.

A) BinarySearch()
B) Opposite()
C) Reverse()
D) Order()
Question
An array that you can picture as a column of values, and whose elements you can access using a single subscript, is a ____ array.

A) two-dimensional
B) jagged
C) rectangular
D) single-dimensional
Question
Match between columns
Each object in an array
0
Each object in an array
range match
Each object in an array
Reverse() method
Each object in an array
element 0
Each object in an array
matrix
Each object in an array
array element
Each object in an array
multidimensional array
Each object in an array
subscript
Each object in an array
Length - 1
A term used by mathematicians to refer to a two-dimensional array
0
A term used by mathematicians to refer to a two-dimensional array
range match
A term used by mathematicians to refer to a two-dimensional array
Reverse() method
A term used by mathematicians to refer to a two-dimensional array
element 0
A term used by mathematicians to refer to a two-dimensional array
matrix
A term used by mathematicians to refer to a two-dimensional array
array element
A term used by mathematicians to refer to a two-dimensional array
multidimensional array
A term used by mathematicians to refer to a two-dimensional array
subscript
A term used by mathematicians to refer to a two-dimensional array
Length - 1
Determining the pair of limiting values between which another value falls
0
Determining the pair of limiting values between which another value falls
range match
Determining the pair of limiting values between which another value falls
Reverse() method
Determining the pair of limiting values between which another value falls
element 0
Determining the pair of limiting values between which another value falls
matrix
Determining the pair of limiting values between which another value falls
array element
Determining the pair of limiting values between which another value falls
multidimensional array
Determining the pair of limiting values between which another value falls
subscript
Determining the pair of limiting values between which another value falls
Length - 1
The default value of an array's numeric field
0
The default value of an array's numeric field
range match
The default value of an array's numeric field
Reverse() method
The default value of an array's numeric field
element 0
The default value of an array's numeric field
matrix
The default value of an array's numeric field
array element
The default value of an array's numeric field
multidimensional array
The default value of an array's numeric field
subscript
The default value of an array's numeric field
Length - 1
The index of the last element in an array
0
The index of the last element in an array
range match
The index of the last element in an array
Reverse() method
The index of the last element in an array
element 0
The index of the last element in an array
matrix
The index of the last element in an array
array element
The index of the last element in an array
multidimensional array
The index of the last element in an array
subscript
The index of the last element in an array
Length - 1
Reverses the order of items in an array
0
Reverses the order of items in an array
range match
Reverses the order of items in an array
Reverse() method
Reverses the order of items in an array
element 0
Reverses the order of items in an array
matrix
Reverses the order of items in an array
array element
Reverses the order of items in an array
multidimensional array
Reverses the order of items in an array
subscript
Reverses the order of items in an array
Length - 1
Requires multiple subscripts to access array elements
0
Requires multiple subscripts to access array elements
range match
Requires multiple subscripts to access array elements
Reverse() method
Requires multiple subscripts to access array elements
element 0
Requires multiple subscripts to access array elements
matrix
Requires multiple subscripts to access array elements
array element
Requires multiple subscripts to access array elements
multidimensional array
Requires multiple subscripts to access array elements
subscript
Requires multiple subscripts to access array elements
Length - 1
The first element in an array
0
The first element in an array
range match
The first element in an array
Reverse() method
The first element in an array
element 0
The first element in an array
matrix
The first element in an array
array element
The first element in an array
multidimensional array
The first element in an array
subscript
The first element in an array
Length - 1
Also known as an index
0
Also known as an index
range match
Also known as an index
Reverse() method
Also known as an index
element 0
Also known as an index
matrix
Also known as an index
array element
Also known as an index
multidimensional array
Also known as an index
subscript
Also known as an index
Length - 1
Question
Describe the main characteristics of two-dimensional arrays. How do you access an element in a two-dimensional array? What are some synonyms for a two-dimensional array?
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/42
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 6: Using Arrays
1
Arrays are useful when you need to store just one value in memory at a time.
False
2
The ____ operator is used to create objects.

A) new
B) save
C) initialize
D) reserve
A
3
When you declare objects, their numeric fields initialize to ____.

A) null
B) '\u0000'
C) 0
D) false
C
4
The ____ method arranges array items in ascending order.

A) Reverse()
B) BinarySearch()
C) Order()
D) Sort()
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
5
You can assign nondefault values to array elements at declaration by specifying a list of values called a(n) ____.

A) value specification
B) array specification
C) initializer list
D) array initializer
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
6
An array subscript can be an expression, as long as the expression evaluates to type ____.

A) int
B) float
C) double
D) boolean
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
7
You can easily navigate through arrays using a for or while loop that varies a subscript from 0 to ____.

A) Array.Length - 2
B) Array.Length - 1
C) Array.Length
D) Array.Length + 1
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
8
In C#, an array's elements are numbered beginning with 1.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
9
A search in which each array element is examined in order is called a ____ search.

A) sequential
B) parallel
C) binary
D) range match
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
10
When you declare objects, their character fields initialize to ____.

A) ' '
B) false
C) 0
D) null
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
11
In C#, arrays are objects.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
12
The ____ method can find the array position of a requested value in an array that is sorted with its elements in ascending order.

A) Sort()
B) BinarySearch()
C) Reverse()
D) IndexOf()
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
13
When you instantiate an array, you can choose its location in memory.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
14
The power of arrays becomes apparent when you use subscripts that are variables rather than constant values.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
15
When you declare objects, their bool fields initialize to ____.

A) null
B) false
C) true
D) '\u0000'
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
16
C# supports a ____ statement that you can use to cycle through every array element without using a subscript.

A) for
B) while
C) do-while
D) foreach
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
17
With the foreach statement, you provide a temporary ____ that automatically holds each array value in turn.

A) iteration variable
B) index holder
C) subscript holder
D) iteration holder
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
18
You can distinguish each element from the others in an array with a(n) ____.

A) element operator
B) object location
C) element ID
D) subscript
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
19
In C#, an array subscript must be type ____.

A) float
B) char
C) int
D) double
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
20
In an array that has many possible matches of a search value, the most efficient strategy is to place the ____ items first.

A) lowest
B) most unusual
C) highest
D) most common
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
21
When you instantiate an array, you are creating a specific instance of a class that derives from the built-in class named ____________________.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
22
The list of values provided for an array is a(n) ____________________.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
23
A ____ array is a one-dimensional array in which each element is another one-dimensional array and each array can be a different length.

A) rectangular
B) matrix
C) jagged
D) table
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
24
How can you assign nondefault values to array elements when the array is declared? Give an example.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
25
Explain how to use a for loop to perform an arithmetic operation on each element in an array.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
26
When using an array in a GUI program, if array values will change based on user input, the array must be ____ any method that reacts to the user's event.

A) stored inside
B) reset to 0 in
C) stored outside
D) redeclared in
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
27
The ____________________ property is a member of the System.Array class and automatically holds an array's length.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
28
In a ____ array, each row has the same number of columns.

A) vector
B) rectangular
C) list
D) linear
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
29
Briefly describe the Reverse() method.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
30
A(n) ____________________ array has the same number of elements as an existing array and uses the same subscript to access additional information.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
31
Describe the circumstances where you can use the foreach statement.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
32
Explain how to use a for loop to search an array for an exact match.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
33
To use the Sort() method, you pass the array name to ____.

A) List.Sort()
B) Collections.Sort()
C) Array.Sort()
D) Sort.Sort()
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
34
A(n) ____________________ is an integer contained within square brackets that indicates the position of one of an array's elements.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
35
Under what circumstances does the BinarySearch() method prove inadequate?
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
36
Explain how to assign a value to a specific array element and how to print it.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
37
How can you change the size of an array in C#?
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
38
Write a small program that uses the Sort() method to sort an array of names into alphabetical order.
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
39
The ____ method does not sort array elements; it only rearranges their positions to the opposite order.

A) BinarySearch()
B) Opposite()
C) Reverse()
D) Order()
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
40
An array that you can picture as a column of values, and whose elements you can access using a single subscript, is a ____ array.

A) two-dimensional
B) jagged
C) rectangular
D) single-dimensional
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
41
Match between columns
Each object in an array
0
Each object in an array
range match
Each object in an array
Reverse() method
Each object in an array
element 0
Each object in an array
matrix
Each object in an array
array element
Each object in an array
multidimensional array
Each object in an array
subscript
Each object in an array
Length - 1
A term used by mathematicians to refer to a two-dimensional array
0
A term used by mathematicians to refer to a two-dimensional array
range match
A term used by mathematicians to refer to a two-dimensional array
Reverse() method
A term used by mathematicians to refer to a two-dimensional array
element 0
A term used by mathematicians to refer to a two-dimensional array
matrix
A term used by mathematicians to refer to a two-dimensional array
array element
A term used by mathematicians to refer to a two-dimensional array
multidimensional array
A term used by mathematicians to refer to a two-dimensional array
subscript
A term used by mathematicians to refer to a two-dimensional array
Length - 1
Determining the pair of limiting values between which another value falls
0
Determining the pair of limiting values between which another value falls
range match
Determining the pair of limiting values between which another value falls
Reverse() method
Determining the pair of limiting values between which another value falls
element 0
Determining the pair of limiting values between which another value falls
matrix
Determining the pair of limiting values between which another value falls
array element
Determining the pair of limiting values between which another value falls
multidimensional array
Determining the pair of limiting values between which another value falls
subscript
Determining the pair of limiting values between which another value falls
Length - 1
The default value of an array's numeric field
0
The default value of an array's numeric field
range match
The default value of an array's numeric field
Reverse() method
The default value of an array's numeric field
element 0
The default value of an array's numeric field
matrix
The default value of an array's numeric field
array element
The default value of an array's numeric field
multidimensional array
The default value of an array's numeric field
subscript
The default value of an array's numeric field
Length - 1
The index of the last element in an array
0
The index of the last element in an array
range match
The index of the last element in an array
Reverse() method
The index of the last element in an array
element 0
The index of the last element in an array
matrix
The index of the last element in an array
array element
The index of the last element in an array
multidimensional array
The index of the last element in an array
subscript
The index of the last element in an array
Length - 1
Reverses the order of items in an array
0
Reverses the order of items in an array
range match
Reverses the order of items in an array
Reverse() method
Reverses the order of items in an array
element 0
Reverses the order of items in an array
matrix
Reverses the order of items in an array
array element
Reverses the order of items in an array
multidimensional array
Reverses the order of items in an array
subscript
Reverses the order of items in an array
Length - 1
Requires multiple subscripts to access array elements
0
Requires multiple subscripts to access array elements
range match
Requires multiple subscripts to access array elements
Reverse() method
Requires multiple subscripts to access array elements
element 0
Requires multiple subscripts to access array elements
matrix
Requires multiple subscripts to access array elements
array element
Requires multiple subscripts to access array elements
multidimensional array
Requires multiple subscripts to access array elements
subscript
Requires multiple subscripts to access array elements
Length - 1
The first element in an array
0
The first element in an array
range match
The first element in an array
Reverse() method
The first element in an array
element 0
The first element in an array
matrix
The first element in an array
array element
The first element in an array
multidimensional array
The first element in an array
subscript
The first element in an array
Length - 1
Also known as an index
0
Also known as an index
range match
Also known as an index
Reverse() method
Also known as an index
element 0
Also known as an index
matrix
Also known as an index
array element
Also known as an index
multidimensional array
Also known as an index
subscript
Also known as an index
Length - 1
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
42
Describe the main characteristics of two-dimensional arrays. How do you access an element in a two-dimensional array? What are some synonyms for a two-dimensional array?
Unlock Deck
Unlock for access to all 42 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 42 flashcards in this deck.