网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

以下程序的运行结果为: a=15 if a>15: print(5,end="") elif a>10: print(20,end="") elif a>5: print(35,end="")


参考答案和解析
D fun函数语句retun3(a++)+c;中访问的a,是其内部定义的静态局部变量,main函数中语句k+=f(a)访问的a是其局部变量,所以两次调用实际上都是调用f(3)。第一次调用时,fun函数中c=4,表达式(a++)+c的值为6,a递增为3,k=6。第二次调用时,fun函数种c=4,表达式(a++)+c的值为7,a递增为4,k=6+7=13。语句k+=a中的a是全局变量,所以k=13+l=14。
更多 “以下程序的运行结果为: a=15 if a>15: print(5,end="") elif a>10: print(20,end="") elif a>5: print(35,end="")” 相关考题
考题 执行下列程序,输入数字3,则输出结果为______。Private Sub Command1_Click()a=inputBox("Input a Number")If a>5 ThenGoTo L5Else If a>2 ThenGoTo L2ElseGoTo L3End IfExit SubL5:Print a Mod 5Exit SubL3:Print a Mod 3Exit SubL2:Print a Mod 2End Sub

考题 下面程序段执行结果为x=Int(Rnd() +4)Select Case xCase 5Print "excellent"Case 4Print "good"Case 3Print "pass"Case ElsePrint "fail"End SelectA.excellentB.goodC.passD.fall

考题 以下程序段运行的结果是: ______。 Dim a(-1 To 5)As Boolean Dim flag As Boolean flag=False Dim i As Integer Dim j As Integer Do Until flag=True For i=-1 To 5 j=j+1 If a(i)=False Then a(i)=True Exit For End If If i=5 Then flag=True End If Next Loop Print jA.20B.7C.35D.8

考题 下列块结构条件语句,正确的是( )。A.If x>10 Then print"a" Else if x>5 Then print"b" Else if x<5 Then print"c" End ifB.if x>10 Then print"a" Else if x>5 Print"b" Else Print"c" End ifC.If x>10 Then print"a" Else if x>5 Then print"b" Else x<5 Then Print"c" End ifD.If x>10 Then Print"a" Else if x>5 Then print"b: Else Print"c" End if

考题 下列程序段的执行结果是【 】。x=Int(Rnd+4)Select Case XCase 5Print"优秀"Case 4Print"良好"Case 3Print"合格"Case ElsePrint"不合格"End Select

考题 有如下程序: Private Sub Form Click() Dim Check,Counter Check=True Counter=0 Do Do While Counter<20 Counter=Counter+1 If Counter=10 Then Check=False Exit Do End If Loop Loop Until Check=False Print Counter,Check End Sub 程序运行后,单击窗体,输出结果为A.15 0B.20 -1C.10 TreeD.10 False

考题 下列程序段的执行结果为 a=2 b=0 Select Case a Case 1 Select Case b Case 0 Print " * * 0 * *" Case 1 Print" * * 1 * *" End selec Case 2 Print " * * 2 * *" End SelectA.* * 0 * *B.* * 1 * *C.* * 2 * *D.0

考题 运行下面程序后,正确的输出结果是 ______。Private Sub Command1_ Click() x = 6 if x >6 then Print "x>6": Else if x <8 then Print "x<8"; Else if x = 6 then Print "x=6": End if End if End ifEnd SubA.x<8 x=6B.x<8C.x=6D.x<8或x=6

考题 对窗体编写如下事件过程: Option Base 1 Private Sub Form_KeyPress (KeyAScii AS Integer) arr=Array(12,15,18,20,24) m1=arr(1) m2=1 If fKeyAscii=12 Then For i=2 To 5 If arr(i)>m1 Then m1=arr(i) m2=i End If Next i End If Print m1 Print m2 End Sub 程序运行之后按回车键,输出结果为A.12 1B.20 2C.18 5D.24 12

考题 假设X的值是5,则执行以下语句时,可得到的输出结果是ABCDEF的Select Case语句是 ( )A.Select Case X Case 10 To 1 Print“ABCDEF” End SelectB.Select Case X Case Is>15,Is<5 Print"ABCDEF" End SelectC.Selecl Case K Case Is>5,1,3,To 10 Print"ABCDEF" End SelectD.Select Case X Case 1,3,Is>5 Print"ABCDEF" End Select

考题 下列程序段( )能够正确实现条件:如果X<Y则A=15,否则A=-15。A.If X<Y Then A=15 A=-15 Prin AB.If X<Y Then A=15:Print A A=-15:Print AC.If X<Y Then A=1.5:Print A Else A=-15:Print A End IfD.If X<Y Then A=15 Else A=-15 Print A End If

考题 设窗体上有一个名为Text1的文本框和一个名为Command1的命令按钮,并有以下事件过程: Private Sub Command1 Click( ) X!=Val(Text1.Text) Select Casc x Case Is-10,Is=20 Print"输入错误" Case Is0 Print 20-x Case Is10 Print 20 Case Is=20 Print x+10 End Seleet End Sub 程序运行时,如果在文本框中输入-5,则单击命令按钮后的输出结果是( )。A.5B.20C.25D.输入错误

考题 有如下程序段,该程序段执行完后,执行循环的次数是 total=0 Counter=1 Do Print Counter total=total + Counter Print total Counter=Counter+1 If total>10 Then Exit Do End If Loop While Counter <=10A.5B.10C.15D.20

考题 下列程序段的执行结果为 m=1 n=1 Select Case m Case 1 Select Case n Case 0 print"A" Case 1 Print"B" End Select Case 2 Print"C" End SelectA.AB.BC.CD.0

考题 单击一次命令按钮之后,下列程序代码的执行结果为______。 Private Sub Command1_ Click() a = fun(4) + fun(5) Print a; End Sub Public Function fun (n As Integer) Static Num For i = 1 To n Num = Num + i Next i fun = Num End FunctionA.15B.20C.35D.40

考题 有如下程序: include using namespace std; class TestClass { private: int x,y; pu 有如下程序: #include<iostream> using namespace std; class TestClass { private: int x,y; public: TestClass (int i,int j) { x=i; y=j; } void print() { cout<<"print1"<<end1; } void print()const { cout<<"print2"<<end1; } }; int main() { const TestClass a(1,2); a.print(); return 0; } 该程序运行后的输出结果是( )。A.print1B.print2C.print1 print2D.程序编译时出错

考题 以下程序运行后输出的结果是______。 Private Sub Form. _Click() a=0 For j=1 To 15 a=a+j Mod 3 Next j Print a End SubA.10B.15C.80D.100

考题 下列程序段的执行结果为m=1n=1Select Case mCase 1Select Case nCase 0print "A"Case 1Print "B"End SelectCase 2Print "C"End SelectA.AB.BC.CD.0

考题 下面程序段执行结果为x=Iht(Rnd()+4)Select Case x Case 5 Print"excellent" Case 4 Print"good" Case 3 Print"paSS" Case Else Print "fail"End SelectA.excellentB.goodC.passD.fail

考题 阅读程序: Sub Form_Click() a=10 : b=15 : c:20 : d=25 Print a;Spc(5);b;Spc(7);c Print a;Space(8);b;Space(5);c Print c;Spc(1);"+";Spc(1);d; Print Spc(1);"=";Spc(1);c+d End Sub 运行上面的程序,单击窗体后,第三行输出的结果是A.■20■+■25■=■45■B.20+25=45C.10 15 20D.20 25 45

考题 下列程序的执行结果为 Private Sub Comrnandl_Click( ) Dim p As Integer, q As Integer p=12:q=20 Call Value(p, q) Print p; q End Sub Private Sub Value(ByVal m As Integer, ByVal n As Integer) m=m * 2: n=n - 5 Print m; n End SubA.20 12 20 15B.12 20 12 25C.24 15 12 20D.24 12 12 15

考题 下列程序段的执行结果为______。 x=Int (Rnd+4) Select Case x Case 5 Print“优秀” Case 4 Print“良好” Case 3 Print“通过” Case Else Print“没有通过” End SelectA. 优秀B.良好C.通过D.没有通过

考题 执行以下程序段,如果在对话框中输入8,输出结果是"Hello"的是______。A.n = InputBox("请输入一个数") Select Case n Case 7 To 1 Print "Hello" End SelectB.n = InputBox("请输入一个数") Select Case n Case Is>1, Is < 6 Print "Hello" End SelectC.n = InputBox("请输入一个数") Select Case n Case Is > 5, 1, 3 To 10 Print "Hello" End SelectD.n=InputBox("请输入一个数") Select Case n Case 1, 5, Is > 9 Print "Hello" End Select

考题 下面程序段执行结果为( )。 x=Int(Rnd()+4) Select Case x Case 5 Print"excellent" Case4 Print"good" Case 3 Print"pass" Case Else Print"fail" End SelectA.excellentB.goodC.passD.fail

考题 阅读下列程序: Private Sub Form Click() Dim i As Integer, sum As Integer For i = 2 To 10 If i Mod 2 <> 0 Then Print i; Else sum = sum + i End If Next i Print sum End Sub 程序运行后,单击窗体,在窗体上的输出结果是A.3 5 7 9 30B.1 3 5 7 9C.2 4 6 8 20D.11 15 17 19 20

考题 下列程序段的执行结果为______。 Private Sub Command1_Click() a=1:b=1 Select Case a Case 1 Select Case b Case 0 Print "你好!" Case 1 Print "Hello!" End Select Case 2 Print"谢谢使用!" End Select End SubA.你好!B.谢谢使用!C.Hello!D.你好!谢谢使用!

考题 设计下列伪程序的语句覆盖测试用例。 BEGIN INPUT(A,B,C) IF A5 THEN X=10 ELSE X=1 END IF IF B10 THEN Y=20 ELSE Y=2 END IF IF C15 THEN Z=30 ELSE Z=3 END IF PRINT(X,Y,Z) END

考题 问答题设计下列伪程序的语句覆盖测试用例。 BEGIN INPUT(A,B,C) IF A5 THEN X=10 ELSE X=1 END IF IF B10 THEN Y=20 ELSE Y=2 END IF IF C15 THEN Z=30 ELSE Z=3 END IF PRINT(X,Y,Z) END