全部题库 / VB / 试题详情
单选题 VB
2009-01-19

下列程序的执行结果是(  )。
Private Sub Form_Activate()
Dim score(3)As Integer,total As Integer
Dim aa score As Variant
score(1)=50:score(2)=14:score(3)=36
tota1=0:i=0
For Each aa_score In score
i=i+1
total=total+aa score
Print i,aa score,tota 1
Next
End Sub

A.100
B.1 50 50
C.0 50 50
D.0 0 0
2 50 50 2 14 64 1 14 64 1 50 50
3 14 64 3 36 100 2 36 100 2 14 64
4 36 100 3 36 100 3 36 100

参考答案

A

答案解析

本题中针对score数组中的每一个元素,程序循环执行过程如下:第1次循环:aa_score 取0.score 0此时i=1,total=0:第2次循环:aa 5.score取50,此时i=1,total=50:第3次循环:aa_score取14,此时i=2,total=64;第4次循环:aa score取36:此时i=3;total=100。