最新计算机二级vb题库及答案精选
文件格式:DOCX
时间:2023-04-23 00:00:00    小编:guangju_dev

最新计算机二级vb题库及答案精选

小编:guangju_dev

人的记忆力会随着岁月的流逝而衰退,写作可以弥补记忆的不足,将曾经的人生经历和感悟记录下来,也便于保存一份美好的回忆。写范文的时候需要注意什么呢?有哪些格式需要注意呢?以下是小编为大家收集的优秀范文,欢迎大家分享阅读。

计算机二级vb题库及答案篇一

计算机等级考试越来越受到同学们的重视,下面是小编为大家整理的2017年计算机二级vb考试习题及答案,欢迎学习!

1.以下程序是求最大公约数和最小公倍数的程序,在【】处填写合适的关系运算符。

private sub form_click( )

dim m1, n1, m, n, r as integer

n1 = inputbox("输入自然数n", "输入数")

m1 = inputbox("输入自然数m", "输入数")

n = n1

m = m1

if m

t = m: m = n: n = t

end if

r = m mod n

do while r 【<>】 0

m = n

n = r

r = m mod n

loop

print "最大公约数=", n

print "最小公倍数= ", m1 * n1 / n

end sub

2.下面是求100以内素数的程序。

private sub command1_click( )

dim i as integer, m as integer, tag as boolean

for m = 2 to 100

tag = true

for i = 2 to m - 1

if m mod 【i】 = 0 then tag = false

next i

if tag then print m

next m

end sub

3.下面是求100以内素数的程序,下面说法正确的是(a)(单)

private sub command1_click( )

dim i as integer, m as integer, tag as boolean

for m = 2 to 100

tag = true

for i = 2 to m - 1

if m mod i = 0 then tag = false

next i

if tag=true then print m

next m

end sub

为true时,表示m是素数

为false时,表示m是素数

c.语句m mod i = 0,说明m是素数

d.以上说法都不正确

4.百元买百鸡问题: 假定小鸡每只5角,公鸡每只2元,母鸡每只3元。现在有100元钱要求买100只鸡,以下程序列出了所有可能的购鸡方案。

private sub command2_click( )

dim x%, y%, z%

for x = 0 to 33

for y = 0 to 50

if 3 * x + 2 * y + 0.5 * (100 - x - y) = 100 then

x, y, 【100-x-y,10-y-x】

end if

next y

next x

end sub

5.百元买百鸡问题: 假定小鸡每只5角,公鸡每只2元,母鸡每只3元。现在有100元钱要求买100只鸡,以下程序列出了所有可能的购鸡方案。

private sub command1_click( )

dim x%, y%, z%

for x = 0 to 33

for y = 0 to 50

for z = 0 to 100

if 3 * x + 2 * y + 0.5 * z = 100 and 【x+y+z=100】 then

x, y, z

end if

next z

next y

next x

end sub

6.随机产生10个100~200之间的数,求它们的最大值程序如下:

private sub command1_click( )

max = 100

for i = 1 to 10

x = int(rnd * 101 + 100)

print x;

if x > max then 【】

next i

print

print "最大值="; max

end sub

在此程序中,其中【】处应该填写的是(c)(单)

= 100

=200

= x

= 0

7.随机产生10个100~200之间的数,求它们的最大值程序如下:

private sub command1_click( )

max = 100

for i = 1 to 10

x = int【rnd*101+100或100+rnd*101或rnd()*101+100或100+rnd()*101】

print x;

if x > max then max=x

next i

print

print "最大值="; max

end sub

8.随机产生10个100~200之间的数,求它们的.最大值程序如下:

private sub command1_click( )

max = 100

for i = 1 to 10

x =int(rnd * 101 + 100)

print x;

if 【】 then max=x

next i

print

print "最大值="; max

end sub

在【】处应该填写的是:(a)(单)

a.x > max

b.x

c.x = max

d.以上都不正确

9.以下是求1~100之间5或7的倍数的和,如下程序段:

sum = 0

for i = 1 to 100

if i mod 5 = 0 or i mod 7 = 0 then

【】

end if

next i

print sum

其中【】处书写正确的是(b)(单)

= i

= sum + i

= sum + 5+7

d.以上都不正确

10.以下是求1~100的5或7的倍数的和程序段:

sum = 0

for i = 1 to 100

if i mod 5 = 0 or i 【mod】 7=0 then

sum = sum + i

end if

next i

print sum

猜你喜欢 网友关注 本周热点 软件
musicolet
2025-08-21
BBC英语
2025-08-21
百度汉语词典
2025-08-21
精选文章
基于你的浏览为你整理资料合集
复制