• 2021-04-14
    执行下列程序段后,程序的运行结果为()。 s = 1 For i = 1 To 3 For j = 0 To i - 1 s = s + s * j Next j Print s; Next i
  • 1 2 12

    内容

    • 0

      有如下语句,执行后该段语句的循环次数是_____。 Dim s,I,j as integer For I =1 to 3 For j=3 To 1 Step-1 S=I*j Next j Next I

    • 1

      下列程序段的执行结果为【 】。 K=0 For J=1 To2 For I = 1 To 3 K=I+1 Next I For I=1 To7 K=K+I Next I Next J Print K

    • 2

      下列程序段的执行结果为 _______。 Dim a(3, 5) As Integer Dim i As Integer, j As Integer For i = 1 To 3 For j = 1 To 5 a(i, j) = a(i - 1, j - 1) + (i - 1) * 5 + j Next j Next i Print a(3, 4)

    • 3

      下列程序段的执行结果为_______。 M=0 For I=1 To 3 For J =5 To 1 Step-1 N = N+1 Next J,I Print N;J;I

    • 4

      下面程序运行的结果为int i,j,s=0;for(i=1,j=5;i<;j;i++,j--){s+=i*10+j;}System.out.println(s);

    • 5

      有如下程序段:s = 0For i = 1 To 10 s = s + iNext iPrint s与上述程序段输出结果相同的程序段为( )。 A: s = 0: i = 0 While i <= 10 i = i + 1 s = s + i Wend Print s B: s = 0: i = 1 While i < 10 i = i + 1 s = s + i Wend Print s C: s = 0: i = 1 Do s = s + i i = i + 1 Loop While i < 10 Print s D: s = 0: i = 1 Do s = s + i i = i + 1 Loop Until i > 10 Print s

    • 6

      执行下面的程序段后,循环参数i、j的值分别为() For i=1 to 3 For j=4 to 1 setp -1 Print i*j Next j Next i

    • 7

      【其它】在下面的程序段中, s=s+p 语句的执行次数为 ___ 1 ___ , p*=j 语句的执行次数为 ___ 2 ___ ,该程序段的时间复杂度为 ___ 3 ___ 。 int i=0,s=0,j,p; while(++i<=n) { p=1; for(j=1;j<=i;j++) p*=j; s=s+p; } (3.0分)

    • 8

      运行下列程序,单击窗体显示的结果为( )。 Private Sub Form_Click() Dim a Dim s As Integer, i As Integer a = Array(1, 2, 3) For i = 2 To 0 Step -1 s = s + a(i) * a(i) Next i Print s End Sub

    • 9

      以下程序段中语句 Print i*j 执行的次数是。 For i=1 to 3 For j=5 to 1 step -1 Print i*j Next j,i

    • 10

      程序段 i=0;s=0; while(++i<=n){int p=1; for(j=0; j<i; j++) p*=j; s=s+p; }的时间复杂度为

    • 11

      单击窗体,在窗体上打印数列:2/1 ,3/2 ,5/3 ,8/5 ,13/8 … 的前10项,并求其和,将和保存在变量s中。 Private Sub Form_Click() Dim i%, j%, k%, m As Integer Dim s As Single s = 0 i = 2 'i为分子 j = 1 'j为分母 For k = 1 To 10 s = 【1】 Print i & "/" & j m = j j = i i = 【2】 Next Print s End Sub

    • 12

      下面的程序段执行后共循环了 次 For i = 1 To 2 For j = 5 To 1 Step -1 Print i*j Next j Next i

    • 13

      下列程序段的时间复杂度为。 s=0; for(i=1;i<n;i++) for(j=1;j<n;j++) s+=i*j;

    • 14

      执行下列程序段后,i和m的值为()。 m = 0 For i = 1 To 3 For j = 1 To i m = m + j Next j, i

    • 15

      下列程序段执行的结果是()。 declare @s int ,@i int ,@j int set @s=0 set @i=1 while @i&lt;=3 begin set @j=1 while @j&lt;=@i begin set @s=@s+@j set @j=@j+1 end set @i=@i+1 end <br/>print @s A: 12 B: 10 C: 6 D: 3