1 / 31

历年真题解析(一)

历年真题解析(一). 28.下面关于过程参数的说法,错误的是 ____________ 。 ( 05 春 28 ) A.过程的形参不可以是定长字符串类型 B.形参是定长字符串的数组,则对应的实参必须是定长字符串型数组,且长度相同   C.若形参是按地址传递的参数,形参和实参也能以按值传递方式进行形实结合 D.按值传递参数,形参和实参的类型可以不同,只要相容即可. 长度可以不同. 0.6. 1.8. 5.4.

lou
Download Presentation

历年真题解析(一)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 历年真题解析(一)

  2. 28.下面关于过程参数的说法,错误的是 ____________ 。 (05春28) A.过程的形参不可以是定长字符串类型 B.形参是定长字符串的数组,则对应的实参必须是定长字符串型数组,且长度相同   C.若形参是按地址传递的参数,形参和实参也能以按值传递方式进行形实结合 D.按值传递参数,形参和实参的类型可以不同,只要相容即可 长度可以不同

  3. 0.6 1.8 5.4 2.执行下面的程序,单击按钮 Command1 ,在窗体上显示的第一行是 ___ ,第二行是 ______ ,第三行是 _____ 。 (05春填空2) Option Explicit Private Sub Command1_Click() Dim x As Single, i As Integer x = 1.2 For i = 1 To 3 x = x * i Print fun1(x) Next i End Sub Private Function fun1(x As Single) As Single Static y As Single y = y + x fun1 = y / 2 End Function

  4. 10 27 9

  5. 11 2 43 4.执行下面的程序,单击按钮 Command1 ,窗体上显示的结果中 I 的值是 _____, J 的值是 ____, K 的值是 _____。(05春填空4) Option Explicit Private Sub Command1_Click() Dim i As Integer, j As Integer Dim k As Integer i = 1: j = 2 k = fun(i, fun(i, j)) + i + j Print "i="; i; "j="; j; "k="; k End Sub Function fun(a As Integer, ByVal b As Integer) As Integer a = a + b b = a + b fun = a + b End Function

  6. 29.程序中有两个过程Private Sub Fun1(S As String)和Private Sub Fun2(a() As String*6),在调用过程中用Dim St(6) As String*6定义了一个字符串数组。下面调用语句中正确的是。(05年秋29) ① Call Fun1(St(3)) ② Call Fun2(St) ③ Call Fun1(St) ④ Call Fun2(St(6) ) A.①② B.①③ C.②③ D.②④ 类型要匹配

  7. DCB D 3 3.运行下面的程序,当单击Command1时,窗体上显示的第一行内容是____,第三行内容是____,第四行内容是___。(05年秋填空题3) Private Sub Command1_Click() Print Test(3) End Sub Private Function Test(t As Integer) As Integer Dim i As Integer If t >= 1 Then Call Test(t - 1) For i = 3 To t Step -1 Print Chr(Asc("A") + i); Next i Print End If Test = t End Function

  8. 10 8 5 2 12 -10 4.运行下面的程序,当单击窗体时,窗体上显示的第一行内容是_____,第三行内容是______,第四行内容是______。(05年秋填空题4) Dim x As Integer, y As Integer Private Sub Form_Click() Dim a As Integer, b As Integer a = 5: b = 3 Call sub1(a, b) Print a, b Print x, y End Sub Private Sub sub1(ByVal m As Integer, n As Integer) Dim y As Integer x = m + n: y = m - n m = fun1(x, y) n = fun1(y, x) End Sub Private Function fun1(a As Integer, b As Integer) As Integer x = a + b: y = a - b Print x, y fun1 = x + y End Function

  9. 23.下面Sub子过程的各个语句中,正确的是_______(06年春23)23.下面Sub子过程的各个语句中,正确的是_______(06年春23) • Private Sub Sub1(A() As string) • Private Sub Sub1(A(1 to 10) As string*8) • Private Sub Sub1(S As string) • Private Sub Sub1(s As string*8) A abcd B abc C acd D ac 除非是形参数组,否则形参不可以是定长字符串类型

  10. 29.以下有关过程的说法中,错误的是_____(06年秋29)29.以下有关过程的说法中,错误的是_____(06年秋29) A.在Sub或Function过程中不能再定义其他Sub或Function过程 B.调用过程时,形参为数组的参数对应的实参既可以是固定大小数组也可以是动态数组 C.过程的形式参数不能再在过程中用Dim语句进行说明 D.使用ByRef说明的形式参数值形实结合时,总是按地址传递方式进行结合的

  11. 23.下列定义Sub过程的语句中,正确的是. (07年春23) A.     Private Sub Sub1(A()) B.     Private Sub Sub1(A as string *5) C.     Private sub sub1(ByVal a() as integer) D.     Private sub sub1(a(10) as integer)

  12. 27.下面关于对象作用域的说法中,正确的是 _____ (07年春27) A.在窗体模块中定义的全局过程,在整个程序中都可以调用它 B.分配给已打开文件的文件号,仅在打开该文件的过程范围内有效 C. 过程运行结束后,过程的静态变量的值仍然保留,所以静态变量作用域是整个模块 D.在标准模块中定义的全局变量的作用域比在窗体模块中定义的全局变量的作用域大

  13. 27、以下对数组参数的说明中,错误的是。(07年秋27)27、以下对数组参数的说明中,错误的是。(07年秋27) A.在过程中可以用Dim语句对形参数组进行声明 B.形参数组只能按地址传递 C.实参为动态数组时,可用ReDim语句改变对应形参数组的维界 D.只需把要传递的数组名作为实参,即可调用过程 过程的形式参数不能再在过程中用Dim语句进行说明

  14. 11 61 136 3.执行下面程序,单击命令按钮Command1后,显示在窗体上第一行的内容是___ ,第二行的内容是____,最后一行的内容是_____ (06年春填空3) Option Explicit Dim N As Integer Private Sub Command1_Click() Dim I As Integer, J As Integer For I = 3 To 1 Step -2 N = Fun(I, N) Print N Next I End Sub Private Function Fun(A As Integer, B As Integer) As Integer Static X As Integer Dim Sum As Integer, I As Integer X = X + N For I = 1 To A B = B + X + I N = N - I \ 2 Sum = Sum + B Next I A = A + 1 Fun = Sum + A End Function

  15. 4.执行下面程序,单击命令按钮Command1后,显示在窗体上第一行的内容是 _______ ,A(2,1)的值是____ ,A(3,3)的值是____(06年春填空4) 01 05 02 8 3 Private Sub SUB1(A() As Integer) Dim N As Integer, K As Integer, J As Integer N = UBound(A, 1) For I = 1 To N - 2 For J = I To N - I A(I, J) = K + 1 A(J, N + 1 - I) = K + 2 A(N + 1 - I, N + 1 - J) = K + 3 A(N + 1 - J, I) = K + 4 K = K + 4 Next J Next I If N Mod 2 <> 0 Then A((N + 1) / 2, (N + 1) / 2) = K + 1 End If End Sub Option Base 1 Private Sub Command1_Click() Dim A(3, 3) As Integer, K As Integer Dim I As Integer, J As Integer Call SUB1(A) For I = 1 To 3 For J = 1 To 3 Print Right("0" & A(I, J) & " ", 3); Next J Print Next I End Sub

  16. 8 16 4 5.执行下面程序,单击命令按钮Command1后,显示在窗体上第一行的内容是___ , 第二行的内容是___ ,第三行的内容是___. (06年春填空5) Option Explicit Private Sub Command1_Click() Dim N As Integer, M As Integer N=2 DO While m<3 N=N+2 If Fun(N) Then Print N M=M+1 End If Loop End Sub Private Function Fun(ByVal N As Integer) As Boolean If N/2=Int(N/2)Then Fun=Fun(N/2) Else If N=1 Then Fun=True End If End Function

  17. asicB icBas • 执行下面程序,单击Command1按钮,多行文本框Text1中显示的第一行是______、第三行是_____(06年秋填空1) Option Explicit Private Sub Command1_Click() Dim st As String, n As Integer, ast As String St=”Basic” n=Len(st) Do ast = change (st, n) Text1=Text1 & ast & vbCrlf n=n-1 Loop Until n<=1 End Sub Private Function change(st As String ,n As Integer) As String Static p As Integer p=p+1 change=Right(st,n-1) & Left(st,p) End Function

  18. 15 36 26 3.执行下面的程序,单击Command1按钮,窗体上显示的第一行是____、第二行是___、第三行是___(06年秋填空3) Option Explicit Private Sub Command1_Click() Dim I As Integer, n As Integer For I = 5 To 15 Step 2 n = fun1(I, I) Print n Next I Print I End Sub Private Function fun1(ByVal a As Integer, b As Integer) b = a + b fun1 = a + b End Function

  19. 17 178 178 4.执行下面的程序,在文本框Text1中输入数据15768后单击Command1按钮,窗体上显示的第一行是______、第二行是________、第三行是_______。(06年秋填空4) Option Explicit Private Function pf(x As Integer) As Integer If x < 100 Then pf = x Mod 10 Else pf = pf(x \ 100) * 10 + x Mod 10 Print pf End If End Function Private Sub Command1_click() Dim x As Integer x = Text1 Print pf(x) End Sub

  20. 1 1 1 3 1 4 1 3 1 2、执行下面的程序,当单击Command1时,窗体上显示的内容的第二行是、第三行是,第四行是。(07年春填空2) Option Explicit Private Sub Command1_Click() Dim a As Integer, b As Integer, z As Integer a = 1: b = 1: z = 1 Call p1(a, b) Print a, b, z Call p1(b, a) Print a, b, z End Sub Sub p1(x As Integer, ByVal y As Integer) Static z As Integer x = x + z y = x - z z = x + y Print x, y, z End Sub

  21. 42 5796 138 4、执行下面程序,单击Command1按钮后,变量fir值是,变量sec值是,变量thir值是. (07年春填空4) Private Sub Command1_Click() Dim fir As Integer, sec As Integer, thir As Integer fir = 96 sec = 421 thir = 3857 Call look_for(fir, sec, thir) Print fir; sec; thir End Sub Sub look_for(f As Integer, s As Integer, t As Integer) Dim tem As String If 1# * f * s <> t Then tem = Left(CStr(f), 1) f = Right(CStr(f), 1) & Left(CStr(s), 1) s = Right(CStr(s), 2) & Left(CStr(t), 1) t = Right(CStr(t), 3) & tem Call look_for(f, s, t) End If End Sub

  22. 5、执行下面程序,单击command1按钮后,显示在窗体上的第一行内容是、第二行内容是、第三行内容是。(07年春填空5)5、执行下面程序,单击command1按钮后,显示在窗体上的第一行内容是、第二行内容是、第三行内容是。(07年春填空5) 34 26 8 Option Explicit Dim a As Integer Private Sub Command1_Click() Dim b As Integer a = 1 b = 2 Print fun1(fun1(a, b), b) Print a Print b End Sub Function fun1(x As Integer, y As Integer) As Integer Dim i As Integer For i = 1 To y y = y + 1 x = x + 1 a = x + y Next i fun1 = a + y End Function

  23. 3. 执行下面的程序,单击命令按钮Command1,则窗体上第一行显示的是_________,第二行显示的是__________。(07年秋填空3) 江苏省计算机等级考试二级VB 8 -2 6 -2 Private Sub process(n As Integer) Dim y As Integer If n > 0 Then x = x - n y = x Else x = x + n y = x + 2 End If n = -n End Sub Option Explicit Dim x As Integer Private Sub Command1_Click() Dim y As Integer x = 10: y = 2 Call process(y) Print x, y Call process((y)) Print x, y End Sub

  24. 5.执行下面的程序,单击Command1,在窗体界面上显示的第一行是__________,第二行是__________,第三行是__________,第四行是__________。(07年秋填空5)5.执行下面的程序,单击Command1,在窗体界面上显示的第一行是__________,第二行是__________,第三行是__________,第四行是__________。(07年秋填空5) 江苏省计算机等级考试二级VB 12 18 36 12 18 36 36 12 Private Function lcd(x As Integer, y As Integer) As Integer Dim d As Integer If x < y Then d = x: x = y: y = d End If d = x Do If x Mod y = 0 Then lcd = x Exit Do Else x = x + d End If Loop End Function Option Explicit PrivateSub Command1_Click() Dim a As Integer, b As Integer, i As Integer i = 1218 a = i \ 100 b = i Mod 100 If b <> 0 Then Print a Print b Print lcd((a), (b)); a; b Print lcd(a, b); a; b End If End Sub

  25. 3. 运行下面的程序,单击Command1,在窗体上显示的变量b的值为(7),变量c的值为(8),变量z的值为(9)。(08春) Option Explicit Private Sub Command1_Click() Dim b As Integer, c As Integer, z As Integer b = 2 c = 1 z = fun(b, fun(b + 1, c)) + b - c + 1 Print b, c, z End Sub Private Function fun(x As Integer, ByVal y As Integer) As Integer x = x - y y = x + y + 2 fun = y - x End Function

  26. 4.执行下面的程序,单击Command1,输出的变量i的值是(10),变量j的值是(11),变量k的值是(12)。(08春)4.执行下面的程序,单击Command1,输出的变量i的值是(10),变量j的值是(11),变量k的值是(12)。(08春) Option Explicit Private Sub Command1_Click() Dim i As Integer, j As Integer Dim k As Integer i = 10 j = 4 k = Funk(i, j) Print i, j, k End Sub Private Function Funk(ByVal A As Integer, B As Integer) As Integer A = A + B B = B - 2 If B = 0 Or B = 1 Then Funk = 1 Else Funk = A + Funk(A, B) End If End Function

  27. 5.运行下列程序,单击Command1,在窗体上显示的第一行内容是(13),第二行的内容是(14),第三行的内容是(15)。(08春)5.运行下列程序,单击Command1,在窗体上显示的第一行内容是(13),第二行的内容是(14),第三行的内容是(15)。(08春) Option Explicit Private Sub Command1_Click() Dim n As Integer, i As Integer n = 2 For i = 7 To 1 Step -1 Call sub2(i, n) Print i, n Next i End Sub Private Sub sub2(x As Integer, y As Integer) Static n As Integer Dim i As Integer For i = 2 To 1 Step -1 n = n + x x = x - 1 Next i y = y + n End Sub

  28. 2.执行下面程序,单击Command1,窗体上显示的第一行是 (4) ,第二行是 (5) ,第四行是 (6) 。 (08秋) Option Explicit Private Sub Command1_Click() Dim a As Integer, b As Integer, i As Integer a = 2: b = 5 For i = a To a * b Step a Call sub1(i, a, b) Print a, b Next i Print a, b, i End Sub Private Sub sub1(i As Integer, a As Integer, b As Integer) i = i + 1 a = a + 1 b = b + 1 End Sub

  29. 3. 运行下面的程序,单击Command1,在窗体上显示的变量a的值为(7),变量b的值为(8),变量c的值为(9)。(08秋) Option Explicit Private Sub Command1_Click() Dim a As Integer, b As Integer, c As Integer a = 5: b = 10: c = 15 Print fun(a, b, c) + fun(a, b, c) Print a, b, c End Sub Private Function fun(x As Integer, y As Integer, z As Integer) As Integer z = x x = x + y y = y + z fun = x + y End Function

  30. 4.执行下面的程序,单击Command1,窗体上显示的第一行是(10),第二行是(11),第四行是(12)。 (08秋) Option Explicit Private Sub Command1_Click() Dim a As Integer, b As Integer a = 1 : b = 1 Call sub1(a, b) Print a, b End Sub Private Sub sub1(a As Integer, b As Integer) a = a + b: b = b + a Print a, b If a > 10 Then a = a + b b = b + a Else Call sub1(a, b) End If End Sub

  31. 5.运行下列程序,单击Command1,在窗体上显示的第一行内容是(13),第二行的内容是(14),第三行的内容是(15)。5.运行下列程序,单击Command1,在窗体上显示的第一行内容是(13),第二行的内容是(14),第三行的内容是(15)。 Option Explicit (08秋) Private Sub Command1_Click() Dim s As String s = "Basic" Call trans(s) End Sub Private Sub trans(s As String) Dim j As Integer, t As String Dim k As Integer k = 3 Do j = InStr(s, "a") t = LCase(Right(s, j)) s = Right(t, Len(s) - k) & Left(s, Len(t)) k = k - 1 Print s Loop Until k = 0 End Sub

More Related