int []x = {1,2,3,4,5};for(int y = 0; y < 6; y++) System.out.println(x[y]);
static int[] x = {7,6,5,4};static { x[1] = 8;x[4] = 3; }
for(int y = 10; y < 10; y++)doStuff(y);
void doOne(int x) { doTwo(x); }void doTwo(int y) { doThree(y); }void doThree(int z) { doTwo(z); }
for(int x = 0; x < 1000000000; x++) doStuff(x);
void counter(int i) { counter(++i); }
第1题:
下列程序的运行结果是_______。
main()
{ int x=1,y=2,z=3;
printf("%d,",x<y?y:x);
primf("%d,",z<y?x++:y++);
primf("%d,%d",x,y);
}
第2题:
for(int x=0,y=0;!x&&y<=5;y++)语句执行循环的次数是( )。
A.0
B.5
C.6
D.无穷
第3题:
阅读下面程序:
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);
}
则该程序的输出结果是______。
第4题:
设x和y均为int型变量,则执行下面的循环后,y值为( )。 public class Sun { public static void main(String args[ ]) { int x, y; for (y=1, x=1; y<=50; y++) { if(x>=10) break; if (x%2==1) { x+=5; continue; } x-=3; } System.out.println (y); } }
A.2
B.4
C.6
D.8
第5题:
下列程序的输出结果是 #include<iostream.h> class Myclass{ public : Myclass( int i=0,int j=0) {x=i; y=j; } void show( ){cout<<"x="<<x<<" "<"y="<<y<<endl;} void show( )const{cout<<"x="<
A.x=4,y=3;x=7,y=8
B.x=3,y=4;x=7,y=8
C.x=7,y=8;x=4,y=3
D.x=8,y=7;x=7,y=8
第6题:
若有以下程序段: #include <iostream> using namespace std; int main () { int a[]={1,4,5}; int *p=&a[0],x=6, y,z; for (y=0; y<3; y++) z= ( (* (p+y) <x) ? *(p+y) :x); cout<<z<<end1; return 0; } 程序运行后的输出结果是( )。
A.1
B.4
C.5
D.2
第7题:
下列程序的输出结果是 #include<iostream.h> class Myclass{ public:Myclass(int i=0,int j=0) { x=i; y=j; } void show( ) {cout < <"x=" < < x < <" " <"y=" < < y < < endl;} void show( ) const{cout < <"x=" < <" " < <"y=" < < y < < endl;} privated: int x; int y; }; void main( ) { Myclass my1(3,4) ; const my2(7,8) ; my1.show( ) ;my2.show( ) ;}
A.x=4,y=3;x=7,y=8
B.x=3,y=4;x=7,y=8
C.x=7,y=8;x=4,y=3
D.x=8,y=7;x=7,y=8
第8题:
阅读下面程序:
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),
}
则该程序的输出结果是【 】
第9题:
for(int x=0,y=0;!x||y<=5;y++,x=!x)语句执行的循环次数是( )。
A.0
B.7
C.6
D.无数次
第10题:
下列程序段的运行结果是______。
int x=0,y=0;
while(x<15) y++,x+=++y;
pfintf("%d,%d",y,x);