题目

【加试题】数组元素a(1)到a(10)中存储有10个整数,依次为2,5,7,7,9,11,12,13,13,17,使用两种算法查找特定的整数,部分程序如下: '顺序查找代码,查找次数用变量p表示 For i = 1 To 10If a(i) = Key Then p = iEnd If Next i '二分查找代码,查找次数用变量q表示 i=1 :j=10 :find=Fasle Do While i<=j And find=fasle x =(i+j)\2 q = q+1 If a(x)=Key Then find=True If a(x)>Key Then j=x-1 If a(x)<Key Then i=x+1 Loop 若变量key的值为13,程序运行后,则变量p和q的值分别是( ) A . 8和2 I’m going to read ________ English book. ( )A. a B. an C. the
信息技术 试题推荐