Exam 9: Arrays

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Which of the following correctly shows the syntax for storing data in a one-dimensional array?

(Multiple Choice)
4.9/5
(29)

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 < strCodes.Length Then 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

(Essay)
5.0/5
(35)

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.

(Short Answer)
4.9/5
(29)

Two or more arrays whose elements are related by their positions in the arrays are referred to as ____ arrays.

(Multiple Choice)
4.9/5
(28)

If a one-dimensional array contains five elements,its highest subscript is ____.

(Multiple Choice)
4.9/5
(34)

The data in a two-dimensional array are not required to have the same data type.

(True/False)
4.8/5
(30)

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)

(Multiple Choice)
4.8/5
(28)

The statement ____ assigns the string "Madrid" to the first element in the strCities array.

(Multiple Choice)
4.8/5
(35)

The following statement will declare an array that has ____ elements. Dim lakes(5)As Integer

(Multiple Choice)
5.0/5
(36)

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.

(Short Answer)
4.9/5
(30)

A simple variable is unrelated to any other variable in memory.

(True/False)
4.9/5
(45)

Based on the code below,intScores(1,1)is initialized to ____. Dim intScores(,) As Integer = {{75, 90}, {9, 25}, {23, 56}, {6, 12}}

(Multiple Choice)
4.8/5
(32)

To refer to the element located in the first row,first column in a two-dimensional array named strProducts,you use ____.

(Multiple Choice)
4.9/5
(36)

An array's ____ method returns an integer that indicates the highest subscript in the specified dimension in the array.

(Multiple Choice)
4.9/5
(29)

To arrange the elements in an array in ascending order,you use the ____ method.

(Multiple Choice)
4.8/5
(36)

Explain the difference between a simple variable and an array.

(Essay)
4.9/5
(35)

Before you can use an array,you first must declare it.

(True/False)
4.8/5
(42)

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.

(Multiple Choice)
4.8/5
(32)

You do not need to specify the highest array subscript in the ____ statement.

(Multiple Choice)
4.8/5
(39)

Describe two advantages to using arrays to store data.

(Essay)
4.9/5
(38)
Showing 41 - 60 of 60
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)