(21) 下列程序段的执行结果为
m=1
n=1
select case m
case 1
select case n
case 0
print "**0**"
case 1
print "**1**"
end select
case 2
print "**2**"
end select
a) **0**
b) **1**
c) **2**
d) 0
正确答案: b
(22) 下列程序段的执行结果为
m=2
n=3
do
m=m + n
n=n + 1
loop while m < 10
print m; n
a) 1 5
b) 14 6
c) a b
d) 10 25
正确答案: b
(23) 有如下的程序段,该程序段执行完后,共执行的循环次数是
total=0
counter=1
do
print counter
total=total * counter+1
print total
counter=counter + 1
if total > 10 then
exit do
end if
loop while counter <=10
a) 4
b) 10
c) 15
d) 20
正确答案: a
(24) 下列程序的运行结果为
dim a(-1 to 6)
for i=lbound(a, 1) to ubound(a, 1)
a(i) =i
next i
print a(lbound(a, 1) ) ; a(ubound(a, 1) )
a) 0 0
b) -5 0
c) -1 6
d) 0 6
正确答案: c
(25) 下面的数组声明中,正确的是
a) dim pict[3,4] as integer
b) dim pict(3,4) as integer
c) dim pict[3.4] as integer
d) dim pict(3:4) as integer.
正确答案: b
(26) 下面的过程定义语句中不合法的是
a) sub para(byval n() )
b) sub para(n) as integer
c) function para(byval n)
d) function para(proc1)
正确答案: b
(27) 单击命令按钮时,下列的执行结果为
private sub command1_click()
dim x as integer, y as integer
x=86: y=29
call proc(x, y)
print x; y
end sub
public sub proc(n as integer, byval m as integer)
n=n mod 10
m=m mod 10
end sub
a) 12 32
b) 6 29
c) 2 3
d) 12 3
正确答案: b
(28) 下列程序的执行结果为
private sub command1_click()
dim firstr as string
firstr="abcdef"
print pct (firstr)
end sub
private function pct(xstr as string) as string
dim tempstr as string, strlen as integer
tempstr=""
strlen=len(xstr)
i=1
do while i <=len(xstr) - 3
tempstr=tempstr + mid(xstr, i, 1) + mid(xstr, strlen - i + 1, 1)
i=i + 1
loop
pct=tempstr
end function
a) abcdef
b) afBECd
c) fedcba
d) defabc
正确答案: b
(29) 单击命令按钮时,下列程序代码的运行结果为
private sub command1_click()
print myfunc(20, 18)
end sub
public function myfunc(m as integer, n as integer) as integer
do while m <> n
do while m > n: m=m - n: loop
do while m < n: n=n - m: loop
loop
myfunc=m
end function
a) 0
b) 2
c) 4
d) 6
正确答案: b
(30) 有如下程序:
private sub command1_click()
dim a as single
dim b as single
a=2: b=4
call cs (a, b)
end sub
sub cs (x as single, y as single)
t=x
x=t \ y
y=t mod y
end sub
程序运行后,单击命令按钮,a和b的值分别为
a) 0 0
b) 1 1
c) 0 2
d) 1 2
正确答案: c