有如下程序: total = 0 For k = 1 To 3 If k> =1 Then part = 1 Elself k > = 2 Then part = 2 Elself k > =3 Then part = 3 Else part = 4 End If Print part; total = total + part Next k Print total 运行时输出的结果是 【14】 。
1 1 1 3
举一反三
- part 1 1-3 part 2 part 3 part 4
- 下列程序段的执行结果为( )。 a=5 For k=1 To 0 a=a * k Next k Print k;a A: 2 2 B: 4 3 C: 4 2 D: 3 2
- 运行下列程序,单击窗体后显示结果为( )。 Private Sub Form_Click() Dim k As Integer For k = 1 To 2 Print "3" + k; "3" & k; Spc(3); Next End Sub
- Part 1 Main idea: __________________________________________________________________________________________. Part 2 Main idea: __________________________________________________________________________________________. Part 3 Main idea: __________________________________________________________________________________________.
- 下列程序输出结果是______。 k=0 while k<=3: k=k+2 print(k) A: 0 B: 2 C: 3 D: 4
内容
- 0
下列程序的执行结果是______。 k =0 For i=1 To 3 a = i ^ i ^ k Print a; Next I A: 1 1 1 B: 1 2 3 C: 0 0 0 D: 1 4 9
- 1
设执行以下程序段时依次输入1、3、5,执行结果为 。 Dim a(4) As Integer, b(4) As Integer For k = 0 To 2 a(k + 1) = Val(InputBox("请输入数据:")) b(3 - k) = a(k + 1) Next k Print b(k) A: 1 B: 3 C: 5 D: 0
- 2
k = 0 while True: s = input('请输入q退出:') if s == 'q': k += 1 continue else: k += 2 break print(k) 运行上述程序,并且输入qp,则程序输出的结果是( ) A: 0 B: 1 C: 2 D: 3
- 3
下列程序的执行结果是____。 K=0 For I=1 To 3 a=I^I^K print a; Next I
- 4
以下代码的输出结果是() 1 a = { 'a': 'b',1:2,7:8} 2 for k in a: 3 print(k,end= ',') A: 'a':'b',1:2,7:8, B: a,1,7, C: b,2,8, D: k