试题 试卷
题型:单选题 题类:常考题 难易度:普通
浙江省高中信息技术 算法及VB语言表达基础同步练习
Dim i as Integer, max as Integer Dim a(1 to 10) as Integer
‘代码略,随机产生 10 个不重复的数存于数组 a 的 10 个元素 a(1)~a(10)中max=a(1)
For i=2 to 10
If a(i)>a(max) then max=i Next i
变量 max 用于存储( )
For i=1 to n
j = 1
a(j)=a(j)+1
Do While a(j)>7
a(j)=0 : j=j+1 : a(j)=a(j)+1
Loop
Next i
当n=102时,执行程序结束后数组a中各元素相加的和为( )
Dim a(1 To 5) As Integer
a(1) = 1
For i = 2 To 5
a(i) = Int(Rnd * 5) + 1
If a(i) Mod 2 = 0 Then
a(i) = a(i) + i
Else
a(i) = a(i) + a(i - 1)
End If
a(1)~a(5)的值不可能的是( )
import random s="12345678"
g=""
for i in range(3):
n=len(s)
pos=random.randint(1,n-1)
g+=s[pos]
s=s[0:pos]+s[pos+1:n] print(g)
在该程序段执行时,变量 g 的值可能为 ( )
试题篮