Deck 7: Arrays and Lists

Full screen (f)
exit full mode
Question
When you create a numeric array in C#, what value are its elements set to by default?

A) null
B) 0
C) 255
D) -1
Use Space or
up arrow
down arrow
to flip the card.
Question
When you create an array, you can optionally initialize it with a group of values called a(n) ____________.

A) initialization list
B) default group
C) element assembly
D) starting run
Question
When you are working with a(n) ____________ variable, the compiler sets aside, or allocates, a chunk of memory that is big enough for that variable.

A) reference type
B) uninitialized
C) value type
D) dynamic type
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
What special value are the elements of an array of reference type objects set to by default?

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

A) values
B) sectors
C) compartments
D) elements
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
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
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
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
A(n) ____________ is an object that can hold a group of values that are all the same data type.

A) matrix
B) list
C) array
D) container
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
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();
Question
A(n) ____________ is a special value that links a variable to an object.

A) linker
B) reference
C) operator
D) delimiter
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
Each element in an array is assigned a unique number known as a(n) ____________.

A) subscript
B) identifier
C) delimiter
D) vector
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
Which one of the following statements declares a reference variable named values that can be used to reference an int array?

A) int values[];
B) values[int];
C) int[] values;
D) int [values];
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 assigns the value 40 to the first element in an int array named values?

A) values[-1] = 40;
B) values[0] = 40;
C) values[null] = 40;
D) values[1] = 40;
Question
____________ is a process that periodically runs, removing all unreferenced objects from memory.

A) System cleanup
B) Garbage collection
C) Nullification
D) Non-maskable Interrupt
Question
The ____________ is a clever algorithm that is much more efficient that the sequential search.

A) random search
B) quick sort
C) binary search
D) combinatorial search
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
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) referential protocols
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
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
To successfully ____________ the contents of two variables, we need a third variable that can serve as a temporary storage location.

A) copy
B) swap
C) reference
D) remove
Question
To compare the contents of two arrays, you must compare the ____________ of the two arrays.

A) memory locations
B) reference variables
C) elements
D) size
Question
In C#, all arrays have a(n) ____________ that is set to the number of elements in the array.

A) Element property
B) getSize method
C) Length property
D) GetBounds method
Question
When you call a method and pass an array as an argument, you simply pass the____________ that references the array.

A) data
B) method
C) variable
D) class
Question
When you process a(n) ____________, you must process only the elements that contain valid items.

A) partially filled array
B) reference copy
C) sequential search
D) Boolean expression
Question
____________ arrays, which are also called 2D arrays, can hold multiple sets of data.

A) Double-data
B) Two-dimensional
C) Row-column
D) Duel-derivative
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
When only a reference of an object is copied and not the contents of the object itself, it is called a(n) ____________.

A) shadow copy
B) memory copy
C) error copy
D) reference copy
Question
The ____________ uses a loop to sequentially step through an array, starting with the first element.

A) sequential search algorithm
B) top-down algorithm
C) simple search algorithm
D) basic array traversal algorithm
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
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
With what value should the accumulator variable be initialized to calculate the total of the values in a numeric array?

A) null
B) false
C) 0
D) -1
Question
____________ arrays can only hold one set of data.

A) One-dimensional
B) Two-dimensional
C) Data bound
D) Classical
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
All the data types in C# − and the underlying .NET Framework − fall into two categories: value types and reference types.
Question
The memory that is allocated for a reference type variable is the actual location that will hold any value that is assigned to that variable.
Question
Reference variables can be used only to reference objects.
Question
If you want to remove all the items from a List, you can call the ____________ method.

A) Clear
B) Reset
C) ClearAll
D) NewList
Question
A(n) ____________ is similar to an array but offers many advantages over an array.

A) List object
B) Collection
C) Random object
D) jagged array
Question
A List object has a(n) ____________ that holds the number of items stored in the List.

A) Count property
B) Total property
C) reference variable
D) extra memory location
Question
To add items to an existing List object, you use the ____________.

A) += operator
B) & operator
C) Insert property
D) Add method
Question
You can use the ____________ to remove an item at a specific index in a List.

A) Delete method
B) RemoveAt method
C) null keyword
D) Erase property
Question
You can store a mixture of data types in an array.
Question
You can use the ____________ to insert an item at a specific index in a List.

A) + operator
B) Add method
C) Insert method
D) Place property
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
Because variables hold only a single value, they can be cumbersome in programs that process lists of data.
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
Which one of the following statements creates a List object, named friendsList, that can be used to hold strings?

A) string friendsList = new List;
B) friendsList(string);
C) List friendsList = new List;
D) List friendsList = new List();
Question
List objects, like arrays, are always passed to a method ____________.

A) by value
B) in memory
C) by reference
D) globally
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
Look at the following code sample: int[,] values = { { 1, 2, 3, 4 },
{ 5, 6, 7, 8 } };
What is the value stored in values[2, 2]?

A) 2
B) 3
C) 6
D) 7
Question
If you know the value of the item that you want to remove from a List, but you do not know the item's index, you can use the ____________.

A) - operator
B) Erase method
C) Remove method
D) -= operator
Question
Creating a reference type object typically requires the following two steps:
1. You declare a reference variable.
2. You create the object and associate it with the reference variable.
Question
When processing the contents of an array, there are some circumstances in which the foreach loop is not adequate, and the for loop should be used instead.
Question
When you use either the ref or out keywords with an array parameter, the receiving method not only has access to the array, but it also has access to the reference variable that was used to pass the array.
Question
When working with an array, you cannot use a subscript that is less than 0 or greater than the size of the array minus 1.
Question
The first element in an array is assigned the subscript 1, the second element is assigned the subscript 2, and so forth.
Question
Writing the contents of an array to a file is a straightforward procedure: Open the file and use a loop to step through each element of the array, writing its contents to the file.
Question
Arrays are reference type objects.
Question
Arrays are always passed by 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
The sequential search algorithm is the simplest of all search algorithms.
Question
Because array subscripts start at 1 rather than 0, you are not as likely to perform an off-by-one error.
Question
The default value of a string array's elements is null.
Question
An array's size declarator must be a nonnegative integer number.
Question
You access the individual elements in an array by using their subscripts.
Question
An array's Length property is read only, so you cannot change its value.
Question
In C#, you cannot reassign an array reference variable to a different array.
Question
The ref keyword creates and object in memory and returns a reference to the object it creates.
Question
You can create an array to hold any one type of value.
Question
When reading the contents of a file into an array, the loop should iterate until either the array is filled or the end of the file is reached.
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 with a regular for loop.
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.
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
When you create a numeric array in C#, what value are its elements set to by default?

A) null
B) 0
C) 255
D) -1
B
2
When you create an array, you can optionally initialize it with a group of values called a(n) ____________.

A) initialization list
B) default group
C) element assembly
D) starting run
A
3
When you are working with a(n) ____________ variable, the compiler sets aside, or allocates, a chunk of memory that is big enough for that variable.

A) reference type
B) uninitialized
C) value type
D) dynamic type
C
4
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
5
What special value are the elements of an array of reference type objects set 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
6
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
7
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
8
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
9
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
10
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
11
A(n) ____________ is an object that can hold a group of values that are all the same data type.

A) matrix
B) list
C) array
D) container
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
12
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
13
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();
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
14
A(n) ____________ is a special value that links a variable to an object.

A) linker
B) reference
C) operator
D) delimiter
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
15
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
16
Each element in an array is assigned 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
17
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
18
Which one of the following statements declares a reference variable named values that can be used to reference an int array?

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
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 assigns the value 40 to the first element in an int array named values?

A) values[-1] = 40;
B) values[0] = 40;
C) values[null] = 40;
D) values[1] = 40;
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
21
____________ is a process that periodically runs, 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
22
The ____________ is a clever algorithm that is much more efficient that the sequential search.

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
23
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
24
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) referential protocols
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
25
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
26
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
27
To successfully ____________ the contents of two variables, we need a third variable that can serve as a temporary storage location.

A) copy
B) swap
C) reference
D) remove
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
28
To compare the contents of two arrays, you must compare the ____________ of 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
29
In C#, all arrays have a(n) ____________ that is set to 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
30
When you call a method and pass an array as an argument, you simply pass the____________ that references the array.

A) data
B) method
C) variable
D) class
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
31
When you process a(n) ____________, you must process only the elements that contain 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
32
____________ arrays, which are also called 2D arrays, can hold multiple 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
33
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
34
When only a reference of an object is copied and not the contents of the object itself, it is called a(n) ____________.

A) shadow copy
B) memory copy
C) error copy
D) reference copy
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
35
The ____________ uses a loop to sequentially step through an array, starting with the first element.

A) sequential search algorithm
B) top-down algorithm
C) simple search algorithm
D) basic array traversal algorithm
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
36
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
37
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
38
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
39
With what value should the accumulator variable be initialized to calculate the total of the 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
40
____________ 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
41
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
42
All the 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
43
The memory that is allocated for a reference type variable is the actual location that will hold any value that is assigned to that variable.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
44
Reference variables can be used only to reference objects.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
45
If you want to remove all the items from a List, you can call the ____________ method.

A) Clear
B) Reset
C) ClearAll
D) NewList
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
46
A(n) ____________ is similar to an array but offers many advantages over an array.

A) List object
B) Collection
C) Random object
D) jagged array
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
47
A List object has a(n) ____________ that holds the number of items stored in the List.

A) Count property
B) Total property
C) reference variable
D) extra memory location
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
48
To add items to an existing List object, you 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
49
You can use the ____________ to remove an item at a specific index in a List.

A) Delete method
B) RemoveAt method
C) null keyword
D) Erase property
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
50
You can store a mixture of data types in an array.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
51
You can use the ____________ to insert an item at a specific index in a List.

A) + operator
B) Add method
C) Insert method
D) Place property
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
52
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
53
Because variables hold only a single value, 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
54
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
55
Which one of the following statements creates a List object, named friendsList, that can be used to hold 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
56
List objects, like arrays, are always passed to a method ____________.

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
57
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
58
Look at the following code sample: int[,] values = { { 1, 2, 3, 4 },
{ 5, 6, 7, 8 } };
What is the value stored in values[2, 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
59
If you know the value of the item that you want to remove from a List, but you do not know the item's index, you can use the ____________.

A) - operator
B) Erase method
C) Remove method
D) -= operator
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
60
Creating a reference type object typically requires the following two steps:
1. You declare a reference variable.
2. You create the 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
61
When processing the contents of an array, there are some circumstances in which the foreach loop is not adequate, and the for loop should be used instead.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
62
When you use either the ref or out keywords with an array parameter, the receiving method not only has access to the array, but it also has access to the reference variable that was used to pass the array.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
63
When working with an array, you cannot use a subscript that is less than 0 or greater than the size of the array minus 1.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
64
The first element in an array is assigned the subscript 1, the second element is assigned the subscript 2, and so forth.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
65
Writing the contents of an array to a file is a straightforward procedure: Open the file and use a loop to step through each element of the array, writing its contents to the file.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
66
Arrays are reference type objects.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
67
Arrays are always passed by value.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
68
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
69
The sequential search algorithm is the simplest of all search algorithms.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
70
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
71
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
72
An array's size declarator must be a nonnegative integer number.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
73
You access the individual elements in an array by using their subscripts.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
74
An array's Length property is read only, so you cannot change its value.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
75
In C#, 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
76
The ref keyword creates and 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
77
You can create an array to hold any one type of value.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
78
When reading the contents of a file into an array, the loop should iterate until either the array is filled or the end of the file is reached.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
79
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 with a regular for loop.
Unlock Deck
Unlock for access to all 99 flashcards in this deck.
Unlock Deck
k this deck
80
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
locked card icon
Unlock Deck
Unlock for access to all 99 flashcards in this deck.