题目

【加试题】某对分查找自定义函数search()的VB程序段如下:   Function search(key As Integer)As String     Dim pos As Integer,i As Integer,j As Integer     Dim nc As String     i=1:j=6:nc=“”     Do While i<=j         m=Int((i+j)/2)         nc=nc+Str(m)         If d(m)=key Then             Exit Do        ‘Exit Do表示退出Do While循环         ElseIf key<d(m)Then              j=m-1         Else              i=m+1     End If       Loop       search=nc     End Function 数组元素d(1)到d(6)的值依次为“23,34,45,65,78,98”,则下列说法正确的是 (  ) A . 调用函数search(25)的返回值为字符串“3  2” B . 调用函数search(34)的返回值为字符串“45  32” C . 调用函数search(56)的返回值为字符串“3  5  4” D . 调用函数search(98)的返回值为字符串“45  78  98” 答案:C
信息技术 试题推荐
最近更新