云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 江苏省二级VB笔试三年真题及答案

江苏省二级VB笔试三年真题及答案

  • 62 次阅读
  • 3 次下载
  • 2025/6/16 11:51:38

Private sub Command1_Click()

dim i as integer, j as integer, k as integer, st as string Dim a(6) as integer For i=100 to 999

if ______(18)_________ then For j=1 to 6

if a(j) Mod 6<>0 then Exit For Next j

if______(19)________THen st=st & str(i) k=k+1

if k mod 3 =0 then st=st & vbcrlf End if End if Next I Text1=st End Sub

Private Function fj(a() as integer, s as string) as Boolean Dim n as Integer, i as integer, j as integer if Instr(s,\ ___(20)___ end if

For i=1 to 3 For j=1 to 2 n=n+1

____(21)___

s=Left(s,1) & Right(s,1) & Mid(s,2,1) Next j

s=Right(s,1) & left(s,2) Next i fj=True End Function

8.下面程序的功能是求两个特大整数之和,由于vb中能够表示的整数大小有一定限制,所以必须用新的方法求特大整数之和,本程序将特大整数使用字符类型进行处理,其中函数add用于求两个1位整数之和,参数c用于保存进位,注意,求和前需首先将两个整数按位对齐 option explicit

private Sub command1_Click()

Dim s1 as string, s2 as string, s3 as string dim i as integer, n1 as integer, n2 as integer dim c as integer, n as integer s1=text1 : s2=Text2 n=______22_____ if sgn(n)>0 then

s2=________23__________

elseif Sgn(N)<0 then

s1=String(Abs(n),\ end if

For i=len(s1) to 1 step -1 n1=Val(Mid(s1,i,1)) n2=Val(Mid(s2,i,1))

s3=_______(24)________ Next i

if c<>0 then s3=________(25)________ Text3=s3 End Sub

Private Function Add(x as integer, y as integer, c as Integer) as string Add=Cstr((x+y+c) Mod 10) _________(26)________ End Function

9. 下面程序功能是:找出各位数字互不相同,且其6倍数仍由组成该数的数字构成的六位整数。例如:126873的6倍数是761238,就是符合条件的数。

提示:程序中用a,b数组成标示数组元素下标值对应的数字是否出现在六位整数中。例如:2出现在某六位整数中,则a(2)的值为1。 Option Explicit

Private Sub Command1_Click()

dim i as long,i2 as long, flag as Boolean Dim a(0 to 9) as integer, b(0 to 9) as integer For i=100000 to 160000 Call Validate(i,a,flag) if flag then i2=i*6

call Validate(i2,b,flag)

if flag and Compare(a,b) then List1.AddItem i & \ \ End if End if Next i end sub

Private Sub validate(n as long, a() as Integer, f as Boolean) dim p as integer, i as integer Erase a f=false

for i=1 to len(cstr(N)) p=___(27)___ if a(p)=1 then exit sub else a(p)=1

end if next i

___(29) f=true End Sub

Private Function Compare(a() as integer, b() as integer) as Boolean dim j as integer compare=false

for j=1 to Ubound(a) if a(j)<>b(j) then

____(30)____exit function End if next j

Compare=true End Function

0回答者: 011467

2010年春江苏计算机等级vb上机 Option Explicit

Private Sub Command1_Click()

Dim N As Integer, a() As Integer, i As Integer Dim st As String

N = InputBox(\数据个数n\查找\ReDim a(N) Call Find(a) For i = 1 To N

If i Mod 3 <> 0 Then '错误点3: N Mod 3 st = st & Str(a(i)) Else

st = st & Str(a(i)) & vbCrLf End If Next i Text1 = st

End SubPrivate Sub Find(a() As Integer)

Dim Ub As Integer, K As Integer, P As Integer Dim s As String Randomize

Ub = UBound(a) Do

P = Int(Rnd * 899) + 100 s = CStr(P)

If InStr(s, \错误点1:Or K = K + 1 a(K) = P End If

Loop Until K = Ub '错误点2K>Ub End Sub

以下答案仅供参考

1.D 2.B 3.C 4.B 5.A 6.D 7.C 8.B 9.D 10.D 11.D 12.B 13.B 14.B 15.C 16.A 17.B 18.C 19.C 20.A

21.A 22.B 23.B 24.A 25.C 26.C 27.B 28.C 29.C 30.A 二:填空题

(1)1 (2)5 (3)5 (4)2 3 (5)3 7 (6)15 (7)7 (8)30 (9) 7 (10)588 (11)11 (12)739

(13)ETME (14)EM (15)SSCLA (16)(-1)^(n+1)/(2*n-1) (17)ABS(t)<0.00001 (18)fj(a,cstr(i)) (19)j>6或j>=7 (20)Exit Function (21)a(n)=val(s)

(22)len(s1)-len(s2) (23)string(Abs(n),\

(24)Add(n1,n2,c) & s3 (25)c & s3 (26)c=(x+y+c)\\10 (27) Mid(n,i,1) (28)Exit Sub (29) f=true (30)Exit Function 改错题:

Option Explicit

Private Sub Command1_Click()

Dim N As Integer, K As Long, St As String For N = 500 To 800 K = N ^ 2

If Validate(N) And Validate(K) Then St = N & \ List1.AddItem St End If Next N End Sub

Private Function Validate(ByVal N As Long) As Boolean '错误点1byval Dim P As String, i As Integer, a() As Integer, j As Integer P = CStr(N) '错误点2str(n) ReDim a(Len(P)) For i = 1 To Len(P) a(i) = Mid(P, i, 1) Next i

For i = 1 To UBound(a) - 1 For j = i + 1 To UBound(a)

If a(i) = a(j) Then Exit Function '错误点3Exit For Next Next

Validate = True End Function

搜索更多关于: 江苏省二级VB笔试三年真题及答案 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

Private sub Command1_Click() dim i as integer, j as integer, k as integer, st as string Dim a(6) as integer For i=100 to 999 if ______(18)_________ then For j=1 to 6 if a(j) Mod 60 then Exit For Next j if______(19)________THen st=st & str(i) k=k+1 if k mod 3 =0 then st=st & vbcrlf End if E

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com