《(完整word版)江苏省二级VB2006(秋)上机1试题及答案.pdf》由会员分享,可在线阅读,更多相关《(完整word版)江苏省二级VB2006(秋)上机1试题及答案.pdf(5页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、江苏省高等学校非计算机专业学生计算机基础知识和应用能力等级考试上机试题(2006 年秋)二级 Visual Basic 语言(试卷代号 VB01)(本试卷完成时间 70 分钟)一、改错(14 分)(题目)本程序用于验证210 之间的整数的立方都等于一串连续奇数的和。Option Explicit Private Sub Command1_Click()Dim i As Integer,st As String Dim n()As Integer,k As Integer For i=2 To 10 Call check(i,n)st=st&CStr(i)&3=&CStr(i 3)&=For k
2、=1 To UBound(n)-1 st=st&Str(n(k)&+Next k st=st&Str(n(k)&vbCrLf Next i Text1=st End Sub Private Sub check(n As Integer,a()As Integer)Dim sum As Integer,i As Integer,j As Integer Dim p As Integer n=n 3 For i=1 To n 2 Step 2 For j=i To n Step 2 p=0 sum=sum+j p=p+1 ReDim Preserve a(p)a(p)=j If sum=n The
3、n Exit For If sum n Then Exit For Next j Erase a sum=0 Next i End Sub 要求 1新建工程,输入上述代码,改正程序中的错误;2改错时,不得增加或删除语句,但可以适当调整语句位置;3将窗体文件和工程文件分别命名为F1 和 P1,并保存到软盘A 的根目录下。二、编程题(26 分)题目 编写一个找出所有五位绝对素数的程序。所谓绝对素数是指本身是素数,其逆序数也是素数的数。例如,10321 与 12301 都是素数,所以10321 是绝对素数。编程要求 1 程序参考界面如图所示,编程时不得增加或减少界面对象或改变对象的种类,窗体及界面元
4、素大小适中,且均可见。2按“查找”按钮,则开始查找并在列表框中显示结果;按“清除”按钮,则将列表框清空。3程序中应定义一个名为prime 的函数过程。用于判断一个整整数是否为素数;定义一个名为 nx 的过程,用于求一个正整数的逆序数。要求 将窗体文件和工程文件分别命名为F2 和 P2,并保存到软盘A的根目录下。文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V
5、3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3
6、G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:C
7、P4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB
8、4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7
9、L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码
10、:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2
11、HB4V3P2E9C2 ZO7L3G10J5R6答案:改错:Option Explicit Private Sub Command1_Click()Dim i As Integer,st As String Dim n()As Integer,k As Integer For i=2 To 10 Call check(i,n)st=st&CStr(i)&3=&CStr(i 3)&=For k=1 To UBound(n)-1 st=st&Str(n(k)&+Next k st=st&Str(n(k)&vbCrLf Next i Text1=st End Sub Private Sub chec
12、k(ByVal n As Integer,a()As Integer)Dim sum As Integer,i As Integer,j As Integer Dim p As Integer n=n 3 For i=1 To n 2 Step 2 p=0 文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP
13、4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4
14、V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L
15、3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:
16、CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 H
17、B4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO
18、7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6For
19、 j=i To n Step 2 sum=sum+j p=p+1 ReDim Preserve a(p)a(p)=j If sum=n Then Exit Sub If sum n Then Exit For Next j Erase a sum=0 Next i End Sub 编程:Private Sub Command1_Click()Dim n As Long,m As Long For n=10001 To 99999 Step 2 m=nx(n)If prime(n)And prime(m)And m n Then List1.AddItem(&n&,&m&)End If Next
20、 n 文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9
21、T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P
22、2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G1
23、0J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4
24、Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V
25、3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3
26、G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6End Sub Private Function prime(n As Long)As Boolean Dim i As Integer For i=2 To Int(Sqr(n)If n Mod i=0 Then Exit Function End If
27、Next i prime=True End Function Private Function nx(n As Long)Dim p As Integer,s As String For p=1 To 5 s=Mid(n,p,1)&s Next p nx=Val(s)End Function Private Sub Command2_Click()List1.Clear End Sub 文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P
28、2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G1
29、0J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4
30、Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V
31、3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3
32、G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:C
33、P4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6文档编码:CP4Q9T9V5J2 HB4V3P2E9C2 ZO7L3G10J5R6