2003年秋计算机等级考试答案(二级VB)

试题一:计算机基础题

一、单选题:

1

2

3

4

5

6

7

8

9

10

C

C

A

D

B

B

A

A

B

D

 

二、双选题:

11

12

13

14

15

AD

CD

BD

AB

AB

 

试题二:语言基础题

一、判断题:

16

17

18

19

20

21

22

23

24

25

×

×

×

×

×

 

二、单选题:

26

27

28

29

30

31

32

33

34

35

B

B

C

B

A

D

B

A

B

A

 

试题三:程序填空题

36

37

38

39

40

C

B

A

C

C

 

试题四:程序阅读题

1

2

3

4

37

55

64

28

19

3    5    11

19   26   59

1        1

2        3

3        6

4        10

5        15

12

1234

123456

12345614

 

试题五:程序设计题

1Private Sub Command1_Click()

     Dim x As Single, y As Single

     x = Val(InputBox("输入x"))

     If x < -2 Then

       y = x * x / (x + 1)

     ElseIf x <= 2 Then

       y = Sin(x) * Cos(x)

     Else

       y = Log(x)

     End If

     Print "y="; y

   End Sub

 

2Private Sub Form_Click()

     Const r As Integer = 1

     Dim i As Integer

     Picture1.Width = Picture1.Height

     Picture1.Scale (-10 * r, 10 * r)-(10 * r, -10 * r)

     For i = 1 To 10

       Picture1.Circle (0, 0), i * r

     Next i

   End Sub

 

3Private Type Student

     num As String

     s(1 To 5) As Single

   End Type

 

   Private Sub Form_Click()

     Dim stu() As Student, temp As Student

     Dim i%, j%, p%, n%, tnum$

     Open "c:\A.dat" For Input As #1

     Do While Not EOF(1)

       n = n + 1

       ReDim Preserve stu(1 To n)

       Input #1, stu(n).num

       For i = 1 To 4

         Input #1, stu(n).s(i)

         stu(n).s(5) = stu(n).s(5) + stu(n).s(i)

       Next i

     Loop

     Close #1

     For i = 1 To n - 1

       p = i

       For j = i + 1 To n

         If stu(j).s(5) > stu(p).s(5) Then p = j

       Next j

       temp = stu(p) : stu(p) = stu(i) : stu(i) = temp

     Next i

     Open "c:\B.dat" For Output As #1

     For i = 1 To n

       Print #1, stu(i).num;

       For j = 1 To 5

         Print #1, stu(i).s(j);

       Next j

       Print #1,

     Next i

   End Sub

 

 


 

2002年秋计算机等级考试答案(二级VB)

试题一:计算机基础题

三、单选题:

1

2

3

4

5

6

7

8

9

10

C

D

B

A

A

A

B

C

D

D

 

四、双选题:

11

12

13

14

15

AB

AD

AC

AD

BC

 

试题二:语言基础题

三、判断题:

16

17

18

19

20

21

22

23

24

25

×

×

×

×

×

 

四、单选题:

26

27

28

29

30

31

32

33

34

35

B

C

D

B

A

A

D

C

D

B

 

试题三:程序填空题

36

37

38

39

40

A

C

D

A

C

 

试题四:程序阅读题

1

2

3

4

78

5786

357864

13578642

2

3

4

5

32    64

16    64

8     64

4     64

6  15  28  45

 

试题五:程序设计题

1Private Sub Command1_Click()

     Dim n As Integer

     Dim i As Integer, sum As Single

     n = InputBox("input data n")

     sum = 1

     For i = 2 To n

       sum = sum + i / ((i + 1) * (i + 2))

     Next i

Text1.Text = Str(sum)

   End Sub

 

2Dim x1 As Integer, y1 As Integer

   Private Sub Form_Load()

     Pic1.FillStyle = 0

     Pic1.FillColor = vbGreen

Pic1.ForeColor = vbRed

   End Sub

   Private Sub Pic1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

     x1 = X

y1 = Y

   End Sub

   Private Sub Pic1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

Pic1.Line (x1, y1)-(X, Y), , B

   End Sub

 

3Private Sub Dir1_Change()

     File1.Path = Dir1.Path

   End Sub

 

   Private Sub Drive1_Change()

     Dir1.Path = Drive1.Drive

   End Sub

 

   Private Sub File1_Click()

     Dim str1 As String, str2 As String

     Dim Fname As String

     Dim i As Integer

     If Right(File1.Path, 1) = "\" Then

       Fname = File1.Path & File1.FileName

     Else

       Fname = File1.Path & "\" & File1.FileName

     End If

     Open Fname For Input As #1

     CommonDialog1.Action = 1

     Open CommonDialog1.FileName For Output As #2

     Do While Not EOF(1)

       Line Input #1, str1

       str2 = ""

       For i = 1 To Len(str1)

         If Mid(str1, i, 1) <> " " Then

           str2 = str2 & Mid(str1, i, 1)

         End If

       Next i

       Print #2, str2

     Loop

     Close

   End Sub

 


 

2001年秋计算机等级考试答案(二级VB)

试题一:计算机基础题

五、单选题:

1

2

3

4

5

6

7

8

9

10

B

B

C

B

A

C

D

A

D

A

 

六、双选题:

11

12

13

14

15

BD

CD

AD

CD

BC

 

试题二:语言基础题

五、判断题:

16

17

18

19

20

21

22

23

24

25

×

×

×

×

 

六、单选题:

26

27

28

29

30

31

32

33

34

35

B

C

D

D

B

C

D

B

C

A

36

37

38

39

40

 

B

B

D

A

A

 

 

试题三:程序填空题

41

42

43

44

45

46

47

48

49

50

D

B

A

C

A

D

C

A

D

C

 

试题四:程序阅读题

1

2

3

4

n= 3

x= 42

y= 9

n=1      z=4

n=2      z=7

n=3      z=10

x(1)=8

x(2)=6

x(3)=4

x(4)=3

x(5)=1

1     3

0     2

-1    1

 

试题五:程序设计题

1Private Sub Command1_Click()

     Dim x!, y!

     x = Val(InputBox("输入x的值"))

     If x > 10 Then

       y = Sqr(x) + Sin(x)

     ElseIf x = 0 Then