单选题55. int []x= {1, 2,3,4, 5};  56. int y[] =x;  57. System.out.println(y[2]);  Which is true?()A Line 57 will print the value 2.B Line 57 will print the value 3.C Compilation will fail because of an error in line 55.D Compilation will fail because of an error in line 56.

单选题
55. int []x= {1, 2,3,4, 5};  56. int y[] =x;  57. System.out.println(y[2]);  Which is true?()
A

 Line 57 will print the value 2.

B

 Line 57 will print the value 3.

C

 Compilation will fail because of an error in line 55.

D

 Compilation will fail because of an error in line 56.


参考解析

解析: 暂无解析

相关考题:

阅读下面程序: include void fun(int n) { int x(5); static int y(10); if(n>0) { 阅读下面程序:include<iostream.h>void fun(int n){int x(5);static int y(10);if(n>0){++x;++y;cout<<x<<","<<y<<end1;}}void main(){int m(1);fun(m);}则该程序的输出结果是______。

阅读下面程序: include void f(int n) { int x(5); static int y(10); if(n>0) { ++ 阅读下面程序:include<iostream.h>void f(int n){int x(5);static int y(10);if(n>0){++x;++y;cout<<x<<","<<y<<endl;}}void main(){int m(1);f(m),}则该程序的输出结果是【 】

若有以下程序: include using namespace std; int f(int x, int y) {return(y-x)*x; 若有以下程序:include <iostream>using namespace std;int f(int x, int y){return (y-x)*x;}int main(){int a=3,b=4,c=5,d;d=f(f(a,b) ,f(a,c) );cout<<d<<<end1;return 0;}执行后的输出结果是【 】。

以下程序执行后的输出结果是( )。include usingnamespacestd;void try(int,int,int,in 以下程序执行后的输出结果是( )。 #include <iostream> using namespace std; void try(int,int,int,int); int main ( ) { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<end1; return 0; } void try(int x,int y, int z,int r) { z = x+y; x = X*X; y = y*y; r = z+x+y; }A.18B.9C.10D.不确定

下列函数定义中,会出现编译错误的是 ______。A.max(int x,int y,int *z) { *z=x>y? x:y;}B.int max(int x,y) {int z; z=x>y? x;y; return z; }C.max(int x,int y) { int z; z=x>y? x:y; return(z); }D.int max(int x,int y) { return(x>y?x:y);}

下列函数定义中,会出现编译错误的是A.max(int x,int y,int *z) { *z=xy ? x:y; }B.int max(int x,y) { int z; z=x>y ? x:y; return z; }C.max(int x,int y) { int z; z=xy?x:y; return(z); }D.int max(int x,int y) { return(x>y?x:y); }

有如下程序: include using namespace std; void f1(int x, int y){int z= 有如下程序:#include<iostream>using namespace std;void f1(int x, int y){int z=x; x=y; y=z;)void f2(int x, int y){int z=x; x=y; y=z;}intmain(){int x=10, y=26;f1(x, y);f2(x, y);cout<<y<<end1;return 0;}运行时的输出结果是( )。A) 10B) 16C) 26D) 36A.B.C.D.

有如下程序: include using namespace std; class Point{ int x, y; public: Point(i 有如下程序:#include<iostream>using namespace std;class Point{int x, y;public:Point(int x1=0, int y1=0):x(x1), y(y1){}int get(){return x+y;)};class Circle{Point center;int radius;public:Circle(int CX, int cy, int r):center(cx, cy), radius(r){}int get(){return center. get()+radius;}};int main(){circle c(3, 4, 5);cout<<c. get()<<end1;return ():}运行时的输出结果是( )。A) 5B) 7C) 9D) 12A.B.C.D.

有以下程序: include using namespace std; class Point' { public: void SetPoint( 有以下程序: #include <iostream> using namespace std; class Point' { public: void SetPoint(int x,int y); void Move(int xOff,int yOff); int GetX() { return X; } int GetY() { return Y; } private: int X,Y; }; void Point::SetPoint(int x, int y) { X=x; Y=y; } void Point: :Move(int xOff, int yOff) X+=xOff; Y+=yOff; } int main () { Point p1; p1.SetPoint(1,2); p1.Move (5, 6); cout<<"Point1 is ("<<p1.GetX()<<','<<p1.GetY()<<")"<<end1; return 0; } 执行后的输出结果是( )。A.Point1 is (6,8)B.Point1 is (1,2)C.Point1 is (5,6)D.Point1 is (4,4)

下列程序的输出结果是______。 int t(int x,int y,int cp,int dp) { cp=x*X+y*y; dp=x*x-y*y; } main() { int a=4,b=3,c=5,d=6: t(a,b,c,d); printf("%d%d\n" ,c,d);A.4 5B.4 6C.5 6D.5 5

有以下程序: include using namespace std; voidt(intx,inty, intcp,intdp) {cp=x*x+y 有以下程序:include <iostream>using namespace std;void t(int x,int y, int cp,int dp){cp=x*x+y+y;dp=x*x-y*y;}int main(){int a=4,b=3,c=5,d=6;t(a,b,c,D) ;cout<<c<<","<<d<<end1;return 0;

下面程序的输出结果是【】。includeint add(int a, int b);void main(){extern int x, 下面程序的输出结果是【 】。include<iostream.h>int add(int a, int b);void main(){extern int x, y;cout<<add(x, y)<<end1;}int x(20),y(5);int add(int a, int b){int s=a+ b;return s;}

以下程序执行后的输出结果是include using namespace std;void try(int,int,int,int) 以下程序执行后的输出结果是 #include <iostream> using namespace std; void try(int,int,int,int); int main () { int x,y,z,r; x =1 ; y = 2; try(x,y,z,r); cout<<r<<endl; return 0; } void try(int x,int y,int z,int r) { z = x+y; x = x*x; y = y*y; r = z+x+y; }A.18B.9C.10D.不确定

下列函数定义不正确的是 ( )A.int max { int x y,z; z=x>y? x: y }B.int max(x,y) int x,y; { int z; z=x>y? x:y; return(z) }C.int max(x,y) { int x,y z; z=x>y? x: y; return(z); }D.int max( ) {}

以下正确的函数定义是______。A.double f1(int x,int y)B.double f1(int x;int y)C.double f1(int x;float y)D.double f1(int x,y)

以下程序执行后的输出结果是includeusing namcspace std;void try(int,int,int,int); 以下程序执行后的输出结果是 #include<iostream> using namcspace std; void try(int,int,int,int); int main() { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<end1; return 0; } void try(int x,int y, int z,int r) { z = x+y; x = x*x; y = y*y; r = z+x+y; }A.18B.9C.10D.不确定

在下面程序运行后,输出结果为 ______。includevoid count(int x[],int n,int y 在下面程序运行后,输出结果为 ______。 #include<iostream.h> void count(int x[],int n,int y){ int k; y=0; for(k=0:k<n;k++) if(x[k]<0) y++; } void main(){ int b[]={2,1,-8,-3,7,2,4,6,0,-13}; int x; count(b,10,x); cout<<“x”<<x<<end1; }A.x=3B.x=5C.出错D.x=0

以下( )表达式是不合法的。A.String x="Sky";int y=5;x + =y:B.String x="Sky":int y=5:if(x==y){}C.String x="Sky":int y=5:x=x+y:D.String x=null:int y=(x!=null) (x.length( )>0)?x.length:0

以下程序执行后的输出结果是()。includeusing namespace std;void try(int,int,int,in 以下程序执行后的输出结果是( )。 #include<iostream> using namespace std; void try(int,int,int,int); int main() { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<endl; return 0; } void try(int x,int y, int z,int r) { z = x+y; X = x*x; y = y*y; r = z+x+y; }A.18B.9C.10D.不确定

有以下程序:include using namespace std;int f1(int x, int y){ return x>y ? x:y;} 有以下程序: #include <iostream> using namespace std; int f1(int x, int y) { return x>y ? x:y; } int f2(int x, int y) { return x>y? y:x; } int main ( ) { int a = 4,b = 3,c = 5,d,e,f; d = f1(a,b) ; d = f1(d,c) ; e = f2 (a,b) ; e = f2(e,c) ; f = a+b+c-d-e; cout<<d<<", "<<e<<", "<<f<<end1; return 0; } 执行后的输出结果是 ( )。A.3,4,5B.5,3,4C.5,4,3D.3,5,4

以下程序执行后的输出结果是include.using namespace std;void try(int,int,int,int) 以下程序执行后的输出结果是 #include<iostream>. using namespace std; void try(int,int,int,int); int main() { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<end1; return 0; } void try(int x,int y, int z,int r) { z = x+y; x = x*x; y = y*y; r = z+x+y; }A.18B.9C.10D.不确定

下列带缺省值参数的函数说明中,正确的说明是 ______。A.int Fun(int x, int y=2,int z=3);B.int Fun(int x=1,int y,int z=3);C.int Fun(int x, int y=2,iht z);D.int Fun(int x=1,int y, int z=3);

下列变量定义正确的是()A、int   x_1 ; y;B、int  printf=2,x_y=2;C、int  for=4;D、int  x,y=5 ;

55. int []x= {1, 2,3,4, 5};  56. int y[] =x;  57. System.out.println(y[2]);  Which is true?() A、 Line 57 will print the value 2.B、 Line 57 will print the value 3.C、 Compilation will fail because of an error in line 55.D、 Compilation will fail because of an error in line 56.

Which two code fragments are most likely to cause a StackOverflowError?()A、int []x = {1,2,3,4,5};for(int y = 0; y  6; y++)    System.out.println(x[y]);B、static int[] x = {7,6,5,4};static { x[1] = 8;x[4] = 3; }C、for(int y = 10; y  10; y++)doStuff(y);D、void doOne(int x) { doTwo(x); }void doTwo(int y) { doThree(y); }void doThree(int z) { doTwo(z); }E、for(int x = 0; x  1000000000; x++) doStuff(x);F、void counter(int i) { counter(++i); }

单选题以下正确的函数原型为()Afun1(int x;int y);Bvoid fun1(x,y);Cvoid fun1(int x,y);Dvoid fun1(int,int);

多选题Which two code fragments are most likely to cause a StackOverflowError?()Aint []x = {1,2,3,4,5};for(int y = 0; y  6; y++)    System.out.println(x[y]);Bstatic int[] x = {7,6,5,4};static { x[1] = 8;x[4] = 3; }Cfor(int y = 10; y  10; y++)doStuff(y);Dvoid doOne(int x) { doTwo(x); }void doTwo(int y) { doThree(y); }void doThree(int z) { doTwo(z); }Efor(int x = 0; x  1000000000; x++) doStuff(x);Fvoid counter(int i) { counter(++i); }