Deck 8: Arrays and Collections
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
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/50
Play
Full screen (f)
Deck 8: Arrays and Collections
1
It is not necessary for a programmer to manipulate the subscripts of an array if they use a For / Next loop.
False
2
When an array is initialized with the Dim Statement,the index starts at 1 instead of 0.
False
3
The following code is valid: Dim NameString()As String = {"Theresa","Anita","Julia")
True
4
An exception is automatically thrown if a subscript is used that is not a valid element in an array.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
5
A Structure is private by default,but can be declared to be Friend or Private.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
6
Each element in an array can have its own unique data type.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
7
The Structure / End Structure statements may be used to represent a record of related fields of information.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
8
An array is a series of values,all referenced by the same variable name.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
9
An array is a list or series of values.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
10
The following code is valid for declaring an array with ten elements: Dim EmployeeNameString(0 to 10).
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
11
Each individual variable in an array is called a "member" of the array.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
12
Code to create a user-defined Structure should be placed inside the procedure in which the structure will be used.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
13
StudentNameString (0) is a valid position in an array that is declared with the statement: Dim StudentNameString(15)As String.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
14
An array is a series of individual variables,all referenced by the same name but having unique indexes.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
15
A subscript may also be called an index.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
16
A Dim statement can be used to specify initial values for the array elements.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
17
A Structure declaration cannot go inside a procedure.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
18
A For Each loop will execute even if the array contains no elements.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
19
Sometimes arrays are referred to as list boxes.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
20
The following code is valid for creating a structure named Student:
Structure Student
Dim StudentIDString As String
Dim FirstNameString As String
Dim LastNameString As String
Dim GPADecimal As Decimal
End Structure
Structure Student
Dim StudentIDString As String
Dim FirstNameString As String
Dim LastNameString As String
Dim GPADecimal As Decimal
End Structure
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
21
Collections are less sophisticated than arrays and do not define any properties or methods.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
22
The SelectedIndex property of a list box can be used as an array subscript to find an item in a list box.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
23
An array with six elements will exist in memory after the following lines of code have been executed:
Structure Vendor
Dim VendorIDString As String
Dim NameString As String
Dim PhoneString As String
End Structure
Dim BusinessVendor(5)As Vendor
Structure Vendor
Dim VendorIDString As String
Dim NameString As String
Dim PhoneString As String
End Structure
Dim BusinessVendor(5)As Vendor
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
24
The first subscript in a multidimensional array specifies the column,and the second specifies the row.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
25
If an exception is thrown and the message,"Index was outside the bounds of the array." displays,this indicates _______.
A)the array is completely full of data
B)the subscript is a value greater than the number of elements declared in the array's Dim statement
C)the subscript has reached a value lower than the number of elements declared in the array's Dim statement
D)The answer could be B or C
A)the array is completely full of data
B)the subscript is a value greater than the number of elements declared in the array's Dim statement
C)the subscript has reached a value lower than the number of elements declared in the array's Dim statement
D)The answer could be B or C
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
26
"Vendor" is the name of the array in the following code:
Structure Vendor
Dim VendorIDString As String
Dim NameString As String
Dim PhoneString As String
End Structure
Dim BusinessVendor(5)As Vendor
Structure Vendor
Dim VendorIDString As String
Dim NameString As String
Dim PhoneString As String
End Structure
Dim BusinessVendor(5)As Vendor
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
27
Which of the following code samples is valid for accumulating the total sales for the Tigers baseball club if the Tigers are the second group in the list?
A)SalesDecimal += TotalSalesDecimal(1)
B)SalesDecimal += TotalSalesDecimal(2)
C)TotalSalesDecimal(1)+= SalesDecimal
D)TotalSalesDecimal(2)+= SalesDecimal
A)SalesDecimal += TotalSalesDecimal(1)
B)SalesDecimal += TotalSalesDecimal(2)
C)TotalSalesDecimal(1)+= SalesDecimal
D)TotalSalesDecimal(2)+= SalesDecimal
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
28
When you are working with an array,the easiest way to traverse the elements is to use the _______.
A)If / Then statement
B)Next statement
C)For Each / Next statement
D)Case structure
A)If / Then statement
B)Next statement
C)For Each / Next statement
D)Case structure
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
29
Declare an array and specify the number of elements using _______.
A)the ListCount property
B)the ListIndex property
C)an Array statement
D)a Dim statement
A)the ListCount property
B)the ListIndex property
C)an Array statement
D)a Dim statement
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
30
The individual variables in an array are accessed by their _______,which is their position in the array.
A)dimension
B)ListCount property
C)subscript
D)ItemCount property
A)dimension
B)ListCount property
C)subscript
D)ItemCount property
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
31
The SortedList collection automatically sorts entries as they are added to the collection.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
32
Given the following code,which of the choices below would be used to access the phone number of the 3rd vendor? Private Structure Vendor
Dim VendorIDString As String
Dim NameString As String
Dim PhoneString As String
End Structure
Dim BusinessVendor(5)As Vendor
A)BusinessVendor(2).PhoneString
B)Vendor(2).PhoneString
C)PhoneString(2).Vendor
D)BusinessVendor(2)
Dim VendorIDString As String
Dim NameString As String
Dim PhoneString As String
End Structure
Dim BusinessVendor(5)As Vendor
A)BusinessVendor(2).PhoneString
B)Vendor(2).PhoneString
C)PhoneString(2).Vendor
D)BusinessVendor(2)
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
33
A VB programmer can combine multiple fields of related data using a _______.
A)DataType statement
B)Structure statement
C)For Each statement
D)Public statement
A)DataType statement
B)Structure statement
C)For Each statement
D)Public statement
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
34
A table lookup is used to find a match for a specific value (or string)by comparing it to each element in an array.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
35
In the following statement,_______,refers to the array, For Each OneSchoolString In SchoolString
A)For Each
B)OneSchoolString
C)In
D)SchoolString
A)For Each
B)OneSchoolString
C)In
D)SchoolString
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
36
There are several collections defined in .NET to help programmers manage in-memory data.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
37
An array is a set of variables.Each individual variable is called _______.
A)a subscript
B)an element
C)a subscripted variable
D)an index
A)a subscript
B)an element
C)a subscripted variable
D)an index
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
38
How many elements are contained in the array created with the following code? Dim EmployeeString(25)As String
A)0 (The code is incorrect to create an array. )
B)24
C)25
D)26
A)0 (The code is incorrect to create an array. )
B)24
C)25
D)26
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
39
A table lookup can be used to look up array elements indirectly.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
40
Array elements may be used for counters and accumulators.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
41
When you have data stored in a SortedList,you can access the elements using the
A)Nickname
B)Index
C)Key
D)B and C are correct.
A)Nickname
B)Index
C)Key
D)B and C are correct.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
42
When performing a table lookup,it is a good idea to include validation because _______.
A)when looking for a table it is very likely that the table will not exist
B)the user should be notified if there is no match found in the table
C)validation will add a new element to the table if no match is found
D)it will cause the lookup to perform much faster than without validation
A)when looking for a table it is very likely that the table will not exist
B)the user should be notified if there is no match found in the table
C)validation will add a new element to the table if no match is found
D)it will cause the lookup to perform much faster than without validation
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
43
__________ can be used to find a specific value in an array.
A)The Find method of an array
B)A table lookup
C)The Locate.Item property
D)A Case structure
A)The Find method of an array
B)A table lookup
C)The Locate.Item property
D)A Case structure
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
44
Write a structure called Student that contains the following items:
Last Name,First Name,Student ID,CurrentG.P.A.
Structure Student
Dim LastNameString As String
Dim FirstNameString As String
Dim StudentIDString As String
Dim ClassNameString As String
Dim CurrentGPADecimal As Decimal
Dim OverallGPADecimal As Decimal
End StructureG.P.A. ,and Overall
Last Name,First Name,Student ID,CurrentG.P.A.
Structure Student
Dim LastNameString As String
Dim FirstNameString As String
Dim StudentIDString As String
Dim ClassNameString As String
Dim CurrentGPADecimal As Decimal
Dim OverallGPADecimal As Decimal
End StructureG.P.A. ,and Overall
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
45
Write a declaration statement for a SortedList object named MyList,accessible to all classes in the project.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
46
_______ can be used when two subscripts are needed to identify tabular data,such as when data is arranged in rows and columns.
A)Complex subscripts
B)List boxes
C)Text boxes
D)Multidimensional arrays
A)Complex subscripts
B)List boxes
C)Text boxes
D)Multidimensional arrays
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
47
Dimension a variable that can be used for a seating chart that will hold student names in a classroom that has 5 tables,each with 7 chairs.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
48
Which of the following is not a .NET Collection type?
A)ArrayList
B)Queue
C)Turnstyle
D)Stack
A)ArrayList
B)Queue
C)Turnstyle
D)Stack
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
49
after the following declaration is initialized? Dim NameString ( ,)As String = { "James","Mary"},{ "Sammie","Sean"}
A)James
B)Mary
C)Sammie
D)Sean
A)James
B)Mary
C)Sammie
D)Sean
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
50
Explain the difference between a For/Next loop and a For Each/Next loop when traversing an array.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck