# Get Guided CIS115 Sample Quiz 6

## Get Guided CIS115 Sample Quiz 6

Question 1.1. (TCOS 5, 6) The following statement indicates that num is being used as a(n) _____.
num = num + x (Points : 3)
array
accumulator
counter
Not enough information is given

Question 2.2. (TCO 6) The number of elements in the array is called the _____ of the array. (Points : 3)
width
size
subscript
None of the above

Question 3.3. (TCO 6) How do you refer to the second element of the array declared as the following?
Dim numbers(4) as Integer (Points : 3)
numbers2
numbers1
numbers(2)
numbers(1)

Question 4.4. (TCOs 5, 6, 8) What is the output of the following Visual Basic code?

Sub Main
Dim x, y As Integer
x = 3
While x 6
y = 1
While y 4
Console.Write(y)
y = y + 1
End While
Console.WriteLine()
x = x + 2
End While
End Sub
(Points: 5)

123
123

Question 5.5. (TCOs 5, 6, 8) Write the Visual Basic code for the following problem.
Declare an array to store five values; they could be decimal numbers.
Prompt the user to store values in the array.
Then prompt the user for a percent to decrease each value of the array.
Adjust the values and print the new values. Make sure you change the values in the array.
The output should look like this (note that it should work for any values that are input, these are just examples). You must use loop(s) to process the array.

Enter number: 10
Enter number: 20
Enter number: 30
Enter number: 40
Enter number: 50
Enter percent decrease: 5
After a 5 percent decrease, the values are
9.5
19
28.5
38
47.5
Press any key to continue . . .

Dim are numbers(5) As Decimal
Dim PercentDecrease As Double
For index = 0 To 4 Step 1
Care numbers(“Enter number: “)
Next index

Console.Write(“Enter percent decrease: “)

For index = 0 To 4 Step 1
arrNumbers(index) = arrNumbers(index) – (PercentDecrease / 100 * arrNumbers(index))
Next index

Console.WriteLine(“After a 5 percent decrease the values are”)
For index = 0 To 4 Step 1
Console.WriteLine(arrNumbers(index).ToString())
Next index

Console.WriteLine(“Press any key to continue . . .”)

## Need Help with Quiz?

\$3.99
Get Guided CIS115 Sample Quiz 6