执行以下语句,则数组a的元素中不可能出现的元素值是________。Dim a(99) As IntegerDim i As IntegerRandomize()For i = 0 To UBound(a)a(i) = Int(Rnd() * 26 + 65)Next i
举一反三
- 使用数组x输出10个1-100之间的随机整数(包括1和100),下列命令中正确的是:( ) A: Dim x(9) As Integer For i = 1 To UBound(x) x(i) = Int(Rnd() * 100 + 1) Print x(i); Next B: Dim x(9) As Integer For i = 0 To UBound(x) x(i) = Rnd(10) Print x(i); Next C: Dim x(9) As Integer For i = 0 To UBound(x) x(i) = Int(Rnd() * 100 ) Print x(i); Next D: Dim x(9) As Integer For i = 0 To UBound(x) x(i) = Int(Rnd() * 100 + 1) Print x(i); Next
- 若要定义一个10个元素的整数数组,每个元素的值均为5,则下列语句正确的是___________。 A: Dim a%(9) = 5 B: Dim a%(10) = 5 C: Dim a%(9) = (5) D: Dim a%(9), i% For i = 0 To 9 a(i) = 5 Next
- 执行以下程序,MsgBox输出的值是________。Dim i, a(9) As Integera(0) = 1a(1) = 1For i = 2 To UBound(a)a(i) = a(i - 1) + a(i - 2)Next iMsgBox(a(9))
- 执行以下程序段后,数组b中的元素个数有________个。Dim a() As Integer = {2, 15, 9, 4, 5, 56, 74, 8, 43, 10}Dim b(9) As IntegerDim count As Integer = 0Dim i As IntegerFor i = 0 To UBound(a)If a(i) Mod 2 = 0 Thenb(count) = a(i)count += 1End IfNextReDim Preserve b(count - 1)
- 使用下列命令定义了数组x后,所有数组元素具有相同的 ( )Dim x(99) As IntegerFor i = 0 To UBound(x) x(i) = iNext i A: 存储地址 B: 下标 C: 值 D: 类型