、
Private Sub Command1_Click( )
Listl Clear
End Sub
、
Private Sub Command1_Click( )
List1.Clear List1.ListIndex
End Sub
、
Private Sub Command1_Click( )
List1.RemoveItem List1.ListIndex
End Sub
、
Private Sub Command1_Click( )
List1.RemoveItem
End Sub
答案:
20、【
单选题
】 某人设计了下列程序用于计算并输出7!(7的阶乘):
Private Sub Command1_Click( )
t=0
Fork=7 To 2 Step -1
t=t*k
Next
Print t
End Sub
执行程序时,发现结果是错误的。下列修改方案中能够得到正确结果的是( )。
[2分]
、
Private Sub save_Click( )
Text1.Text=file.save.Caption
End Sub
、
Private Sub save _Click( )
Text1.Text=save.Caption
End Sub
、
Private Sub file_Click( )
Text1.Text=file.save.Caption
End Sub
、
Private Sub file_ Click( )
Text1.Text=save.Caption
End Sub
答案:
23、【
单选题
】 某人在窗体上画了一个名称为Timer1的计时器和一个名称为Label1的标签,计时器的属性设置为Enabled=True,Interval=0,并编程下列。希望在程序运行时,可以每2秒在标签上显示一次系统当前时间。
Private Sub Timer1_Timer( )
Label1.Caption=Time$
End Sub
在程序执行时发现未能实现以上目的,那么,他应做的修改是( )。
[2分]
27、【
单选题
】 下列程序执行时,在窗体上显示的是( )。
Private Sub Command1_Click( )
Dim a(10)
For k=1 To 10
a(k)=11-k
Next k
Print a(a(3)\a(7)Mod a(5))
End Sub
[2分]
、
3
、
5
、
7
、
9
答案:
28、【
单选题
】 为达到把a、b中的值交换后输出的目的,某人编程下列:
Private Sub Command1_Click( )
a%=10:b%=20
Call swap(a,b):Print a,b
End Sub
Private Sub swap(ByVal a As Integer,ByVal b As Integer)
c=a:a=b:b=c
End Sub
在运行时发现输出结果错了,需要修改。下面列出的错误原因和修改方案中正确的是( )。
[2分]
、
调用swap过程的语句错误,应改为Call swap a,b
、
输出语句错误,应改为Print"a","b"
、
过程的形式参数有错,应改为swap(ByRef a As Integer,ByRef b As Integer)
、
swap中3条赋值语句的顺序是错误的,应改为a=b:b=c:c=a
答案:
29、【
单选题
】 有下列函数:
Function fun(a As Integer, n As Integer)As Integer
Dim m As Integer
While a>=n
a=a-n∶m=m+1
Wend
fun=m
End Function
该函数的返回值是( )。
[2分]
、
a乘以n的乘积
、
a加n的和
、
a减n的差
、
a除以n的商(不含小数部分)
答案:
30、【
单选题
】 下列程序的输出结果是( )。
Private Sub Command1_Click( )
ch$="ABCDEF"
proc ch∶Print ch
End Sub
Private Sub proc(ch As String)
s=“ “
For k=Len(ch) To 1 Step -1
s=s&Mid(ch,k,1)
Next k
ch=s
End Sub
[2分]
、
ABCDEF
、
FEDCBA
、
A
、
F
答案:
31、【
单选题
】 某人编写了一个能够返回数组a中10个数中最大数的函数过程,代码下列:
Function MaxValue(a( )As Integer)As Integer
Dim max%∶max=1
For k=2 To 10
If a(k)>a(max)Then
max=k
End If
Next k
MaxValue=max
End Function
程序运行时,发现函数过程的返回值是错的,需要修改,下列的修改方案中正确的是( )。
[2分]
、
语句max=1应改为 max=a(1)
、
语句For k=2 To 10应改为For k=1 To 10
、
If 语句中的条件a(k)>a(max)应改为a(k)>max
、
语句MsxValue=max应改为MaxValue=a(max)
答案:
32、【
单选题
】 在窗体上画一个名称为Command1的命令按钮,然后编写下列事件过程:
Private Sub Command1_Click( )
Dim n%,b,t
t=1:b=1:n=2
Do
b=b*n∶t=t+b∶n=n+1
Loop Until n>9
Print t
End Sub
此程序计算并输出一个表达式的值,该表达式是( )。
[2分]
、
9!
、
10!
、
1!+2!+…+9!
、
1!+2!+…+10!
答案:
33、【
单选题
】 有一个名称为Fom1的窗体,上面没有控件,设有下列程序(其中方法PSet(X,Y)的功能是在坐标X、Y处画一个点):
Dim cmdmave As Boolean
Private Sub Form_MouseDown(Button As Integer,Shift As Integer,X As Single,Y AsSingle)
cmdmave =True
End Sub
Private Sub Form MouseMove(Button As Integer,Shift As Integer,X As Single,Y AsSingle)
If cmdmave Then
Form1.PSet(X,Y)
End If
End Sub
Private Sub Form_MouseUp(Button As Integer,Shift As Integer,X As Single,Y As Singgle)
cmdmave=False
End Sub
此程序的功能是( )。
[2分]
、
每按下鼠标键一次,在鼠标所指位置画一个点
、
按下鼠标键,则在鼠标所指位置画一个点;放开鼠标键,则此点消失
、
不按鼠标键而拖动鼠标,则沿鼠标拖动的轨迹画一条线
、
按下鼠标键并拖动鼠标,则沿鼠标拖动的轨迹画一条线,放开鼠标键则结束画线
答案:
34、【
单选题
】 某人设计了下列函数fun,功能是返回参数a中数值的位数
Function fun(a As Integer)As Integer
Dim n%
n=1
While a\10>=0
n=n+1∶a=a\10
Wend
fun=n
End Function
在调用该函数时发现返回的结果不正确,函数需要修改,下列修改方案中正确的是( )。
[2分]
、
Private Sub Check1_Click(Index As Integer)
Text1.Text=“ “
For k=0 To 3
If Check1(k).Value=1 Then
Text1.Text=Text1.Text & Check1(k).Caption & “ “ '双引号中是空格
End If
Next k
End Sub
、
Private Sub Check1_Click(Index As Integer)
For k=0 To 3
If Check 1(k).Value=1 Then
Text1.Text=Text1.Text & Check1(k).Caption &" " '双引号中是空格
End If
Next k
End Sub
、
Private Sub Check1_Click(Index As Integer)
Text1.Text=" "
For k=0 To 3
If Check1(Index).Value=1 Then
Text1.Text1=Text1.Text & Check1(Index).Caption &" "
'双引号中是空格
End If
Next k
End Sub
、
Private Sub Check1_Click(Index As Integer)
Text1.Text=" "
For k=0 To 3
If Checkl(k).Value=1 Then
Text1.Text=Text1.Text & Checkl(k).Caption &" " '双引号中是空格
Exit For
End If
Next k
End Sub