[单项选择题] 有如下程序:Private Sub Command1_Click( )a$="A WORKER IS OVER THERE" x=Len(a $) For i

15 查阅

[单项选择题] 有如下程序:Private Sub Command1_Click( )a$="A WORKER IS OVER THERE" x=Len(a $) For i=1 To x-1b$=Mid $(a $,i,2) If b $="ER"Then s=s+1 Next i Pdnt sEnd Sub程序运行后的输出结果是

A.1

B.2

C.3

D.4

参考答案:

C

Mid(a$,i,2)表示从字符串a$的第i个字符开始向后截取2个字符。由于“A WORKER IS OVER THERE’’中有三个“ER”,故s=s+1将被执行3次,即s最后的值为3。

计算机考试