举一反三
- 下面程序片段中有错误:Sub pric() Public x As Integer x = Array(1, 2, 3, 4, 5) ……End Sub为了避免出错,正确的修改方案是_______________。 A: 把Public x As Integer 改为Public x As Variant B: 把Public x As Integer 改为Dim x(5) C: 把Public x As Integer 改为Static x D: 把x = Array(1, 2, 3, 4, 5)改为x = Array(0, 1, 2, 3, 4)
- 设有下面程序 Sub inc(a As Integer) Static x As Integer x = x + a Print x; End Sub Private Sub Form_Click() inc 2 inc 3 inc 4 End Sub 程序运行后,单击命令按钮 Command1 ,则输出的结果是________
- 在窗体上画一个命令按钮,然后编写如下程序: Private Sub Comrnand3_Click( ) Cop 2 Cop 3 Cop 4 End Sub Sub Cop (a As Integer) Static x As Integer x=x + a Print x; End Sub 程序运行后,单击命令按钮,输出结果为 A: 2 3 4 B: 2 5 9 C: 3 5 4 D: 2 4 3
- 如下程序的运行结果是【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
- 设窗体上有一个Command1命令按钮,还有以下程序代码: Private Sub Command1_Click() Static x As Integer x=x+1 Call proc(x) Print x, End Sub Private Sub proc(a As Integer) Static x As Integer x=x+a:a=x End Sub 程序运行后,3次单击命令按钮,则产生的输出是 A: 1 2 3 B: 1 3 5 C: 1 3 7 D: 2 4 6
内容
- 0
如图所示事故树的最小割集为()。[img=171x267]17d608e17919de1.png[/img] A: {x<sub>1</sub>,x<sub>3</sub>},{x<sub>3</sub>,x<sub>4</sub>},{x<sub>1</sub>,x<sub>4</sub>,x<sub>5</sub>} B: {x<sub>1</sub>,x<sub>3</sub>},{x<sub>3</sub>,x<sub>4</sub>},{x<sub>1</sub>,x<sub>5</sub>},{x<sub>2</sub>,x<sub>4</sub>,x<sub>5</sub>} C: {x<sub>3</sub>,x<sub>4</sub>},{x<sub>1</sub>,x<sub>5</sub>},{x<sub>2</sub>,x<sub>4</sub>,x<sub>5</sub>} D: {x<sub>2</sub>,x<sub>3</sub>},{x<sub>1</sub>,x<sub>4</sub>},{x<sub>2</sub>,x<sub>4</sub>,x<sub>5</sub>}
- 1
要求程序运行时执行3 次循环体,输出结果为:3 5 7,请填空。 Private Sub Command1_Click() Dim x As Integer x = 1 Do x = x + 2 ________ Loop ________ x > 5 End Sub
- 2
方程(x+1)(x-3)=5的解是()。 A: x<sub>1</sub>=1,x<sub>2</sub>=-3 B: x<sub>1</sub>=4,x<sub>2</sub>=-2 C: x<sub>1</sub>=-1,x<sub>2</sub>=3 D: x<sub>1</sub>=-4,x<sub>2</sub>=2
- 3
运行下面的程序,第二行显示结果是___________。 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
- 4
下面程序运行后,输出结果是( )。 Private Sub mysub(b()As Integer,OptionalByValnAsInteger=2) ForI=1 to 4 b(I)=n*I NextI End Sub Private Sub Commandl_Click() Dima(1 to 4)As Integer,I As Integer Callmysub(a(),5) Mysuba() ForI=1 to 4 Print a(i); Next End Sub A: 5101520 B: 2468 C: 出错 D: 0000