举一反三
- 如下程序的运行结果是【1】. Private Sub Command1_Click() Dim x As Integer x = 12 f2 x Print x End Sub Public Sub f2(n As Integer) n = n Mod 10 End Sub
- 下列程序运行的结果为()。 Public Sub f(n%, ByVal m%)...) Print x, y End Sub
- 运行下面的程序,第二行显示结果是___________。 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
- 以下程序运行后的输出结果是 ______。 Sub add(x,y) x=x+y Print "x=";x;",y=";y End Sub Private Sub Command1_Click() x=1 y=1 Call add((x),(y)) Print"x="; x;",y=";y End Sub A: x=1,y=1 B: x=2,y=2 C: x=2,y=1 D: x=1,y=1 E: x=1,y=1 F: x=1,y=1 G: x=2,y=1 H: x=2,y=1
- 编写如下程序: Private Sub Command1_Click() Dim x As Integer, y As Integer x = 1: y = 1 Do y = x * y If y > 10 Then Print x, y Exit Do Else x = x + 3 End If Loop While x <= 10 End Sub 运行程序,输出结果为______
内容
- 0
设有如下两个过程: Private Sub Form_Click() Dim x!,y! x = 18: y = 10 Call PPP((x), y) Print x,y End Sub Private Sub PPP(a As Single, b As Single) a = a + b Print a,b b = a + b Print a,b End Sub 运行程序后, 则输出结果是________
- 1
下面程序运行后,点击窗体,变量 x和y的值分别为( )、( ) Private Sub Form_Click() Dim x, y As Integer x = 5: y = 10 nc x, y Print "x="; x; "y="; y End Sub Private Sub nc(ByVal a%, b%) a = a + b b = a a = a * b End Sub
- 2
在窗体上添加一个命令按钮,程序运行时单击Commandl后,窗体上的输出结果为。 Private Sub fun(a%, ByVal b%) a=a*2:b=b*2 End Sub Private Sub Command1_Click() Dim x%,y% x=10:y=20 Call fun(x, y) Print x; y End Sub
- 3
声明一个变量为局部变量应该用( )。 A: Private Sub Command1 Click() n=5:x=1 Do X=X * I I=I + 1 Loop While I < n Print x End Sub B: Private Sub Command1_Click() n=5:X=1:I=1 Do X=X*I I=I + 1 Loop While I <n Print x End Sub C: Private Sub Command1_Click() n=5:X=1:I=1 Do X=X * I I=I + 1 Loop While I<=n Print X End Sub D: Private Sub Command1_Click() n=5:X=1:I=1 Do X=X * I I=I + 1 Loop While I>n Print X End Sub
- 4
单击命令按钮时,下列程序代码的执行结果为( )。 Private Sub Procl(nAs Integer,ByValmASInteger) n=nMod 10 m=m\10 End Sub PrivateSubCommandl_Click() Dimx As Integer Dimy As Integer x=12 y=34 CallProcl(x,y) Printx;y End Sub A: 12 34 B: 2 34 C: 2 3 D: 12 3