• 2022-05-27
    中国大学MOOC: 下面程序片段中有错误:Sub pric() Public x As Integer x = Array(1, 2, 3, 4, 5) ……End Sub为了避免出错,正确的修改方案是_______________。
  • 把Public x As Integer 改为Static x

    内容

    • 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