当前位置:IT认证>BASIC题库

问题:[填空题]

[填空题] 设有如下程序 Private Sub Search(a( )As Variant,ByVa1 key As Variant,index%) Dim I% For I=LBound(a) To UBound(a)If key=a(1) Then index=I Exit Sub End If Next I index=I End Sub Private Sub Form_Load( ) Show Dim b( ) As Variant Dim n As Integer

  

参考答案:

E

  参考解析

根据题意,Search需要在数组a()中寻找等于key的数,如果找到了,则令In-dex等于该元素的下标值,如果没有找到,则令Index等于-1。根据,在调用Search时,11为b(8)的第6个元素,下标为5,故index为5。

微信端