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

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

下面的表达式中正确的是 ( )

A.String s=“你好”;int i=3;s+=i;

B.String s=“你好”;int i=3;if(i==s){s+=i};

C.String s=“你好”;int i=3;s=i+s;

D.String s=“你好”;int i=3; s=i+;


参考答案

更多 “ 下面的表达式中正确的是 ( )A.String s=“你好”;int i=3;s+=i;B.String s=“你好”;int i=3;if(i==s){s+=i};C.String s=“你好”;int i=3;s=i+s;D.String s=“你好”;int i=3; s=i+; ” 相关考题
考题 有以下程序struct S{ int n; int a[20]; };void f(int *a,int n){ int i;for(i=0;in-1;i++) a[i]+=i;}main( ){ int i; struct S s={10,{2,3,1,6,8,7,5,4,10,9}};f(s.a,s.n);for(i=0;is.n;i++) printf("%d",s.a[i]);}程序运行后的输出结果是A)2,4,3,9,12,12,11,11,18,9,B)3,4,2,7,9,8,6,5,11,10,C)2,3,1,6,8,7,5,4,10,9,D)1,2,3,6,8,7,5,4,10,9,

考题 有以下程序struct S{ int n; int a[20]; }; void f(int *a,int n) {int i; for(i=0;i a[i]+=i; } main() {int i; struct S s={10,{2,3,1,6,8,7,5,4,10,9}}; f(s.a, s.n); for(i=0;i printf(“%d”,s.a[i]); } 程序运行后的输出结果是( )。A.2,4,3,9,12,12,11,11,18,9,B.3,4,2,7,9,8,6,5,11,10,C.2,3,1,6,8,7,5,4,10,9,D.1,2,3,6,8,7,5,4,10,9,

考题 以下程序的输出结果是( )。f(int b[],int m,int n){int i,s=0;for(i=m;in;i=i+2)s=s+b[i];return s;}void main(){int x,a[]={1,2,3,4,5,6,7,8,9};x=f(a,3,7);printf("%d\n",x);}A.10 B.18 C.8 D.15

考题 有以下程序: struct S{int n;int a[20];}; void f(int*a,int n) {int i; for(i=0;i<n-1;i++)a[i]+=i;} mainf() {int i;struct S s{10,{2,3,1,6,8,7,5,4,10,9}}; if(s.a,s.n); for(i=0;i<s.n;i++)printf("%d",s.a[i]);} 程序运行后的输出结果是( )。A.2,4,3,9,12,12,11,11,18,9B.3,4,2,7,9,8,6,5,11,10C.2,3,1,6,8,7,5,4,10,9D.1,2,3,6,8,7,5,4,10,9

考题 有如下程序: nclude using namespace std; class Stack{ 有如下程序: #nclude<iostremn> using namespace std; class Stack{ public: Stack(unsigned n=10:size(n){rep_=new int[size];top=O;} Stack(Stacks):size(s.size) { rep_=new int[size]; for(int i=0;i<size;i++)rep_[i]=s.rep_[i]; top=s.top; } ~Stack(){delete[]rep_;} void push(int a){rep_[top]=a; top++;} int opo(){--top;return rep_[top];} bool is Empty()const{return top==O;} pavate: int*rep_; unsigned size,top; }; int main() { Stack s1; for(int i=1;i<5;i++) s1.push(i); Stack s2(s1); for(i=1;i<3;i++) cout<<s2.pop()<<','; s2.push(6); s1.push(7); while(!s2.isEmpty()) cout<<s2.pop()<<','; return 0; } 执行上面程序的输出是A.4,3,2,1B.4,3,6,7,2,1C.4,3,6,2,1D.1,2,3,4

考题 有以下程序:int f(int b[][4]){int i,j,s=0;for(j=0;i2)i=3-j;s+=b[i][j];}ret 有以下程序: int f(int b[][4]) { int i,j,s=0; for(j=0;i<4;i++) { i=j; if(i>2) i=3-j; s+=b[i][j]; } return s; } main() { int a[4][4]={{1,2,3,4,},{0,2,4,6},{3,6,9,12},{3,2,1,0}}; printf("%d\n",f(a)); } 执行后的输出结果是( )。A.12B.11C.18D.16

考题 现有如下定义语句int*p,s[20],i;p=s;表示数组元素s[i]的表达式不正确的是A.*(s+i)B.*(p+i)C.*(s=s+i)D.*(p=p+i)

考题 下列程序段运行的结果为 public class Test{ static void print(String s,int i){ System.out.println("String:"+s+",int:"+i); } static void print(int i,String s){ System.out.println("int:"+i+",String:"+s); } public static void main(String[]args){ print(99,"Int first"); } }A.String:String first,int:11B.int:11,String:Int firstC.String:String first,int99D.int:99,String:Int first

考题 阅读下面程序: include int fun2(int m) { if(m%3==0) return 1; else return 0; } 阅读下面程序:include <iostream.h>int fun2(int m){if(m%3==0)return 1;elsereturn 0;}void fun1(int m, int s){int i;for (i=1; i<m; i++)if(fun2(i))S=S*i;}void main(){int n=9, s=2;fun1(n, s);cout<<s<<end1;}该程序的运行结果是【 】。

考题 以下程序的输出结果是 include int f( ) { static int i=0; int s=1 s+ =i; 以下程序的输出结果是 #include<iostream.h> int f( ) { static int i=0; int s=1 s+ =i; i++; return s;} void main( ) { int i,a=0; for(i=0 ;i<5;i++)a+=f( ); cout < < a;}A.20B.24C.25D.15

考题 以下程序的输出结果是【】。 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;}

考题 已知C源程序如下: include include void reverse(char S[]){ int C,i,J; f 已知C源程序如下:include<stdio. h>include<string. h>void reverse(char S[]){int C,i,J;for(i=0,j=strlen(s)-1;i<j;i++,j++){c=s[i];s[i]=s[j];s[j]=c;}}void getHex(int number,char s[]){int I;i=0;while(number>0){if(number%16<10)s[i++]=number%16+'0';elseswitch(number%16){case 10:s[i++]='A';break;case 11:s[i++]='B';break;case 12:s[i++]='C';break;case 13:s[i++]='D';break;case 14:s[i++]='E';break;case 15:s[i++]='F';break;default:printf("Error");break;}number/=16;}s[i]:'\o';reverse(s);}int main(){unsigned int number;int i=0:char s[50];printf("%s","please input number;\n");scanf("%d",&number):getHex(number,s);i=0;while(s[i])printf("%c",s[i++]);return 0;}画出程序中所有函数的控制流程图。

考题 以下程序的输出结果是 f(int b[] ,int m, int n) { int i,s=0; for (i=m; i<n; i=i+2) s=s+b [i]; return s; } main ( ) { int x,a[]={1,2,3,4,5,6,7,8,9}; x=f(a,3,7); printf ( "%d\n", x); }A.10B.18C.8D.15

考题 若有以下程序: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

考题 有以下程序: 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++; } matin() { int s=a, i; for(i=0; i<3; i++)s+=f(i); printf("% d\n", s); } 程序运行后的输出结果是______。A.26B.28C.29D.24

考题 若有以下程序: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

考题 以下程序的输出结果是#include stdio.hint fun(int x){ static int m=0; return(m *=x);}main(){ int s,i; for(i=l;i=3;i++) s=fun(i); printf("%d\n",s);}

考题 以下程序运行后输入: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);}

考题 阅读以下程序: include void main() { static int a[][3]={9,7,5,3,1,2,4,6,8}; int 阅读以下程序:include<iostream.h>void main(){static int a[][3]={9,7,5,3,1,2,4,6,8};int i,j,s1=0,s2=0;for(i=0;i<3;i++)for(j=0;j<3;j++){if(i==j)s1=sl+a[i][j];if(i+j==2)s2=s2+a[i][j];}cout<<s1<<","<<s2<<endl;}则该程序的输出结果为【 】。

考题 分析以下程序的执行结果【】。include class S{ int A[10]; public: int operato 分析以下程序的执行结果【 】。include <iostream. h>class S{int A[10];public:int operator () (int);};int S: :operator() (int x) {return A[x];}void main() {S a;int i,j;for (i=0; i<10; i++)a(i)=i*2;for (i=0; i<10; i++)cout<<a(i)<<" ";cout<<end1; }

考题 有以下程序:int f(int b[][4]){ int i, j, s=0;for(j=0j2) i=3-j;s+=b[i][j]; 有以下程序:int f(int b[][4]){ int i, j, s=0; for(j=0j<4;j++) { i=j; if(i>2) i=3-j; s+=b[i][j]; } return s;}main(){ int a[4][4]={ { 1,2,3,4}, {0,2,4,6},{3,6,9,12 }, {3,2,1,0} }; printf("%d\n", f(a)); }执行后的输出结果是( )。A.12B.11C.18D.16

考题 有以下程序:struct S{int n;int a[20];};void f(struct S*P){int i,j,t;for(i=0;in-1;i++)fo 有以下程序: struct S{int n;int a[20];}; void f(struct S*P) { int i,j,t; for(i=0;i<P->n-1;i++) for(j=j+1;j<P->n-1;j++) if(p->a[i]>p->a[j]) {t=P->a[i];p->a[i]=P->a[j];p->a[j]=t} } main() {int i;struct S s{10,{2,3,1,6,8,7,5,4,10,9}}; f(&s); for(i=0;i<s.n;i++)printf("%d",s.a[i]);} 程序运行后的输出结果是( )。A.3B.4C.5D.6

考题 若有以下程序: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

考题 3下列程序段运行的结果为( )。 public class Test{ static void print(String s,int i){ System.out.pdntlnC String: "+s+",int:"+i); } static void print(iht i,String s){ System.out.prinflnCint:"+i+",gtring:"+s); } public static void main(String[] args){ print(99,"Int first"); } }A.String:String first,int: 11B.int: 11,String:Int firstC.String:String first,int:99D. int:99,Stfing:Int first

考题 有以下程序:int f(int b[][4]){int i, j, s=0;for(j=0; j2)i=3-j;S+=b[i][j]; 有以下程序: int f(int b[][4]) { int i, j, s=0; for(j=0; j<4; j++) { i=j; if(i>2)i=3-j; S+=b[i][j]; } return s; } main() { int a[4][4]={{1, 2, 3, 4}, {0, 2, 4, 6}, {3, 6, 9, 12}, {3, 2, 1, 0}}; printf("%d\n", f(a)); } 执行后的输出结果是______。A.12B.11C.18D.16

考题 下列语句段中不是死循环的是( )。A.int i=100 While (1) { i=i%100+1 if(i==20) break; }B.int i sum=O; for (i=l;;i++) sum=sum +l;C.int k=0; do { ++K }while(k=O);D.int s=3379; while (s+ +%2+3%2)s++;

考题 main( ){ int a[6]={10,20,30,40,50,60},i;invert(a,0,5);for(i=0;i6;i++) printf(“%d,”,a[i]);printf(“\n”);}invert(int s[ ],int i,int j){ int t;if(iJ){ invert(s,i+1j-1);t=s[i];s[i]=s[j];s[j]=t;}}