55. int []x= {1, 2,3,4, 5}; 56. int y[] =x; 57. System.out.println(y[2]); Which is true?()
第1题:
以下程序执行后的输出结果是( )。 #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.18
B.9
C.10
D.不确定
第2题:
下面程序的结果【 】。
include<iostream.h>
int f(int);
void main() {
int x=1, i;
for (i=0; i<3; i++)
cout<<f(x)<<‘ ’ ;
cout<<end1;
}
int f(int x){
int y=1;
static int z=3
y++;
z++;
return (x+y+z);
}
第3题:
有以下程序
int fa(int x){return x*x;}
int fb(int x){return x*x*x;}
int f(int(*fl)(),int(*f2)(),int x}
{return f2(x)-f1(x);}
main()
{int i;i=f(fa,fb,2);printf("%d\n",i);}
程序运行后,输出结果是【 】。
第4题:
有如下程序: #include <iostream> void fun(int& x, int y){int t=x;x=y;y=t;} int main () { int a[2]={23,42}; fun(a[1],a[0]); std::cout<<a[0]<<","<<a[1]<<std::endl; return 0; } 执行后的输出结果是
A.42,42
B.23,23
C.23,42
D.42,23
第5题:
有如下程序:
#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) 10
B) 16
C) 26
D) 36
A.
B.
C.
D.
第6题:
有以下程序: #include<iostream> using namespace std; int f(int,int); int main() { int i:1,x; x=f(i,i+1); cout<<x<<end1; return 0; } int f(int a,int b) { int c; c = a; if(a>b) c = 1; else if(a==b) c = 0; else c = -2; return c; } 运行后的输出结果是( )。
A.1
B.0
C.-1
D.-2
第7题:
以下程序的输出的结果是( )。int x=3;main(){ int i;for(i=1;i<x;i++)incre();}incre(){ staic int x=1; x*=x+1; printf(" %d", x);}
A.33
B.22
C.26
D.25
第8题:
有如下程序: #include <iostream> void fun (int& x,int y){int t=x;x=y;y=t;} int main() { int a[2]={23,42}; fun (a[1],a[0]; std::cout<<a[0]<<”,”<<a[1]<<std:: ond1; retum0; }执行后的输出结果是______ 。
A.41,41
B.23,23
C.13,42
D.42,23
第9题:
有以下程序: #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)
第10题:
下列程序的输出结果是( )。
#include<stdio.h>
int fun(int x)
{ int a;
if(x==0‖x==1)
return 3;
else
a=x-fun(x-2) ;
return a;
}
void main()
{ printf("%d",fun(7) );
}
A.2
B.8
C.9
D.5