学习网考试学习资料

Gzu521.com

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

全国计算机等级考试   点击:次   发布时间:2007-9-13   【字体: 】   来源:Gzu521.com
GZU521.COM学习网

(31) 有如下程序段:
private sub command1_click()
   dim a as integer
   a=2
   for i=1 to 3
      print g(a)
   next i
end sub
function g(a as integer)
   b=0
   static c
   b=b + 1
   c=c + 1
   g=a + b + c
end function
运行上面的程序后,单击命令按钮,输出结果为
a) 1  2  3      
b) 2  3  4
c) 4  5  6      
d) 1  4  6
正确答案:  c

(32) 单击命令按钮时,下列程序的运行结果为
private sub command1_click()
   print mybm(23, 18)
end sub
public function mybm(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
   mybm=m
end function
a) 0        
b) 1
c) 3        
d) 5
正确答案:  b

(33) 有如下的程序:
private sub command1_click()
   dim k as integer, m as integer
   dim p as integer
   k=4: m=1
   p=pid(k, m) : print p;
   p=pid(k, m) : print p
end sub
private function pid(a as integer, b as integer)
   static m as integer, i as integer
   m=5: i=2
   i=i + m + 1
   m=i + a + b
   pid=m \ 2
end function
单击命令按钮后,输出结果为
a) 2  2       
b) 4  4
c) 55       
d) 6  6
正确答案:  d

(34) 下面4个ct函数中是用来判断用户输入的数是否为奇数的,是奇数的返回1,否则返回0,其中正确的是
a) function ct(byval a as integer)  
     if a mod 2=0 then      
        return 0           
     else        
        return 1       
     end if         
  end function
b) function ct(byval a as integer)
 if a mod 2=0 then
  ct=0
   else
     ct=1
 end if   
    end function
c) function ct(byval a as integer)  
      if a mod 2=0 then      
         ct=1             
      else            
         ct=0                 
      end if            
     end function         
       d) function ct(byval a as integer)
               if a mod 2=0 then
                  return 1
                          else
                  return 0
                 end if
             end function
考生答案:      正确答案:  b

(35) 在窗体上画一个命令按钮,然后编写如下事件过程:
private sub command1_click()
   dim m as integer, n as integer, p as integer
   m=3: n=5: p=0
   call y(m, n, p)
   print str(p)
end sub
sub y(byval i as integer, byval j as integer, k as integer)
   k=i + j
end sub
程序运行后,如果单击命令按钮,则在窗体上显示的内容是
a) 4        
b) 6
c) 8        
d) 10
正确答案:  c

二 、填空题
(1) 在算法正确的前提下,评价一个算法的两个标准是 【1】 。
正确答案:  1.(时间复杂度和空间复杂度)

(2) 将代数式 转换成程序设计中的表达式为 【2】 。
正确答案:  1.(sqr(x^2+y^2) /(a+b))

(3) 软件危机出现于60年代末,为了解决软件危机,人们提出了 【3】 的原理来设计软件,这就是软件工程诞生的基础。
正确答案:  1.(软件工程学)

(4)  【4】 是数据库设计的核心。
正确答案:  1.(数据模型)

(5) 在关系模型中,把数据看成一个二维表,每一个二维表称为一个 【5】 。
正确答案:  1.(关系)

(6) 有下面一个程序段,从文本框中输入数据,如果该数据满足条件,除以4余1,除以5余2,则输出,否则,将焦点定位在文本框中,并清除文本框的内容。
private sub command1_click()
   x=val(text1.text)
   if  【6】  then
      print x
   else
      text1.text=""
       【7】
   end if
end sub
正确答案:  1.(x mod 4 = 1 and x mod 5 = 2) 2.(text1.setfocus)

上一页 本文共4页:第 [1] [2] [3] [4]下一页

责任编辑:gzu521

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