int x=0 step1 for(; x < 11 ; x++) { if(x = = 6) { x= 8 break step1; } if( x = = 3 ) { x+ + continue } System.out.print(x +“ ”); } 结果为:()
第1题:
( 20 )要定义整型数组 x ,使之包括初值为 O 的三个元素,下列语句中错误的是
A ) int x[3]={0,0,0};
B ) int x[]={0};
C ) static int x[3]={0};
D ) int x[]={0,0,0};
第2题:
有如下程序: #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
第3题:
以下程序的输出结果是 【 17 】 。
int fun(int *x,int n)
{ if(n==0) return x[0];
else return x[0]+fun(x+1,n-1);
}
main( )
{ int a[]={1,2,3,4,5,6,7}; printf("%d\n",fun(a,3));}
第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.h>
void fun(int x=0,int y=0)
{
cout < < x < < y;
}
void main( )
{
fun(5) ;
}
第6题:
A.public class test { public int x = 0; public test(int x) { this.x = x; } }
B.public class Test{ public int x=0; public Test(int x) { this.x = x; } }
C.public class Test extends T1, T2 { public int x = 0; public Test (int x) { this.x = x; } }
D.public class
第7题:
有以下程序: #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
第8题:
下列函数原型声明中错误的是
A.void Fun(int x=O,int y=0);
B.void Fun(int x,int y);
C.void Fun(int x,int y=0);
D.void Fun(int x=0,int y);
第9题:
下列程序的运行结果是 #include<iostream.h> class Location{ private: int X.Y; public: void init(int=0,int=0); void valueX(int val){X=val;} int valueX( ){ return X;} void valueY
A.5 0 6 4
B.0 0 6 4
C.5 0 6 2
D.0 0 6 2
第10题:
设int x:,则经过______ 后,语句*px=0;可将x值置为0。
A.int*px;
B.int const *px=&x;
C.int* const px=&x:
D.const int *px=&x;