学习网考试学习资料

Gzu521.com

2007年9月计算机二级VB模拟试题(7)及答案(3)

全国计算机等级考试   点击:次   发布时间:2007-9-12   【字体: 】   来源:Gzu521.com
贵州学习网—属于你的学习中心

(29) 以下能够正确计算n!的程序是
a) private sub command1_click()
     n=5: x=1
     do
        x=x * i
      i=i + 1
     loop while i < n
     print x
   end sub
b) private sub command1_click()
     n=5: x=1: i=1
     do
        x=x * i
        i=i + 1
     loop while i < n
     print x
  end sub
c) private sub command1_click()
     n=5: x=1: i=1
     do
        x=x * i
        i=i + 1
      loop while i <=n
      print x
end sub
d) private sub command1_click()
     n=5: x=1: i=1
     do
        x=x * i
        i=i + 1
      loop while i > n
      print x
  end sub
正确答案:  c

(30) 下列程序段,在运行时最后输出的内容是
a=2
c=1
aaa:
c=c + a
if c < 10 then
     print c
     goto aaa
else
      print "10以内的奇数显示完毕"
end if
a) 3        
b) 7
c) 9        
d) 10以内的奇数显示完毕
正确答案:  d

(31) 单击命令按钮时,下列程序的执行结果为
private sub command1_click()
   dim a as integer, b as integer, c as integer
   a=2: b=3: c=4
   print p2(c, b, a)
end sub
private function p1(x as integer, y as integer, z as integer)
   p1=2 * x + y + 3 * z
end function
private function p2(x as integer, y as integer, z as integer)
   p2=p1(z, x, y) + x
end function
a) 21       
b) 19
c) 17       
d) 34
正确答案:  a

(32) 单击命令按钮时,下列程序的执行结果是
private sub book(x as integer)
   x=x * 2 + 1
   if x < 6 then
     call book(x)
   end if
   x=x * 2 + 1
   print x;
end sub
private sub command2_click()
   book 2
end sub
a) 23  47       
b) 10  36
c) 22  44       
d) 24  50
正确答案:  a

(33) 有如下程序:
private sub command1_click()
     dim k as integer, m as integer
     dim p as integer
     k=4: m=1
     p=pc(k, m) : print p;
     p=pc(k, m) : print p
end sub
private function pc(a as integer, b as integer)
     static m as integer, i as integer
     m=0: i=2
     i=i + m + 1
     m=i + a + b
     pc=m
end function
程序运行后,输出的结果为
a) 4  6       
b) 6  6
c) 8  8       
d) 10  12
正确答案:  c

(34) 有如下程序:
private sub command1_click()
   dim a as single
   dim b as single
   a=5: b=4
   call s(a, b)
end sub
sub s(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) 2  2       
d) 1  2
正确答案:  b

(35) 在窗体上画一个命令按钮,然后编写下列程序:
private sub command12_click()
   tt 3
end sub
sub tt(a as integer)
    static x as integer
     x=x * a + 1
     print x;
end sub
连续三次单击命令按钮,输出的结果是
a) 1  5  8      
b) 1  4  13
       c) 3  7  4      
       d) 2  4  8
正确答案:  b

上 一 页 下 一 页
文共4页:第 【1】 【2】 【3】 【4】

责任编辑:gzu521

IT认证分类
计算机软件水平考试
全国计算机等级考试
思科认证
微软认证
ORACLE/CIW认证
Linux认证
JAVA认证
其它认证
分类推荐信息
更多...
大类最新文章
更多...