• 2021-04-14
    中国大学MOOC: 设有如下程序代码:Private Function Fc(ByVal n As Integer) As Integer Fc = n * Fj(5)End FunctionPrivate Function Fj(ByVal n As Integer) As Integer Fj = n + 3End FunctionPrivate Sub Command1_Click() Dim a As Integer a = 3 Form1.Print Fc(a)End Sub程序时单击命令按钮,在窗体上输出的结果为( )。
  • 24

    内容

    • 0

      窗体上有一个名称为Command1的命令按钮,其中部分代码如下:Private Sub Command1_Click()Dim a(10)As IntegerDim n As Integer……Call calc(a,n)……End Subcalc过程的首行应该是()。 A: Sub calc(x() As Integer, n As Integer) B: Public Sub calc(x() As Integer) C: Private Sub calc(a(n) As Integer, n As Integer) D: Public Sub calc(a As Integer, n As Integer)

    • 1

      运行下面的程序,第二行显示结果是___________。 Private Sub Form_Click() Dim A As Integer Dim i As Integer A = 5 For i = 1 To 9 Call sub1(i, A) Print i, A Next i End Sub Private Sub sub1(x As Integer, y As Integer) Static N As Integer Dim I As Integer For I = 3 To 1 Step -1 N = N + x x = x + 2 Next I y = y + N End Sub

    • 2

      有如下函数过程: Function secproc(x As Integer, y As Integer, z As Integer) secproc = 3 * y + z + 2 * x End Function Private Sub Command1_Click() Dim a As Integer, b As Integer, c As Integer a = 2: b = 3: c = 4 Print secproc(c, b, a) End Sub 该程序的运行结果是( )。

    • 3

      编写如下程序: Private Sub Command1_Click; Dim m As Integer, n As Integer m = 2 : n = 1 Select Case m Case 1 Select Case n Case 1 Print "AAA" Case 2 Print "BBB" End Select Case 2 Print "CCC" End Select End Sub 程序运行后,单击命令按钮Command1,输出结果为 A: BBB B: CCC C: AAA D: 1

    • 4

      在窗体上画一个名称为 Command1 的命令按钮,然后编写下列通用过程和命令按钮的事件过程: Private Function fun(ByVal m As Integer) If m Mod 2=0 Then fun=2 Else fun=1 End If End Function Private Sub Command1_Click Dim i As Integer,s As Integer s=0 For i = 1 To 5 s=s+fun(i) Next Print s End Sub 程序运行后,单击命令按钮,在窗体上显示的是