Deck 7: Arrays and Lists

Full screen (f)
exit full mode
Question
Which one of the following declaration statements is not a value type?

A) decimal grossPay = 0.0m;
B) int playerScore = 0;
C) bool qualify = false;
D) Random rand = new Random();
Use Space or
up arrow
down arrow
to flip the card.
Question
Which one of the following statements assigns the value 40 to the first element in an array of integers named values?

A) values[-1] = 40;
B) values[0] = 40;
C) values[null] = 40;
D) values[1] = 40;
Question
A(n) ____________ is a special value that links a variable to an object.

A) linker
B) reference
C) operator
D) delimiter
Question
A(n) ____________ is an object that can hold a group of values that must all be the same data type.

A) matrix
B) Collection
C) array
D) container
Question
The ____________ creates an object in memory and returns a reference to that object.

A) .NET Framework
B) new operator
C) = operator
D) % operator
Question
An array's____________ indicates the number of values that the array should be able to hold.

A) reference variable
B) size declarator
C) element
D) subscript
Question
A variable that is used to reference an object is commonly called a(n) ____________.

A) reference variable
B) object variable
C) class variable
D) Boolean variable
Question
When a(n) ____________ variable is declared, the compiler sets aside, or allocates, a chunk of memory big enough to hold the variable's data.

A) reference type
B) uninitialized
C) value type
D) dynamic type
Question
Of the following statements, which one correctly initializes an int array named quarters with the values 1, 2, 3, and 4?

A) const int SIZE = 4; int[] quarters = new int[SIZE] { 1, 2, 3, 4 };
B) int[] quarters = new int[] { 1, 2, 3, 4 };
C) int[] quarters = { 1, 2, 3, 4 };
D) All of these statements are correct.
Question
Look at the following code sample: const int SIZE = 10;
Int[] values = new int[SIZE];
For (int index = 0; index < SIZE; index++)
{
Values[index] = index + 1;
}
When the loop is finished stepping through the values array, what value will be stored in values[0]?

A) 10
B) 11
C) 0
D) 1
Question
When you create a numeric array in C#, what default value is assigned to its elements?

A) null
B) 0
C) 255
D) −1
Question
The storage locations in an array are known as ____________.

A) values
B) sectors
C) compartments
D) elements
Question
Which one of the following assignment statements associates an int array, that can hold 12 integers, with a reference variable named scores?

A) scores = new int[12];
B) int[12] = new scores;
C) int scores[12];
D) new int scores[12]
Question
When you create an array, you can optionally initialize it with a collection of values called a(n) ____________.

A) initialization list
B) default group
C) element assembly
D) starting run
Question
It is preferred practice to use a(n) ____________ as an array's size declarator.

A) variable
B) literal value
C) named constant
D) object
Question
Which one of the following statements correctly declares a reference variable named values that can be used to reference an array of int?

A) int values[];
B) values[int];
C) int[] values;
D) int [values];
Question
What special value are the elements of an array of reference type objects equal to by default?

A) 0
B) void
C) −1
D) null
Question
Each element in an array is identified by a unique number known as a(n) ____________.

A) subscript
B) identifier
C) delimiter
D) vector
Question
When working with an array, it is important that you do not use a(n)____________.

A) invalid subscript
B) null value
C) assignment statement
D) initialization list
Question
Which one of the following statements is not a valid array declaration?

A) double[] parsecs = new double[10];
B) decimal[] sales = new decimal[24.5m];
C) string[] cities = new decimal[50];
D) int[] quarters = new int[4];
Question
C# provides a special loop known as the ____________, that automatically iterates once for each element in the array.

A) do-while loop
B) foreach loop
C) for loop
D) while loop
Question
A(n) ____________ occurs when a loop iterates one time too many or one time too few.

A) off-by-one error
B) buffer overrun
C) system crash
D) logic error
Question
____________ is a process that runs automatically in the background from time to time, removing all unreferenced objects from memory.

A) System cleanup
B) Garbage collection
C) Nullification
D) Non-maskable Interrupt
Question
The ____________ algorithm is much more efficient than a sequential search when the data set is very large.

A) random search
B) quick sort
C) binary search
D) combinatorial search
Question
When you process a(n) ____________, you must process only elements containing valid items.

A) partially filled array
B) reference copy
C) sequential search
D) Boolean expression
Question
Because arrays are always passed ____________, a method that receives an array as an argument has access to the actual array.

A) by value
B) globally
C) in memory
D) by reference
Question
Various techniques known as ____________ have been developed to locate a specific item in a larger collection of data, such as an array.

A) search engine schematics
B) search algorithms
C) database logic
D) search protocols
Question
When only a reference to an object is copied rather than the object's contents, the copy is called a(n) ____________.

A) shallow copy
B) memory copy
C) value copy
D) reference copy
Question
When calling a method and passing an array variable as an argument, the variable contains a ____________ to the array.

A) variable
B) value
C) reference
D) parameter
Question
With what value should the accumulator variable be initialized to calculate the total of all values in a numeric array?

A) null
B) false
C) 0
D) −1
Question
To compare the contents of two arrays, you must compare each of the ____________ in the two arrays.

A) memory locations
B) reference variables
C) elements
D) size
Question
To declare a two-dimensional array, two ____________ are required: The first one is for the number of rows, and the second one is for the number of columns.

A) reference variables
B) Boolean variables
C) named constants
D) size declarators
Question
The foreach loop is designed to work with a temporary, read-only variable known as the ____________.

A) loop variable
B) counter variable
C) iteration variable
D) foreach variable
Question
____________ arrays, also known as 2D arrays, can hold two sets of data.

A) Double-data
B) Two-dimensional
C) Row-column
D) Duel-derivative
Question
To successfully ____________ the contents of two variables, we need a third variable that can serve as a temporary storage location.

A) copy
B) exchange
C) reference
D) remove
Question
The ____________ works like this: The smallest value in the array is located and moved to element 0. The next smallest value is located and moved to element 1. This process continues until all the elements have been placed in their proper order.

A) bubble sort
B) binary search
C) Boolean swap
D) selection sort
Question
Look at the following code sample: int[] numbers = { 1, 2, 3, 4, 5 };
Int highest = numbers[0];
For (int index = 1; index < numbers.Length; index++)
{
If (numbers[index] > highest)
{
Highest = numbers[index];
}
}
What value will the highest variable contain when the loop finishes?

A) 1
B) 3
C) 5
D) 15
Question
____________ arrays can only hold one set of data.

A) One-dimensional
B) Two-dimensional
C) Data bound
D) Classical
Question
In C#, all arrays have a(n) ____________ that equals the number of elements in the array.

A) Element property
B) getSize method
C) Length property
D) GetBounds method
Question
The ____________ uses a loop to step through the elements in an an array one by one, from the first to the last.

A) sequential search algorithm
B) optimized search algorithm
C) binary search algorithm
D) basic array traversal algorithm
Question
A List object has a(n) ____________ that holds the number of items stored in the List.

A) Count property
B) Total property
C) Length property
D) Size property
Question
If you want to take out all items from a List object, call the ____________ method.

A) Clear
B) Reset
C) ClearAll
D) ReDim
Question
You can use the ____________ to take out an item at a specific index in a List.

A) Delete method
B) RemoveAt method
C) DeleteAt method
D) EraseAt method
Question
You can call the ____________ method to insert an item at a specific index position in a List object.

A) Put
B) Add
C) Insert
D) Place
Question
Memory allocated for a reference type variable is the actual location that will hold any value assigned to the variable.
Question
Look at the following code sample: int[,] values = { { 1, 2, 3, 4 },
{ 5, 6, 7, 8 } };
What is the value stored in values[1, 2]?

A) 2
B) 3
C) 6
D) 7
Question
Reference variables can only reference objects.
Question
Which one of the following statements correctly creates a List object named friendsList that holds strings?

A) string friendsList = new List;
B) friendsList(string);
C) List friendsList = new List;
D) List friendsList = new List();
Question
A(n) ____________ is similar to an array, but it can expand at runtime.

A) List object
B) sequential object
C) Random object
D) jagged array
Question
If you know the value of the item you want to take out from a List object, but you do not know the item's index, you can use the ____________.

A) - (minus) operator
B) Erase method
C) Remove method
D) Delete method
Question
A(n) ____________ is similar to a two-dimensional array, but the rows can have a different number of columns.

A) offset array
B) skewed array
C) jagged array
D) differential array
Question
Data types in C# − and the underlying .NET Framework − fall into two categories: value types and reference types.
Question
List objects, like arrays, are always passed to methods ____________.

A) by value
B) in memory
C) by reference
D) globally
Question
Look at the following code sample: const int ROWS = 2;
Const int COLS = 2;
Int[,] grid = new int[ROWS, COLS];
What is the total number of elements in the grid array?

A) 2
B) 4
C) 8
D) 16
Question
You can store a variety of data types in an array.
Question
Creating a reference type object typically requires the following two steps, which can optionally be coded in a single program statement:
1. Declare a reference variable.
2. Create an object and associate it with the reference variable.
Question
Look at the following code sample: const int ROWS = 8;
Const int COLS = 2;
Int[,] table = new int[ROWS, COLS];
Which one of the following statements stores the value 25 in the element located at the first row and second column of the table array?

A) table[1, 2] = 25;
B) table[0, 1] = 25;
C) table[2, 1] = 25;
D) table[1, 0] = 25;
Question
Because variables hold only single values, they can be cumbersome in programs that process lists of data.
Question
Traditional two-dimensional arrays, where each row has the same number of columns, are sometime referred to as ____________.

A) square arrays
B) rectangular arrays
C) box arrays
D) 2D arrays
Question
To add items to an existing List object, use the ____________.

A) += operator
B) & operator
C) Insert property
D) Add method
Question
When working with an array, you cannot use a subscript that is less than 0 or greater than the array size minus 1.
Question
Because the foreach loop automatically knows the number of elements in an array, you do not have to use a counter variable to control its iterations, as you would with a regular for loop.
Question
You can create an array to hold any single type of value.
Question
The default value of a string array's elements is null.
Question
Arrays are reference type objects.
Question
The sequential search algorithm is the simplest of all array searching algorithms.
Question
You access the individual elements in an array using their subscripts.
Question
An array's size declarator must be a nonnegative integer value.
Question
Because subscript numbering starts at 0, the subscript of the last element in an array is 1 less than the total number of elements in the array.
Question
When you use either the ref or out keywords before an array parameter, the receiving method does not automatically make a local copy of the array.
Question
The first element in an array is assigned subscript 1, the second element is assigned subscript 2, and so on.
Question
When reading the contents of a file into an array, your loop should always iterate until the array is full.
Question
To write the contents of an array to a file, open the file and use a loop to step through each array element, writing it to the file. Then close the file.
Question
The ref keyword creates an object in memory and returns a reference to the object it creates.
Question
Because array subscripts start at 1 rather than 0, you are not as likely to perform an off-by-one error.
Question
Arrays are always passed by value when passed as method arguments.
Question
If you provide an initialization list when declaring an array, you can leave out the size declarator, but you cannot leave out the new operator and its subsequent expression.
Question
You cannot reassign an array reference variable to a different array.
Question
When processing the contents of an array, the foreach loop does not provide a variable that can be used as an array subscript.
Question
An array's Length property is read-only, so you cannot change its value by trying to assign a new value to Length.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/99
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 7: Arrays and Lists
1
Which one of the following declaration statements is not a value type?

A) decimal grossPay = 0.0m;
B) int playerScore = 0;
C) bool qualify = false;
D) Random rand = new Random();
D
2
Which one of the following statements assigns the value 40 to the first element in an array of integers named values?

A) values[-1] = 40;
B) values[0] = 40;
C) values[null] = 40;
D) values[1] = 40;
B
3
A(n) ____________ is a special value that links a variable to an object.

A) linker
B) reference
C) operator
D) delimiter
B
4
A(n) ____________ is an object that can hold a group of values that must all be the same data type.

A) matrix
B) Collection
C) array
D) container
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
5
The ____________ creates an object in memory and returns a reference to that object.

A) .NET Framework
B) new operator
C) = operator
D) % operator
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
6
An array's____________ indicates the number of values that the array should be able to hold.

A) reference variable
B) size declarator
C) element
D) subscript
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
7
A variable that is used to reference an object is commonly called a(n) ____________.

A) reference variable
B) object variable
C) class variable
D) Boolean variable
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
8
When a(n) ____________ variable is declared, the compiler sets aside, or allocates, a chunk of memory big enough to hold the variable's data.

A) reference type
B) uninitialized
C) value type
D) dynamic type
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
9
Of the following statements, which one correctly initializes an int array named quarters with the values 1, 2, 3, and 4?

A) const int SIZE = 4; int[] quarters = new int[SIZE] { 1, 2, 3, 4 };
B) int[] quarters = new int[] { 1, 2, 3, 4 };
C) int[] quarters = { 1, 2, 3, 4 };
D) All of these statements are correct.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
10
Look at the following code sample: const int SIZE = 10;
Int[] values = new int[SIZE];
For (int index = 0; index < SIZE; index++)
{
Values[index] = index + 1;
}
When the loop is finished stepping through the values array, what value will be stored in values[0]?

A) 10
B) 11
C) 0
D) 1
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
11
When you create a numeric array in C#, what default value is assigned to its elements?

A) null
B) 0
C) 255
D) −1
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
12
The storage locations in an array are known as ____________.

A) values
B) sectors
C) compartments
D) elements
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
13
Which one of the following assignment statements associates an int array, that can hold 12 integers, with a reference variable named scores?

A) scores = new int[12];
B) int[12] = new scores;
C) int scores[12];
D) new int scores[12]
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
14
When you create an array, you can optionally initialize it with a collection of values called a(n) ____________.

A) initialization list
B) default group
C) element assembly
D) starting run
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
15
It is preferred practice to use a(n) ____________ as an array's size declarator.

A) variable
B) literal value
C) named constant
D) object
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
16
Which one of the following statements correctly declares a reference variable named values that can be used to reference an array of int?

A) int values[];
B) values[int];
C) int[] values;
D) int [values];
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
17
What special value are the elements of an array of reference type objects equal to by default?

A) 0
B) void
C) −1
D) null
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
18
Each element in an array is identified by a unique number known as a(n) ____________.

A) subscript
B) identifier
C) delimiter
D) vector
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
19
When working with an array, it is important that you do not use a(n)____________.

A) invalid subscript
B) null value
C) assignment statement
D) initialization list
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
20
Which one of the following statements is not a valid array declaration?

A) double[] parsecs = new double[10];
B) decimal[] sales = new decimal[24.5m];
C) string[] cities = new decimal[50];
D) int[] quarters = new int[4];
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
21
C# provides a special loop known as the ____________, that automatically iterates once for each element in the array.

A) do-while loop
B) foreach loop
C) for loop
D) while loop
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
22
A(n) ____________ occurs when a loop iterates one time too many or one time too few.

A) off-by-one error
B) buffer overrun
C) system crash
D) logic error
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
23
____________ is a process that runs automatically in the background from time to time, removing all unreferenced objects from memory.

A) System cleanup
B) Garbage collection
C) Nullification
D) Non-maskable Interrupt
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
24
The ____________ algorithm is much more efficient than a sequential search when the data set is very large.

A) random search
B) quick sort
C) binary search
D) combinatorial search
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
25
When you process a(n) ____________, you must process only elements containing valid items.

A) partially filled array
B) reference copy
C) sequential search
D) Boolean expression
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
26
Because arrays are always passed ____________, a method that receives an array as an argument has access to the actual array.

A) by value
B) globally
C) in memory
D) by reference
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
27
Various techniques known as ____________ have been developed to locate a specific item in a larger collection of data, such as an array.

A) search engine schematics
B) search algorithms
C) database logic
D) search protocols
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
28
When only a reference to an object is copied rather than the object's contents, the copy is called a(n) ____________.

A) shallow copy
B) memory copy
C) value copy
D) reference copy
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
29
When calling a method and passing an array variable as an argument, the variable contains a ____________ to the array.

A) variable
B) value
C) reference
D) parameter
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
30
With what value should the accumulator variable be initialized to calculate the total of all values in a numeric array?

A) null
B) false
C) 0
D) −1
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
31
To compare the contents of two arrays, you must compare each of the ____________ in the two arrays.

A) memory locations
B) reference variables
C) elements
D) size
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
32
To declare a two-dimensional array, two ____________ are required: The first one is for the number of rows, and the second one is for the number of columns.

A) reference variables
B) Boolean variables
C) named constants
D) size declarators
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
33
The foreach loop is designed to work with a temporary, read-only variable known as the ____________.

A) loop variable
B) counter variable
C) iteration variable
D) foreach variable
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
34
____________ arrays, also known as 2D arrays, can hold two sets of data.

A) Double-data
B) Two-dimensional
C) Row-column
D) Duel-derivative
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
35
To successfully ____________ the contents of two variables, we need a third variable that can serve as a temporary storage location.

A) copy
B) exchange
C) reference
D) remove
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
36
The ____________ works like this: The smallest value in the array is located and moved to element 0. The next smallest value is located and moved to element 1. This process continues until all the elements have been placed in their proper order.

A) bubble sort
B) binary search
C) Boolean swap
D) selection sort
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
37
Look at the following code sample: int[] numbers = { 1, 2, 3, 4, 5 };
Int highest = numbers[0];
For (int index = 1; index < numbers.Length; index++)
{
If (numbers[index] > highest)
{
Highest = numbers[index];
}
}
What value will the highest variable contain when the loop finishes?

A) 1
B) 3
C) 5
D) 15
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
38
____________ arrays can only hold one set of data.

A) One-dimensional
B) Two-dimensional
C) Data bound
D) Classical
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
39
In C#, all arrays have a(n) ____________ that equals the number of elements in the array.

A) Element property
B) getSize method
C) Length property
D) GetBounds method
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
40
The ____________ uses a loop to step through the elements in an an array one by one, from the first to the last.

A) sequential search algorithm
B) optimized search algorithm
C) binary search algorithm
D) basic array traversal algorithm
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
41
A List object has a(n) ____________ that holds the number of items stored in the List.

A) Count property
B) Total property
C) Length property
D) Size property
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
42
If you want to take out all items from a List object, call the ____________ method.

A) Clear
B) Reset
C) ClearAll
D) ReDim
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
43
You can use the ____________ to take out an item at a specific index in a List.

A) Delete method
B) RemoveAt method
C) DeleteAt method
D) EraseAt method
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
44
You can call the ____________ method to insert an item at a specific index position in a List object.

A) Put
B) Add
C) Insert
D) Place
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
45
Memory allocated for a reference type variable is the actual location that will hold any value assigned to the variable.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
46
Look at the following code sample: int[,] values = { { 1, 2, 3, 4 },
{ 5, 6, 7, 8 } };
What is the value stored in values[1, 2]?

A) 2
B) 3
C) 6
D) 7
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
47
Reference variables can only reference objects.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
48
Which one of the following statements correctly creates a List object named friendsList that holds strings?

A) string friendsList = new List;
B) friendsList(string);
C) List friendsList = new List;
D) List friendsList = new List();
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
49
A(n) ____________ is similar to an array, but it can expand at runtime.

A) List object
B) sequential object
C) Random object
D) jagged array
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
50
If you know the value of the item you want to take out from a List object, but you do not know the item's index, you can use the ____________.

A) - (minus) operator
B) Erase method
C) Remove method
D) Delete method
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
51
A(n) ____________ is similar to a two-dimensional array, but the rows can have a different number of columns.

A) offset array
B) skewed array
C) jagged array
D) differential array
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
52
Data types in C# − and the underlying .NET Framework − fall into two categories: value types and reference types.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
53
List objects, like arrays, are always passed to methods ____________.

A) by value
B) in memory
C) by reference
D) globally
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
54
Look at the following code sample: const int ROWS = 2;
Const int COLS = 2;
Int[,] grid = new int[ROWS, COLS];
What is the total number of elements in the grid array?

A) 2
B) 4
C) 8
D) 16
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
55
You can store a variety of data types in an array.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
56
Creating a reference type object typically requires the following two steps, which can optionally be coded in a single program statement:
1. Declare a reference variable.
2. Create an object and associate it with the reference variable.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
57
Look at the following code sample: const int ROWS = 8;
Const int COLS = 2;
Int[,] table = new int[ROWS, COLS];
Which one of the following statements stores the value 25 in the element located at the first row and second column of the table array?

A) table[1, 2] = 25;
B) table[0, 1] = 25;
C) table[2, 1] = 25;
D) table[1, 0] = 25;
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
58
Because variables hold only single values, they can be cumbersome in programs that process lists of data.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
59
Traditional two-dimensional arrays, where each row has the same number of columns, are sometime referred to as ____________.

A) square arrays
B) rectangular arrays
C) box arrays
D) 2D arrays
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
60
To add items to an existing List object, use the ____________.

A) += operator
B) & operator
C) Insert property
D) Add method
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
61
When working with an array, you cannot use a subscript that is less than 0 or greater than the array size minus 1.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
62
Because the foreach loop automatically knows the number of elements in an array, you do not have to use a counter variable to control its iterations, as you would with a regular for loop.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
63
You can create an array to hold any single type of value.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
64
The default value of a string array's elements is null.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
65
Arrays are reference type objects.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
66
The sequential search algorithm is the simplest of all array searching algorithms.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
67
You access the individual elements in an array using their subscripts.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
68
An array's size declarator must be a nonnegative integer value.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
69
Because subscript numbering starts at 0, the subscript of the last element in an array is 1 less than the total number of elements in the array.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
70
When you use either the ref or out keywords before an array parameter, the receiving method does not automatically make a local copy of the array.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
71
The first element in an array is assigned subscript 1, the second element is assigned subscript 2, and so on.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
72
When reading the contents of a file into an array, your loop should always iterate until the array is full.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
73
To write the contents of an array to a file, open the file and use a loop to step through each array element, writing it to the file. Then close the file.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
74
The ref keyword creates an object in memory and returns a reference to the object it creates.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
75
Because array subscripts start at 1 rather than 0, you are not as likely to perform an off-by-one error.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
76
Arrays are always passed by value when passed as method arguments.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
77
If you provide an initialization list when declaring an array, you can leave out the size declarator, but you cannot leave out the new operator and its subsequent expression.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
78
You cannot reassign an array reference variable to a different array.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
79
When processing the contents of an array, the foreach loop does not provide a variable that can be used as an array subscript.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
80
An array's Length property is read-only, so you cannot change its value by trying to assign a new value to Length.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 99 flashcards in this deck.