网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
1、有以下程序段: i = 1; s = 0; while i < 7: s = s + i; i = i + 1; if i == 5: break; print("1-7的累加值为:",s); 程序运行后输出的结果为:()。
A.10
B.15
C.21
D.死循环
参考答案和解析
24
更多 “1、有以下程序段: i = 1; s = 0; while i < 7: s = s + i; i = i + 1; if i == 5: break; print("1-7的累加值为:",s); 程序运行后输出的结果为:()。A.10B.15C.21D.死循环” 相关考题
考题
有以下程序 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.程序进入死循环
考题
下列程序运行后,输出结果为( )。 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
考题
有以下程序: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.程序进入列循环
考题
以下程序的输出结果是【】。 include using namespace std; int main() {int s,i;for(s=
以下程序的输出结果是【 】。include <iostream>using namespace std;int main(){int s,i;for(s=0,i=1;i<3;i++)s+=i;cout<<s<<end1;return 0;}
考题
若有以下程序:include using namespace std;int f(){static int i = 0;int s = 1;s+=
若有以下程序: #include <iostream> using namespace std; int f() { static int i = 0; int s = 1; s+=i; i++; return s; } int main() { int i,a = 0; for(i = 0;i<5;i++) a+=f(); cout<<a<<endl; return 0; } 程序运行后,输出的结果是A.20B.24C.25D.15
考题
若有以下程序:includeusing namespace std;int f(){ static int i=O; int s=1; s+=i;
若有以下程序: #include<iostream> using namespace std; int f() { static int i=O; int s=1; s+=i; i++; return s; } int main() { int i,a=0; for(i=0;i<5;i++) a+=f(); cout<<a<<endl; retrun 0; } 程序运行后,输出的结果是A.20B.24C.25D.15
考题
有以下程序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
考题
以下程序的输出结果是[ ]。main(){int a[3][3]={{1,2,9},{3,4,8},{5,6,7}},i,s=0;for(i=0;i<3;i++) s+=-a[i][i]+a[i][3-i-1];printf("%d\n",s);}
考题
下列程序段的输出结果为( )。 Dim M(5,5), S(5) For i = 1 To 5 S(i) = 0 For j = 1 To 5 M(i, j) = i + j S(i) = S(i) + M(i, j) Next j Next i For Each x In S Print x; Next xA.2023 24 3540B.2025 30 3540C.2023 25 35 40D.2025 354045
考题
以下程序运行后输入:3,abcde回车,则输出结果是【 】include move(char *str,
以下程序运行后输入:3,abcde回车,则输出结果是【 】include <string.h>move(char *str, int n){ char temp; int i;temp=str[n-1];for(i=n-1;i>0;i--) str[i]=str[i-1];str[0]=temp;}main( ){ char s[50]; int n, i, z;scanf("%d,%s",n,s);z=strlen(s);for(i=1; i<=n; i++) move(s, z);printf("%s\n",s);}
考题
有以下程序 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
考题
有以下程序: #includestdio.h main( ) {int a[5]={1,2,3,4,5),b[5]={0,2,1,3,o},i,s=0; for(i=o;i5;i++)s=s+a[b[i]]; printf(”%d\n”,s); } 程序运行后的输出结果是( )。A.6B.10C.11D.15
考题
有以下程序main( ){ int i=0,s=0;do{ if(i%2) {i+ +; continue; } i++; s+=i;}while(i<7)cout<<s<<end1;}执行后输出结果是A.16B.12C.28D.21
考题
下面程序运行后输出结果是( )。 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
考题
若有以下程序:includeusing namespace std;int fun(){static int i=0;int s=1;s+=i;i
若有以下程序: #include<iostream> using namespace std; int fun() { static int i=0; int s=1; s+=i; i++; return s; } int main() { int i,a=0; for(i=0;i<5;i++) a+=fun(); cout<<a<<endl; return 0; } 程序运行后,输出的结果是( )。A.20B.24C.26D.15
考题
下面程序的运行结果是______。 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
考题
下列程序段的输出结果为( )。 Dim M(S, S), S(5) For i=1 To 5 S(i)=0 For j=1 To 5 M(i, j)=i+j S(i)=S(i)+M(i, j) Next j Next i For Each x In S Print x; Next xA.20 23 24 35 40B.20 25 30 35 40C.20 23 25 35 40D.20 25 35 40 45
考题
( 29 )有以下程序# include ( stdio.h )main (){ int a[5]= { 1 , 2 , 3 , 4 , 5 } , b[5] ={ O , 2 , 1 , 3 , 0 } , i , s = 0 ;for ( i = 0 ; i < 5 ; i++ ) s = s+a[b[i] ] ) ;printf ( " %d \ n ", s ) ;}程序运行后的输出结果是A ) 6B ) 10C ) 11D ) 15
考题
以下程序的输出结果为( )。main( ){ char s1[40]="country",s2[20]="side";int i=0,j=0;while(s1[i]!='\0') i++;while(s2[j]!='\0') s1[i++]=s2[j++];s1[i]=0;printf("%s\n",s1);}A sideB countryC sidetryD countryside
考题
下列程序的运行结果是() classProgramx=0,y=-1; { publicstaticvoidMain(string[]args) { int i=0,s=1; do{s/=s+1;i++; } while(i=10); Console.WriteLine(“i={0},s={1}”,i,s);
考题
以下能正确计算1×2×3×…×10的程序段是()。A、do{i=1;s=1;B、do{i=1;s=0;s=s*i;s=s*i;i++;i++;}while(i=10);}while(i=10);C、i=1;s=1;D、i=1;s=0;do{s=s*i;do{s=s*i;i++;i++;}while(i=10);}while(i=10);
考题
若变量已正确定义,以下不能正确计算1+2+3+4+5的程序段是()。A、i=1;s=1;do{s=s+i;i++;}while(i5);B、i=0;s=0;do{i++;s=s+i;}while(i5);C、i=1;s=0;do{s=s+i;i++;}while(i6);D、i=1;s=0;do{s=s+i;i++;}while(i=5);
考题
单选题有以下程序:#includemain(){ int a[5]={1,2,3,4,5},b[5]={0,2,1,3,0},i,s=0; for(i=0;i5;i++)s=s+a[b[i]]; printf(%d,s);}程序运行后的输出结果是( )。A
6B
10C
11D
15
考题
填空题下列程序的运行结果是() classProgramx=0,y=-1; { publicstaticvoidMain(string[]args) { int i=0,s=1; do{s/=s+1;i++; } while(i=10); Console.WriteLine(“i={0},s={1}”,i,s);
考题
单选题以下程序段中,与其他三个功能不同的程序段是( )。A
s=0;i=1;for(;;){s+=i; i++; if(i=10) break;}B
s=0,i=1;for(;i=10;){s+=i; i++;}C
s=0;for(i=1;i=10;i++){s+=i;}D
for(s=0,i=1;i=10;s+=i,i++);
考题
单选题有如下程序段: S:=0; i:=1; while i=5 do begin s:=s+i; i:=i+1; end; 执行该程序段后,变量i的值为()A
1B
3C
5D
6
热门标签
最新试卷