问题 单项选择题

以下程序的输出结果是( )。 Option Base 1 Private Sub Command1 Click() Dim a(10),p(3)as Integer k=5 For I=1 to 10a(i)=INext I For j=1 to 3p(i)=a(I*j)Next j For I=1 to 3k=k+p(I)*2 Next I Print k End Sub

A.33

B.28

C.35

D.37

答案

参考答案:A

解析: 此题中共定义了两个数组:a(i),p(i),共用到了3次For循环。第1个For语句对数组a(i)赋值,a(1)…a(10)=1…10;第2个For语句,对p(1)=1,p(2)=4,p(3)=9;第3个For语句,计算k的值,3次循环分别得到:5,15, 33。答案为A。

填空题
填空题