网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
4、以下程序的运行结果为____________。 s="498327" for i in range(0,len(s)): if s[i]=="6": print(i) break else: print(-1)
参考答案和解析
64
更多 “4、以下程序的运行结果为____________。 s="498327" for i in range(0,len(s)): if s[i]=="6": print(i) break else: print(-1)” 相关考题
考题
有以下程序 main() { int i=0,s=0; for(;;) { if(i==3‖i==5) continue; if(i==6) break; i++; s+=i; }; printf("%d\n",s); } 程序运行后的输出结果是A.10B.13C.24D.程序进入死循环
考题
执行下面的程序,输出的结果是 ______ 。 Private Sub Command1_Click() ch $ = "Welcome to China!" n = Len(ch $ ) For i =1 To n-1 s$ =Mid(ch$ ,i,1) If s$ ="o" Then m=m + 1 Next i Print m End SubA.1B.2C.8D.0
考题
下列程序运行后,输出结果为( )。 Dim a() a=Array(1,3,5,7,9) s=0 For i=1 To 4 s=s*10+a(i) Next i Print sA.1357B.3579C.7531D.9753
考题
(14)有下列程序,程序运行后单击命令按钮,则输出的结果是 Private Sub Command1_Click() Dim a%(1 To 4),b%(3 To 6),i%,s1#,s2# For i=1 To 4 a(i)=i Next i For i=3 To 6 b(i)=i Next i s1=Factorial(a) S2=Factorial(b) Print"s1=";s1;"s2";s2; End Sub Function Factorial(a()As Integer) Dim t#,i% t=1 For i=LBound(a) To UBound(a) t=t*a(i) Next i Factorial=t End Factorial A.s1=360 s2=24 B.s1=24 s2=360 C.s1=24 s2=24 D.s1=360 s2=360
考题
以下程序的输出结果是( )。main{ int i=0,S=0;for(;;){if(i==3 ||i==5)continue;if(i==6)break;i++;s+=i:};printf(%d\n,s);}A.10B.13C.21D.程序陷入死循环
考题
有以下程序:include main ( ){ inti=0.s=0;for(;;) if( i = = 3 ‖ i = = 5 ) continu
有以下程序: #include <stdio. h> main ( ) { inti=0.s=0; for(;;) if( i = = 3 ‖ i = = 5 ) continue; if (i ==6) break; i++; s+ =i; } printf(" % d \n" ,s);程序运行后的输出结果是( )。A.10B.13C.21D.程序进入列循环
考题
如果一个正整数从高位到低位上的数字依次递减,则称其为降序数(如:9632是降序数,而8516则不是降序数)。现编写如下程序,判断输入的正整数是否为降序数。 Private Sub Command1 Click( ) Dim n As Long Dim flag As Boolean n=InputBox("输入一个正整数") S=Trim(Str(n)) For i=2 To Len(s) If Mid(s,i-1,1)Mid(S,i,1)Then Exit For Next i If i=Len(S)Then flag=True Else flag=False If flag Then Print n;"是降序数" Else Print n;"不是降序数" End If End Sub 运行以上程序,发现有错误,需要对给flag变量赋值的If语句进行修改。以下正确的修改是( )。A.If i=Len(s)+1 Then flag=False Else flag=TrueB.If i=Len(s)+1 Then flag=True Else flag=FalseC.If i=Len(s)-1 Then flag=False Else flag=TrueD.If i=Len(s)-1 Then flag=True Else flag=False
考题
有以下程序main( ){ int i=0,x=0;for (;;){ if(i==3||i==5) continue;if (i==6) break;i++;s+=i;};printf("%d\n",s);}程序运行后的输出结果是A.10B.13C.21D.程序进入死循环
考题
以下程序段运行后消息框的输出结果为______。s="Access"Dim str As StringFor i=1 To Len(s)str=UCase(Mid(S,I,I))+strNext iMsgBox str
考题
若有以下程序,当程序运行后,单击命令按钮,则输出的结果为( )。 Private Sub Command1_Click() Dim a%(1 To 4), b%(3 To 6), i%, s1#, s2# For i= 1 To 4 a(i) = i Next i For i=3 To 6 b(i) = i Next i s1 = Factorial (A) s2 = Factorial (B) Print "s1="; s1; "s2="; s2 End Sub Function Factorial(a() As Integer) Dim t#, i% t=1 For i = LBound(A)To UBound(A) t = t * a(i) Next i Factorial = t End FunctionA.s1=360 s2=24B.s1=24 s2=360C.s1=24 s2=24D.s1=360 s2=360
考题
有下列程序,程序运行后单击命令按钮,则输出的结果为( )。Private Sub Command1_Click()Dim a%(1 To 4),b%(3 To 6),i%,s1#,s2# For i=1 To 4 a(i)=i Next i For i=3 To 6 b(i)=i Next i s1=Factorial(A) s2=Factorial(B)Print "s1=";s1;"s2=";s2End SubFunction Factorial(a()As Integer)Dim t#,i% t=1 For i=LBound(A)To UBound(A) t=t*a(i) Next i Factorial=tEnd FunctionA.s1=360 s2=24B.s1=24 s2=360C.s1=24 s2=24D.s1=360 s2=360
考题
有以下程序 int f (int A) { return a%2; } main ( ) { int s[8]={1,3,5,2,4,6),i,d=0; for (i=0; f(s[i]; i++) d +=s[i]; print f ("%d\n", D) ; } 程序运行后的输出结果是A.9B.11C.19D.21
考题
当运行以下程序时,从键盘输入AhaMA(空格)Aha,则下面程序的运行结果是includemain(
当运行以下程序时,从键盘输入AhaMA(空格)Aha<CR>,则下面程序的运行结果是 #include<stdio.h> main() {char s[80],c='a'; int i=0; scanf("%s",s); while(s[i]!='\n\) {if(s[i]]==c)s[i]-32; else if(s[i]==c-32)s[i]=s[i]+32; i++;} puts(s);}A.ahaMaB.AbAMaC.A11AMa[空格]ahaD.ahAMa[空格]ahA
考题
有如下程序: Private Sub Command1_Click() as="A WORKER IS HERE" x = Len(a$) For i=1 To x - 1 b$ =Mid$(a$, i,3) If b$ ="WOR" Then S=S+ 1 Next Print S End Sub 单击命令按钮,程序运行结果为A.1B.2C.3D.5
考题
程序段如下: Dim i As Integer,s As Integer For i=4 To 1 Step-1 s=s+i Next i Print s,i执行的结果是( )。A.10 0B.9 1C.10 1D.9 0
考题
下列程序运行后的输出结果是______。Private Sub f(k,s) s = 1 for j = 1 To k s=s*j Next jEnd SubPrivate Sub Command1_ Click () Sum = 0 for i = 1 To 3 Call f(i, s) Sum = Sum + s Next i Print Sum End SubA.0B.3C.6D.9
考题
当运行以下程序时,从键盘输入AhaMA(空格)AhaCR,则下面程序的运行结果是#includestdio.hmain(){ char s[80],c=′a′;int i=0;scanf("%s",s);while(s[i]!=′{ if(s[i]==c)s[i]-32;else if(s[i]==c-32)s[i]=s[i]+32;i++; }puts(s); }A.ahaMaB.AbAMaC.AhAMa[空格]ahAD.ahAMa[空格]ahA
考题
下面程序运行后的结果是( )。 Private Sub Form_Click() Dim s As Integer,k As Integer,i As Integer,n As Integer s=1 fori=1 to 3 forj=i to 3 for k=j to istep-1 s=s*k nextk,J,i print s End SubA.6B.72C.144D.432
考题
下面程序运行后输出结果是( )。 For I=1 to 2 S=1 For j=0 to I-1 S=S+S*I Next j Print S Next IA.1 1B.0 2C.2 9D.6 9
考题
下面程序的运行结果是______。 Dim a,i,s a=Array("6","5","a","b","2","1") s=0 i=0 Dw While a(i)>="0" And a(i)<="9" s=10* s+a(i)-"0" Print s i=i+2 LoopA.12ba56B.652C.6D.62
考题
有以下程序 int a=2; int f(int n) { static int a=3; int t=0; if(n%2) {static int a=4; t+=a++;} else {static int a=5; t+=a++;} return t+a++; } main ( ) { int s=a, i; for (i=0;i<3; i++) s+=f (i) print f ("%d\n" , s ); } 程序运行后的输出结果是A.26B.28C.29D.24
考题
程序段如下; s=0 For I=5 to -1 step -2 S=s+I Next I Print I 语句S=S+I执行的次数和最后I的值分别为( )。A.3,-1B.4,-1C.4,-3D.0, 5
考题
有如下程序: Private Sub Commandl_Click( ) a$="A WORKER IS HERE" x=Len(a$) For i=1,To x-1 b$=Mid$(a$,i,3) If b$="WOR" Then S=S+1 Next Print S End Sub 单击命令按钮,程序运行结果为A.1B.2C.3D.5
考题
下面程序的运行结果是【 】。main(){ int i=0,j=10,k=2,s=0;for(;;){i+=k;if(ij){printf("%d\n",s);break; }s+=i; } }
考题
下面运行程序后,单击命令按钮,输出的结果是【 】。Private Sub Command1_Click()Dim a%(1 To 4),b%(3 To 6),i%,s1,s2For i=1 To 4a(i)=iNextFor i=3 To 6b(i)=iNexts1.= Fun(a)s2 =Fun(b)Print "s1 ="; s1; "s2 ="; s2End SubFunction Fun( a( ) As Integer)Dim t, i%t=1For i = LBound(A)To UBound(a)t=t * a(i)NextFun=tEnd Function
考题
单选题有如下VB程序,它的输出结果是()。 S=0 For I=1 To 10 S=S+I Next I Print “S=”;SA
0B
S=S+IC
55D
S=55
热门标签
最新试卷