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

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

当输入为 'hello'时,写出下列程序的输出结果: s = raw_input() y = 0 for i in s: y += 1 print y, i


参考答案和解析
B 本题考查getchar()函数与putchar()函数,通过9etchar()函数读入字符,并通过putchar()函数将字符逐个输出,当用户输入“?”时停止输出,且c是一个字符变量只占一个字节。
更多 “当输入为 'hello'时,写出下列程序的输出结果: s = raw_input() y = 0 for i in s: y += 1 print y, i” 相关考题
考题 请选出以下程序的输出结果#includestdio.hmain(){ int a[]={1,2,3,4},i;int x=0;for(i=0;i4;i++){ sub(a,x);printf("%d",x);}printf("\n");}sub(s,y)int *s,y;{ static int t=3;y=s[t];t--; }A.1 2 3 4B.4 3 2 1C.0 0 0 0D.4 4 4 4

考题 下列程序的功能是输入一个整数,判断是否是素数,若为素数输出1,否则输出0,请填空。main(){int i, x, y=1;scanf("%d", x);for(i=2; i=x/2; i++)if【14】{ y=0; break;}printf("%d\n", y);}

考题 阅读以下说明和C++码,将相应的文字填入(n)处,写在对应栏内。[说明]以下代码实现了对象引用作为函数参数,仔细阅读以下代码,分析运行结果,填入(n)处。[代码]include<iostream.h>class Sample{int x,y;public:Sample() {x=y=0; }Sample (int i, int j ) {x=i; y=j; }void copy ( Sample s ).,void setxy ( int i, int j ) {x=i; y=j; }void print ( {cout<<"x="<<x<<end1 ; cout <<"y="<<y<<end1;};void Sample: copy ( Sample s ){X=S.X;y=s.y;}void func ( Sample s1, Sample s2 ){s1.setxy ( 10,20 );s2.setxy ( 30,40 );}void main ( ){Sample p ( 1,2 ) ,q;q.copy ( p );time ( p,q );p.print ( );q.print ( );}运行结果(1)(2)(3)(4)

考题 设有如下程序: Private Sub Form. Click( ) Dim i As Integer,x As String,y As String x="ABCDEFG" For i=4 To 1Step-1 y=Mid(X,i,i)+y Next i Print y End Sub 程序运行后,单击窗体,输出结果为( )。A.ABCCDEDEFGB.AABBCDEFGC.ABCDEFGD.AABBCCDDEEFFGG

考题 请选出以下程序的输出结果includemain(){ int a[]={1,2,3,4},i;int x=0;for(i=0;i 请选出以下程序的输出结果 #include<stdio.h> main() { int a[]={1,2,3,4},i; int x=0; for(i=0;i<4;i++) { sub(a,x);printf("%d",x);} printf("\n");} sub(s,y) int*s,y; { static int t=3; y=s[t];t--; }A.1 2 3 4B.4 3 2 1C.0D.4444

考题 设有以下程序:Private Sub Form_ Click() x=50 For i=1 To 4 y=InputBox(“请输入—个整数”) y=Val(y) If y Mod 5=0 Then a=a+ y x=y Else a=a+ x End If Next i Print aEnd Sub 程序运行后,单击窗体,在输入对话框中依次输入15、24、35、46,输出结果为 ______。A.100B.50C.120D.70

考题 有以下程序 main() { int x=0,y=0,i; for(i=1;++i) { if(i%2==0) {x++;continue;} if(i%5==0){y++;break;}} printf("%d,%d",x,y);} 程序的输出结果是A.2,1B.2,2C.2,5D.5,2

考题 执行以下程序段 a$ ="abbacddcba" For i = 6 To 2 Step - 2 X = Mid(a, i,i) Y=Left(a, i) z=Right(a,i) z=UCase(X Y Z) Next i Print z 输出结果为A.ABCB.BBABBAC.ABBABAD.AABAAB

考题 有如下程序: 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.程序编译时出错

考题 以下程序运行后,输出结果为______。 main() {int y=18,i=0 j,a[8]; do { a[i]=y%2; i++; y=y/2; } while(y>=1); for(j=1-1;j>=0;j--) printf("%d",a[j]); printf("\n"); }A.10000B.10010C.110D.10100

考题 下列程序的输出结果是______。 include main() {intx=10,y=10,i; for(i=0;x>8;y=++) pri 下列程序的输出结果是______。include<stdio.h>main(){ intx=10,y=10,i;for(i=0;x>8;y=++)printf("%d%d",X--,y);}

考题 有以下程序:include using namespace std;class sample{private: int x; static int 有以下程序:#include <iostream>using namespace std;class sample{private: int x; static int y;public: sample(int a); static void print(sample s);};sample:: sample(int a){ x=a; y+=x;}void sample:: print(sample s){ cout<<"x="<<s. x<<",y="<<y<<end1;}int sample:: y=0;int main(){ sample s1(10); sample s2(20); sample:: print(s2); return 0;}程序运行后的输出结果是( )。A.x=10,y=20B.x=20,y=30C.x=30,y=20D.x=30,y=30

考题 设有下列程序 Private Sub Form. Click( ) X=50 For i=1 T0 4 y=InputBox("请输入一个整数") y=Val(v) If y Mod 5=0 Then a=a+y x=y Else a=a+x End If Next i Print a End Sub 程序运行后,单击窗体,在输入对话框中依次输入15、24、35、46,输出结果为( )。A.100B.50C.120D.70

考题 有下列程序: fun(int x,int y) { static int m=0,i=2; i+=m+1;m=i+x+y;return m; } main( ) { int j=1,m=1,k; k=fun(j,m);print S(”%d,”,k); k=fun(j,m);printf(”%d\n”,k); ) 执行后的输出结果是( )。A.5,5B.5,11C.11,11D.11,5

考题 下列程序的输出结果是______。#includemain(){ char *a="abcdefghi";int k; fun(a);puts(a);}fun(char*s){ int x,y;char c; for(x=0,y=strlen(s)-1;x<y;x++,y--) { c=s[y];s[y]=s[x];s[x]=c;}}A.ihgfsdcbaB.abcdcfghiC.abcdedebaD.ihgfefghi

考题 以下程序运行后的输出结果是______。 main () { int y=18,i=0,j,a[8]; do { a[i]=y%2;i++; y=y/2; } while(y>=1); for(j=i-1;j>=0;j--)printf("%d",a[j]); printf("\n"); }A.1000B.10010C.110D.10100

考题 以下程序运行后,输出结果是( )。 main() {int y=18,i=0,j,a[8]; do { a[i]’y%2; i++; y=y/2; } while(y>=1); for(j=i-1;j>=0;j--) printf("%d",a[j]); printf("\n"); }A.1000B.10010C.110D.10100

考题 请选出以下程序的输出结果_______。 includesub(int*s,inty){ static int t=3,y=s[t];t 请选出以下程序的输出结果_______。 #include<stdio.h> sub(int*s,inty) { static int t=3, y=s[t];t-; } main() { int a[]={1,2,3,4},i,x=0; for(i=0;i<4;i++){ sub(a,x);printf("%d",x);} printf("\n"); }A.1234B.4321C.0D.4444

考题 请选出以下程序的输出结果()。includesub(int *s,int y){static int t=3; y=s[t];t--;} 请选出以下程序的输出结果( )。 #include <stdio.h> sub(int *s,int y) { static int t=3; y=s[t];t--; } main() { int a[]={1,2,3,4},i,x=0; for(i=0;i<4;i++) { sub(a,x);printf("%d",x); } printf("\n"); }A.1234B.4321C.0D.4444

考题 程序代码如下,当单击窗体上的Command1控件时,窗体上输出的结果是( )。 Private Sub Command1_Click() Dim Y As Integer,I As Integer Dim A(7)As Integer Y=18:I=0 Do A(I)=Y Mod 2 I=I+1 Y=Y\2 Loop Until Y<1 For j=I-1 To 0 Step-1 Print A(j); Next j End SubA.1 0 0 0B.1 0 0 1 0C.0 0 1 1 0D.1 0 1 0 0

考题 下列程序段的结果为______。A="ABBACDDCBA"For I=6 T0 2 Step-2X=Mid(A,I,I)Y=Left(A,1)Z=Right(A,1)Z=X Y ZNext 1Print 2A.ABAB.AABAABC.BBABBAD.ABBABA

考题 以下程序段的作用是首先按降序输入10个数到数组Y的前10个元素中,又输入一个YO插入到数组Y中,插入YO后Y中的数据仍按降序排列。请补充完该程序______。Dim Y(1 To 11)For i =1 To 10Y(i) = Val(InputBox(“请输入Y(i):”))Next iX = Val(InputBox (“请输入x:”))For i = 10 To 1 Step -1If【 】ThenY(i + 1) = XExit ForEnd IfY (i + 1) =Y(i)Next i'Print Y(10)For i =1 To 11Print Y(i)Next I

考题 哈罗德一多马的经济增长模型为()。A:sY=υΔY B:M/P=L(Y,I/Y,d-π);δ(M/P)/δ(I/Y)>0 C:s/Δy=y/υ D:[s-(1-s)λn]?(k)=nk

考题 八选一数据选择器当选择码S2S2S0为110时()A、选择数据从Y3输出B、选择数据从I3输入C、选择数据从Y6输出D、选择数据从I6输入

考题 下列程序的运行结果是() 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);

考题 八选一数据选择器当选择码S2S1S0为111时()A、选择数据从Y3输出B、选择数据从I3输入C、选择数据从Y7输出D、选择数据从I7输入

考题 八选一数据选择器当选择码S2,S1,S0为1,1,0时()。     A、选择数据从Y3输出B、选择数据从I3输入C、选择数据从Y6输出D、选择数据从I6输入

考题 填空题下列程序的运行结果是() 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);