Deck 6: Using Arrays
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Match between columns
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/42
Play
Full screen (f)
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) 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
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()
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
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
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
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
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
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()
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'
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
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
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
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
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
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
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
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
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()
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()
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
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
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