位置:首页 > 题库频道 > 其它分类 > 计算机其它 > 二级二级VB07年4月计算机等级考试二级VB考前密卷(3)

单击一次命令按钮后,下列程序的执行结果是Private Sub Command1_Click()s=P(1) + P(2) + P(3) + P(4)Print sEnd SubPublic Function P(N As Integer)Static SumFor i=1 To NSum=Sum + iNext iP=SumEnd Function

发布时间:2024-07-09

A.15

B.25

C.35

D.45

试卷相关题目

  • 1单击命令按钮时,下列程序的执行结果为Private Sub Command1_Click()Dim x As Integer, y As Integerx=12: y=32Call PCS(x, y)Print x; yEnd SubPublic Sub PCS(ByVal n As Integer, ByVal m As Integer)n=n Mod 10m=m Mod 10End Sub

    A.12 32

    B.2 32

    C.2 3

    D.12 3

    开始考试点击查看答案
  • 2下列过程定义语句中,形参个数为不确定数量的过程是

    A.Private Sub Pro3(x As Double,y As Single)

    B.Private Sub Pro3(Arr(3),Option x,Option y)

    C.Private Sub Pro3(ByRef x,ByVal y,Arr( ))

    D.Private Sub Pro3(ParamArray Arr( ))

    开始考试点击查看答案
  • 3下列程序段的执行结果为a=1b=1For I=1 To 3f=a + ba=bb=fPrint f;Next I

    A.2 3 6

    B.2 3 5

    C.2 3 4

    D.2 2 8

    开始考试点击查看答案
  • 4下列程序段的执行结果为a=6For k=1 To 0a=a + kNext kPrint k; a

    A.-1 6

    B.-1 16

    C.1 6

    D.11 21

    开始考试点击查看答案
  • 5下面程序段执行结果为x=Int(Rnd() + 4)Select Case xCase 5Print "excellent"Case 4Print "good"Case 3Print "pass"Case ElsePrint "fail"End Select

    A.excellent

    B.good

    C.pass

    D.fail

    开始考试点击查看答案
  • 6下列程序的执行结果为Private Sub Command1_Click()Dim s1 As String, s2 As Strings1="abcdef"Call Invert(s1, s2)Print s2End SubPrivate Sub Invert(ByVal xstr As String, ystr As String)Dim tempstr As Stringi=Len(xstr)Do While i >=1tempstr=tempstr + Mid(xstr, i, 1)i=i - 1Loopystr=tempstrEnd Sub

    A.fedcba

    B.abcdef

    C.afbecd

    D.defabc

    开始考试点击查看答案
  • 7阅读下列程序:Private Sub Command1_Click()Dim i As Integer, k As Integerk=2For i=1 To 3Print H(k) ;Next iEnd SubFunction H(j As Integer)a=0Static ba=a + 1b=b + 1H=a*b + jEnd Function程序运行后,单击命令按钮输出结果是

    A.2 3 4

    B.3 4 5

    C.5 6 7

    D.3 5 6

    开始考试点击查看答案
返回顶部