Deck 9: Arrays

ملء الشاشة (f)
exit full mode
سؤال
A two-dimensional array resembles a table in that the variables (elements) are in rows and columns.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
When a run time error occurs, the computer displays an error message and the application ends abruptly.
سؤال
An array called state() is loaded as follows: Dim state() As String = {"Ohio", "Michigan", "California", "Arizona"}
What is the value of the subscript used to reference "Arizona"?

A) 1
B) 2
C) 3
D) 4
سؤال
When an array is sorted in descending order, the first element in the array contains the smallest value and the last element contains the largest value.
سؤال
If the array's data type is Integer, each element in the array is initialized using the keyword Nothing .
سؤال
A(n) ____ is a group of variables that have the same name and data type, and are related in some way.

A) subscript
B) string
C) array
D) run time error
سؤال
The following statement will declare an array. What is the index value for the first element? Dim lakes(5)

A) 0
B) 1
C) 4
D) 5
سؤال
An advantage of using the For Each…Next statement to process an array is that your code does not need to keep track of the array subscripts or even know the number of array elements.
سؤال
The data used to initialize the elements of an array is enclosed in ____.

A) [ ]
B) { }
C) ( )
D) " "
سؤال
Assigning initial values to an array is often referred to as ____.

A) sorting the array
B) populating the array
C) assigning the array
D) declaring the array
سؤال
Which of the following correctly shows the syntax for storing data in a one-dimensional array?

A) arrayname = value
B) arrayname(subscript) = value
C) arrayname = {value}
D) arrayname(subscript) = {value}
سؤال
An array is defined as follows: Dim numbers(3) As Integer
How many elements does the array have?

A) one
B) two
C) three
D) four
سؤال
Before you can use an array, you first must declare it.
سؤال
If a one-dimensional array contains five elements, its Length property contains the number 5 but its highest subscript is 3.
سؤال
A simple variable is unrelated to any other variable in memory.
سؤال
The statement ____ assigns the string "Madrid" to the first element in the strCities array.

A) strCities(0) = Madrid
B) strCities(0) = "Madrid"
C) strCities(1) = Madrid
D) strCities(0) = {Madrid}
سؤال
The following statement will declare an array that has ____ elements. Dim lakes(5) As Integer

A) four
B) five
C) six
D) seven
سؤال
Storing data in an array decreases the efficiency of your code.
سؤال
If a one-dimensional array contains five elements, its highest subscript is ____.

A) 4
B) 5
C) 6
D) 7
سؤال
The data in a two-dimensional array are not required to have the same data type.
سؤال
Based on the code below, intScores(2, 0) is initialized to ____. Dim intScores(,) As Integer = {{75, 90}, {9, 25}, {23, 56}, {6, 12}}

A) 25
B) 23
C) 56
D) 75
سؤال
Case-Based Critical Thinking Questions Case 1 - Tony's Pizza & Pasta
The restaurant uses an application to update and display menu items and the related price information.
The intSub variable keeps track of array subscripts and is initialized to 0. The intHighSub variable contains the highest subscript for the strToppings array. Which of the following statements will traverse the strToppings array?

A) Do While intSub >= intHighSub
B) For intHighSub As Integer = 0 To intSub
C) Do While intSub
D) For intSub As Integer = 1 To intHighSub
سؤال
Based on the code below, intScores(1, 1) is initialized to ____. Dim intScores(,) As Integer = {{75, 90}, {9, 25}, {23, 56}, {6, 12}}

A) 9
B) 25
C) 75
D) 90
سؤال
Based on the code below, intScores(3, 1) is initialized to ____. Dim intScores(,) As Integer = {{75, 90}, {9, 25}, {23, 56}, {6, 12}}

A) 6
B) 12
C) 23
D) 56
سؤال
Consider the following array: Dim numbers(,) As Integer = {{1,2},{3,4},{4,5},{6,7},{8,9}}
What value will the following expression yield for total ?
Total = numbers(1,1) + numbers(2,0)

A) 4
B) 6
C) 8
D) 12
سؤال
Based on the code below, intScores(3, 0) is initialized to ____. Dim intScores(,) As Integer = {{75, 90}, {9, 25}, {23, 56}, {6, 12}}

A) 6
B) 12
C) 23
D) 56
سؤال
To arrange the elements in an array in ascending order, you use the ____ method.

A) Array.Arrange
B) Array.Ascending
C) Array.Sort
D) Array.Arrange
سؤال
An array's ____ method returns an integer that indicates the highest subscript in the specified dimension in the array.

A) Sort
B) Reverse
C) TryParse
D) GetUpperBound
سؤال
Using an invalid subscript will result in a ____.

A) run time error
B) breakpoint
C) logic error
D) design-time error
سؤال
The statement ____ assigns the string "Paris" to the element located in the first row, second column in the strCities array.

A) strCities(1, 1) = {Paris}
B) strCities(0, 1) = "Paris"
C) strCities(0, 0) = (Paris)
D) strCities(1, 0) = "Paris"
سؤال
Consider the following array: Dim numbers(,) As Integer = {{1,2},{3,4},{4,5},{6,7},{8,9}}
What row index value would be required to create this two-dimensional array?

A) 2
B) 3
C) 4
D) 5
سؤال
Case-Based Critical Thinking Questions Case 1 - Tony's Pizza & Pasta
The restaurant uses an application to update and display menu items and the related price information.
Which of the following statements declares a class-level one-dimensional array named strToppings that stores the 14 available pizza toppings?

A) Dim strToppings(13) As String
B) Private strToppings(13) As String
C) Dim strToppings(14) As String
D) Private strToppings(14) As String
سؤال
Based on the code below, intScores(2, 1) is initialized to ____. Dim intScores(,) As Integer = {{75, 90}, {9, 25}, {23, 56}, {6, 12}}

A) 25
B) 23
C) 56
D) 75
سؤال
You do not need to specify the highest array subscript in the ____ statement.

A) Do...Loop
B) For...Next
C) For Each...Next
D) While...Wend
سؤال
The strRoom and strRate arrays are parallel arrays. If Deluxe is stored in the third element in the strRoom array, where is its rate (115) stored?

A) strRate(0)
B) strRate(1)
C) strRate(2)
D) strRate(3)
سؤال
The syntax ____ assigns either the value entered in the txtSales control (converted to Decimal) or the number 0 to the third element in the decSales array.

A) Decimal.TryParse(txtSales.Text, decSales(3))
B) Decimal.TryParse(txtSales.Text, decSales(0))
C) Decimal.TryParse(txtSales.Text, decSales(2))
D) TryParse(txtSales.Text, decSales(1))
سؤال
Two or more arrays whose elements are related by their positions in the arrays are referred to as ____ arrays.

A) parallel
B) two-dimensional
C) accumulator
D) related
سؤال
Based on the code below, intScores(0, 0) is initialized to ____. Dim intScores(,) As Integer = {{75, 90}, {9, 25}, {23, 56}, {6, 12}}

A) 9
B) 25
C) 75
D) 90
سؤال
To refer to the element located in the first row, first column in a two-dimensional array named strProducts , you use ____.

A) strProducts(0, 0)
B) strProducts{0, 1}
C) strProducts(1, 1)
D) strProducts[0, 0]
سؤال
Based on the statement below, which of the following If clauses determines whether the intSub variable contains a valid subscript for the array? Dim strColors() As String = {"red", "green", "blue"}

A) If intSub > 0 AndAlso intSub
B) If intSub >= 0 AndAlso intSub =
C) If intSub > 0 AndAlso intSub
D) If intSub >= 0 AndAlso intSub =
سؤال
Describe two advantages to using arrays to store data.
سؤال
Case-Based Critical Thinking Questions Case 1 - Tony's Pizza & Pasta
The restaurant uses an application to update and display menu items and the related price information.
Daily "Chef's Specials" are stored using two one-dimensional parallel arrays. The days of the week are stored in the strDays array, with Sunday as the first element. The daily special for each day is stored in a parallel array named strSpecial . Which of the following statements assigns Friday's special, which is rigatoni, to the appropriate element?

A) strSpecial(6) = rigatoni
B) strSpecial(5) = rigatoni
C) strSpecial(6) = "rigatoni"
D) strSpecial(5) = "rigatoni"
سؤال
Write the statement to declare a six-element class-level array named strAnimal , and initialize the array with the following values: dog, cat, mouse, bird, snake, fish.
سؤال
Write the statements to traverse the strCategory array and display each element's value in the lstCategory control. Use a For Each...Next statement.
سؤال
Explain the difference between a simple variable and an array.
سؤال
How do the elements in parallel one-dimensional arrays relate to each other? Provide an example.
سؤال
Write the statement that assigns the string "Treasurer" to the element located in the third row, second column in the strOfficers array.
سؤال
Write the statement to declare a procedure-level two-dimensional array named dblRates using the following table of data:
Write the statement to declare a procedure-level two-dimensional array named dblRates using the following table of data:  <div style=padding-top: 35px>
سؤال
Write the statement to declare a five-element procedure-level array named decGPA , and initialize the array with the following values: 2.58, 3.85, 3.6, 1.45, 2.75. Then write a statement to assign the number 2.55 to the last element in the array.
سؤال
Case-Based Critical Thinking Questions Case 1 - Tony's Pizza & Pasta
The restaurant uses an application to update and display menu items and the related price information.
Which of the following statements assigns the daily special of lasagna to Tuesday?

A) strDailySpecial(3, 2) = lasagna
B) strDailySpecial(3, 2) = "Tuesday"
C) strDailySpecial(2, 1) = "lasagna"
D) strDailySpecial(3, 2) = "lasagna"
سؤال
Case-Based Critical Thinking Questions Case 1 - Tony's Pizza & Pasta
The restaurant uses an application to update and display menu items and the related price information.
You have decided the Daily "Chef's Specials" need to be stored in a two-dimensional array rather than two parallel one-dimensional arrays. Which of the following statements will declare the array as a procedure-level array named strDailySpecial ? The number of rows is based on the number of days in the week, and Sunday remains the first element for the days of the week.

A) Dim strDailySpecial(6, 1) As String
B) Dim strDailySpecial(7, 2) As String
C) Dim strDailySpecial(1, 6) As String
D) Dim strDailySpecial(2, 7) As String
سؤال
The following array is declared and initialized:
Dim dblMilesPerTrip() As Double = {542, 28, 79.5, 322.6, 114}
Write the statements to total the values in the array.
سؤال
Write the statement to declare a four-element procedure-level array named intNum with each element initialized to 0. Then write the statements necessary to add the number 5 to each element in the intNum array.
سؤال
Problems - Correcting Logic and Code Errors
The following sample of code contains errors. Rewrite the incorrect statements to correct all errors.
Private Sub btnGetHighest_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnGetHighest.Click
' displays the highest prize amount and the
' number of people who won that amount
Dim intPrizes(10) As Integer = {50, 25, 100, 25, 100,
25, 75, 50, 40, 60}
Dim intHighSub As Integer = intPrizes.GetHighest()
Dim intHighPrize As Integer = intPrizes(0)
Dim intWinners As Integer = 1
For intX As Integer = 1 To intHighSub
If intPrizes(intX) = intHighPrize Then
intWinners *= 1
Else
If intPrizes(intX)
intHighPrize = intPrizes(intX)
intWinners = 1
End If
End If
Next intX
lblHighest.Text = intHighPrize.ToString("C0")
lblWinners.Text = intWinners.ToString
End Sub
سؤال
Write the statement to declare a seven-element procedure-level array named strItemCode with each element initialized to the keyword Nothing .
سؤال
The following array is declared and initialized:
Dim dblMilesPerTrip() As Double = {542, 28, 79.5, 322.6, 114}
Write the statements to sort the values in the array in descending order.
سؤال
Problems - Correcting Logic and Code Errors
The following sample of code contains errors. Rewrite the incorrect statements to correct all errors.
Private Sub btnDisplay_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
' displays the pay rate associated with a pay code
Dim strCodes() As String = {PT1, PT2, FT1, FT2, FT3}
Dim dblRates() As Integer = {10.5, 12, 13.5, 14}
Dim strSearchForCode As String
Dim intSub As Integer
' assign the code to a variable
txtCode.Text = strSearchForCode
' search the strCodes array for the pay code
' continue searching until the end of the array
' or the pay code is found
Do Until intSub > strCodes.Length OrElse
strSearchForCode = strCodes(intSub)
intSub = intSub + 1
Loop
' determine whether the pay code was found
If intSub
lblRate.Text = dblRates(1).ToString("C0")
Else
MessageBox.Show("Invalid Pay Code",
"Employee Pay Application",
MessageBoxButtons.OK,
MessageBoxIcon.Information)
End If
txtCode.Focus()
End Sub
سؤال
Write the statement to declare a twelve-row, two-column procedure-level array named strLocations , initializing each element to the keyword Nothing .
سؤال
Write the statement that assigns the length of the strBooks array to the intNumElements variable. Then write the statement that assigns the highest subscript in the array to the intHighestSub variable.
سؤال
Write the statements to traverse the strCategory array and display each element's value in the lstCategory control. Use a Do...Loop statement.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/60
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 9: Arrays
1
A two-dimensional array resembles a table in that the variables (elements) are in rows and columns.
True
2
When a run time error occurs, the computer displays an error message and the application ends abruptly.
True
3
An array called state() is loaded as follows: Dim state() As String = {"Ohio", "Michigan", "California", "Arizona"}
What is the value of the subscript used to reference "Arizona"?

A) 1
B) 2
C) 3
D) 4
C
4
When an array is sorted in descending order, the first element in the array contains the smallest value and the last element contains the largest value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
5
If the array's data type is Integer, each element in the array is initialized using the keyword Nothing .
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
6
A(n) ____ is a group of variables that have the same name and data type, and are related in some way.

A) subscript
B) string
C) array
D) run time error
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
7
The following statement will declare an array. What is the index value for the first element? Dim lakes(5)

A) 0
B) 1
C) 4
D) 5
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
8
An advantage of using the For Each…Next statement to process an array is that your code does not need to keep track of the array subscripts or even know the number of array elements.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
9
The data used to initialize the elements of an array is enclosed in ____.

A) [ ]
B) { }
C) ( )
D) " "
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
10
Assigning initial values to an array is often referred to as ____.

A) sorting the array
B) populating the array
C) assigning the array
D) declaring the array
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
11
Which of the following correctly shows the syntax for storing data in a one-dimensional array?

A) arrayname = value
B) arrayname(subscript) = value
C) arrayname = {value}
D) arrayname(subscript) = {value}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
12
An array is defined as follows: Dim numbers(3) As Integer
How many elements does the array have?

A) one
B) two
C) three
D) four
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
13
Before you can use an array, you first must declare it.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
14
If a one-dimensional array contains five elements, its Length property contains the number 5 but its highest subscript is 3.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
15
A simple variable is unrelated to any other variable in memory.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
16
The statement ____ assigns the string "Madrid" to the first element in the strCities array.

A) strCities(0) = Madrid
B) strCities(0) = "Madrid"
C) strCities(1) = Madrid
D) strCities(0) = {Madrid}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
17
The following statement will declare an array that has ____ elements. Dim lakes(5) As Integer

A) four
B) five
C) six
D) seven
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
18
Storing data in an array decreases the efficiency of your code.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
19
If a one-dimensional array contains five elements, its highest subscript is ____.

A) 4
B) 5
C) 6
D) 7
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
20
The data in a two-dimensional array are not required to have the same data type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
21
Based on the code below, intScores(2, 0) is initialized to ____. Dim intScores(,) As Integer = {{75, 90}, {9, 25}, {23, 56}, {6, 12}}

A) 25
B) 23
C) 56
D) 75
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
22
Case-Based Critical Thinking Questions Case 1 - Tony's Pizza & Pasta
The restaurant uses an application to update and display menu items and the related price information.
The intSub variable keeps track of array subscripts and is initialized to 0. The intHighSub variable contains the highest subscript for the strToppings array. Which of the following statements will traverse the strToppings array?

A) Do While intSub >= intHighSub
B) For intHighSub As Integer = 0 To intSub
C) Do While intSub
D) For intSub As Integer = 1 To intHighSub
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
23
Based on the code below, intScores(1, 1) is initialized to ____. Dim intScores(,) As Integer = {{75, 90}, {9, 25}, {23, 56}, {6, 12}}

A) 9
B) 25
C) 75
D) 90
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
24
Based on the code below, intScores(3, 1) is initialized to ____. Dim intScores(,) As Integer = {{75, 90}, {9, 25}, {23, 56}, {6, 12}}

A) 6
B) 12
C) 23
D) 56
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
25
Consider the following array: Dim numbers(,) As Integer = {{1,2},{3,4},{4,5},{6,7},{8,9}}
What value will the following expression yield for total ?
Total = numbers(1,1) + numbers(2,0)

A) 4
B) 6
C) 8
D) 12
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
26
Based on the code below, intScores(3, 0) is initialized to ____. Dim intScores(,) As Integer = {{75, 90}, {9, 25}, {23, 56}, {6, 12}}

A) 6
B) 12
C) 23
D) 56
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
27
To arrange the elements in an array in ascending order, you use the ____ method.

A) Array.Arrange
B) Array.Ascending
C) Array.Sort
D) Array.Arrange
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
28
An array's ____ method returns an integer that indicates the highest subscript in the specified dimension in the array.

A) Sort
B) Reverse
C) TryParse
D) GetUpperBound
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
29
Using an invalid subscript will result in a ____.

A) run time error
B) breakpoint
C) logic error
D) design-time error
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
30
The statement ____ assigns the string "Paris" to the element located in the first row, second column in the strCities array.

A) strCities(1, 1) = {Paris}
B) strCities(0, 1) = "Paris"
C) strCities(0, 0) = (Paris)
D) strCities(1, 0) = "Paris"
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
31
Consider the following array: Dim numbers(,) As Integer = {{1,2},{3,4},{4,5},{6,7},{8,9}}
What row index value would be required to create this two-dimensional array?

A) 2
B) 3
C) 4
D) 5
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
32
Case-Based Critical Thinking Questions Case 1 - Tony's Pizza & Pasta
The restaurant uses an application to update and display menu items and the related price information.
Which of the following statements declares a class-level one-dimensional array named strToppings that stores the 14 available pizza toppings?

A) Dim strToppings(13) As String
B) Private strToppings(13) As String
C) Dim strToppings(14) As String
D) Private strToppings(14) As String
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
33
Based on the code below, intScores(2, 1) is initialized to ____. Dim intScores(,) As Integer = {{75, 90}, {9, 25}, {23, 56}, {6, 12}}

A) 25
B) 23
C) 56
D) 75
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
34
You do not need to specify the highest array subscript in the ____ statement.

A) Do...Loop
B) For...Next
C) For Each...Next
D) While...Wend
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
35
The strRoom and strRate arrays are parallel arrays. If Deluxe is stored in the third element in the strRoom array, where is its rate (115) stored?

A) strRate(0)
B) strRate(1)
C) strRate(2)
D) strRate(3)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
36
The syntax ____ assigns either the value entered in the txtSales control (converted to Decimal) or the number 0 to the third element in the decSales array.

A) Decimal.TryParse(txtSales.Text, decSales(3))
B) Decimal.TryParse(txtSales.Text, decSales(0))
C) Decimal.TryParse(txtSales.Text, decSales(2))
D) TryParse(txtSales.Text, decSales(1))
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
37
Two or more arrays whose elements are related by their positions in the arrays are referred to as ____ arrays.

A) parallel
B) two-dimensional
C) accumulator
D) related
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
38
Based on the code below, intScores(0, 0) is initialized to ____. Dim intScores(,) As Integer = {{75, 90}, {9, 25}, {23, 56}, {6, 12}}

A) 9
B) 25
C) 75
D) 90
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
39
To refer to the element located in the first row, first column in a two-dimensional array named strProducts , you use ____.

A) strProducts(0, 0)
B) strProducts{0, 1}
C) strProducts(1, 1)
D) strProducts[0, 0]
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
40
Based on the statement below, which of the following If clauses determines whether the intSub variable contains a valid subscript for the array? Dim strColors() As String = {"red", "green", "blue"}

A) If intSub > 0 AndAlso intSub
B) If intSub >= 0 AndAlso intSub =
C) If intSub > 0 AndAlso intSub
D) If intSub >= 0 AndAlso intSub =
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
41
Describe two advantages to using arrays to store data.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
42
Case-Based Critical Thinking Questions Case 1 - Tony's Pizza & Pasta
The restaurant uses an application to update and display menu items and the related price information.
Daily "Chef's Specials" are stored using two one-dimensional parallel arrays. The days of the week are stored in the strDays array, with Sunday as the first element. The daily special for each day is stored in a parallel array named strSpecial . Which of the following statements assigns Friday's special, which is rigatoni, to the appropriate element?

A) strSpecial(6) = rigatoni
B) strSpecial(5) = rigatoni
C) strSpecial(6) = "rigatoni"
D) strSpecial(5) = "rigatoni"
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
43
Write the statement to declare a six-element class-level array named strAnimal , and initialize the array with the following values: dog, cat, mouse, bird, snake, fish.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
44
Write the statements to traverse the strCategory array and display each element's value in the lstCategory control. Use a For Each...Next statement.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
45
Explain the difference between a simple variable and an array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
46
How do the elements in parallel one-dimensional arrays relate to each other? Provide an example.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
47
Write the statement that assigns the string "Treasurer" to the element located in the third row, second column in the strOfficers array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
48
Write the statement to declare a procedure-level two-dimensional array named dblRates using the following table of data:
Write the statement to declare a procedure-level two-dimensional array named dblRates using the following table of data:
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
49
Write the statement to declare a five-element procedure-level array named decGPA , and initialize the array with the following values: 2.58, 3.85, 3.6, 1.45, 2.75. Then write a statement to assign the number 2.55 to the last element in the array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
50
Case-Based Critical Thinking Questions Case 1 - Tony's Pizza & Pasta
The restaurant uses an application to update and display menu items and the related price information.
Which of the following statements assigns the daily special of lasagna to Tuesday?

A) strDailySpecial(3, 2) = lasagna
B) strDailySpecial(3, 2) = "Tuesday"
C) strDailySpecial(2, 1) = "lasagna"
D) strDailySpecial(3, 2) = "lasagna"
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
51
Case-Based Critical Thinking Questions Case 1 - Tony's Pizza & Pasta
The restaurant uses an application to update and display menu items and the related price information.
You have decided the Daily "Chef's Specials" need to be stored in a two-dimensional array rather than two parallel one-dimensional arrays. Which of the following statements will declare the array as a procedure-level array named strDailySpecial ? The number of rows is based on the number of days in the week, and Sunday remains the first element for the days of the week.

A) Dim strDailySpecial(6, 1) As String
B) Dim strDailySpecial(7, 2) As String
C) Dim strDailySpecial(1, 6) As String
D) Dim strDailySpecial(2, 7) As String
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
52
The following array is declared and initialized:
Dim dblMilesPerTrip() As Double = {542, 28, 79.5, 322.6, 114}
Write the statements to total the values in the array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
53
Write the statement to declare a four-element procedure-level array named intNum with each element initialized to 0. Then write the statements necessary to add the number 5 to each element in the intNum array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
54
Problems - Correcting Logic and Code Errors
The following sample of code contains errors. Rewrite the incorrect statements to correct all errors.
Private Sub btnGetHighest_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnGetHighest.Click
' displays the highest prize amount and the
' number of people who won that amount
Dim intPrizes(10) As Integer = {50, 25, 100, 25, 100,
25, 75, 50, 40, 60}
Dim intHighSub As Integer = intPrizes.GetHighest()
Dim intHighPrize As Integer = intPrizes(0)
Dim intWinners As Integer = 1
For intX As Integer = 1 To intHighSub
If intPrizes(intX) = intHighPrize Then
intWinners *= 1
Else
If intPrizes(intX)
intHighPrize = intPrizes(intX)
intWinners = 1
End If
End If
Next intX
lblHighest.Text = intHighPrize.ToString("C0")
lblWinners.Text = intWinners.ToString
End Sub
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
55
Write the statement to declare a seven-element procedure-level array named strItemCode with each element initialized to the keyword Nothing .
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
56
The following array is declared and initialized:
Dim dblMilesPerTrip() As Double = {542, 28, 79.5, 322.6, 114}
Write the statements to sort the values in the array in descending order.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
57
Problems - Correcting Logic and Code Errors
The following sample of code contains errors. Rewrite the incorrect statements to correct all errors.
Private Sub btnDisplay_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
' displays the pay rate associated with a pay code
Dim strCodes() As String = {PT1, PT2, FT1, FT2, FT3}
Dim dblRates() As Integer = {10.5, 12, 13.5, 14}
Dim strSearchForCode As String
Dim intSub As Integer
' assign the code to a variable
txtCode.Text = strSearchForCode
' search the strCodes array for the pay code
' continue searching until the end of the array
' or the pay code is found
Do Until intSub > strCodes.Length OrElse
strSearchForCode = strCodes(intSub)
intSub = intSub + 1
Loop
' determine whether the pay code was found
If intSub
lblRate.Text = dblRates(1).ToString("C0")
Else
MessageBox.Show("Invalid Pay Code",
"Employee Pay Application",
MessageBoxButtons.OK,
MessageBoxIcon.Information)
End If
txtCode.Focus()
End Sub
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
58
Write the statement to declare a twelve-row, two-column procedure-level array named strLocations , initializing each element to the keyword Nothing .
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
59
Write the statement that assigns the length of the strBooks array to the intNumElements variable. Then write the statement that assigns the highest subscript in the array to the intHighestSub variable.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
60
Write the statements to traverse the strCategory array and display each element's value in the lstCategory control. Use a Do...Loop statement.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.