栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验

[填空题] 设有如下程序 Private Sub Search(a( )As Variant,ByVa1 key As Variant,index%) Dim I% For I=LBound(a

面试经验 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

[填空题] 设有如下程序  Private Sub Search(a( )As Variant,ByVa1 key As Variant,index%)  Dim I%  For I=LBound(a

[填空题] 设有如下程序
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
b = Array(1,3,5,7,9,11,13,15)
Call Search(b, 11 ,n)
Print n
End Sub程序动行后,输出结果是 【15】


参考答案:

E

问题解析:

根据题意,Search需要在数组a( )中寻找等于key的数,如果找到了,则令In- dex等于该元素的下标值,如果没有找到,则令Index等于-1。根据,在调用Search时,11为b(8)的第6个元素,下标为5,故index为5。
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/251047.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号