根据变量定义“static int x[5],y[2][3]={9,6,3,1,4,7};”,x[4]=【 】,y[1][2]=【 】。
第1题:
执行下列代码段之后,变量z的值为______。 Public class Test8 { public static void main(String[] args) { int x=2; int y=3; int z=4; z-....= y-x--; System.out.println(z); }
A.1
B.2
C.3
D.4
第2题:
已有定义:int x=3,y=4,z=5,则表达式!(x+y)+z-1&&y+x/2的值是
A.6
B.0
C.2
D.1
第3题:
下列程序的运行结果是( )。 #include<stdio.h> void sub(int*s,int*y) {static int m=4; *y=s[0]; m++; } void main() {int a[]={1,2,3,4,5},k; int x; printf("\n"); for(k=0;k<=4;k++) {sub(a,&x); printf("%d,",x); } }
A.1,1,1,1,1,
B.1,2,3,4,5,
C.0,0,0,0,0,
D.4,4,4,4,4,
第4题:
下列程序的运行结果是( )。 #include<stdio.h> void sub(int*s,int*y) {static int m=4: *y=s[m]; m--; } void main() {int a[]={1,2,3,4,5},k,x; printf("\n"); for(k=0;k<=4;k++) {sub(a,&x); printf("%d,",x); } }
A.5,4,3,2,1,
B.1,2,3,4,5,
C.0,0,0,0,0,
D.4,4,4,4,4,
第5题:
设x和y均为int型变量,则执行下面的循环后,y值为( )。#include <iostream.h>void main(){int x, y;for(y= 1,x= 1 ;y<=50;y++){ if(x>=10) }break;if (x%2==1){ x+=5; continue;} x-=3;} cout<<y;
A.2
B.4
C.6
D.8
第6题:
执行下列程序段后,变量y的值为( ) int x[]={1,2,3,4},y,*p=&x[1]; y=(*--P)++;
A.1
B.2
C.3
D.4
第7题:
下列程序段的输出结果是 ______。 void fun(int * x,int * y) {pnntf("%d%d",* x,* y);* x=3;*y=4;} main() { int x=1,y=2; fun(&y,&x); printf ("%d%d",x,y); }
A.2 1 4 3
B.1 2 1 2
C.1 2 3 4
D.2 1 1 2
第8题:
假设变量定义int x=1,y=2,z=3;则表达式y+=z--/++x的值是()。
第9题:
下列变量定义正确的是()
第10题:
class TestMain { static int x = 2; static { x = 4; } static public void main(String[] args) { int y = x + 1; System.out.println(y); } } 和命令行: java TestMain 结果为:()
第11题:
g(3,2)
f(3)
a1.f(4)
a1.g(2,5)
第12题:
3
3.5
4
5
第13题:
设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
第14题:
已有定义int x=3, y=4, z=5;则表达式“!(x+y)+z-1y+z/2”的值是________。
A.6
B.0
C.2
D.1
第15题:
下列程序的输出结果是( )。
void fun(int*X,int y)
{ printf("%d%d",*x,*y);*x=3;*y=1;}
main
{ int x=1,y=2;
fun(&y,&x);
printf("%d%d",x,y);
}
A.2 1 4 3
B.1 2 1 2
C.1 2 3 4
D.2 1 1 2
第16题:
下面程序段的输出结果是______。 public class Test{ public static void main(String args[ ]){ int x,y; x=(int)Math.sqrt(5/2)+(int)Math.random( )*5/2; y=(int)Math.sqrt(3/2)+(int)Math.random( )*3/2; if(x>y) System.out.println("x>y"); else if(x==y) System.out.println("x=y"); else System.out.println("x<y"); } }
A.x>y
B.x=y
C.x<y
D.编译错误
第17题:
设x和y为int型变量,则执行下面的循环后,y的值为( ) for(y=l, x=l; y<=50; x="">=10) break; if(x%2==1){ x+=5; continue;} X -= 3; }
A.2
B.4
C.6
D.8
第18题:
若有定义语句:int x=3,y=2,z=1;,表达式:2*=(x>y?++x:y+)的值是
A.4
B.0
C.1
D.3
第19题:
第20题:
若有定义 class A{int x,y; static float f(int a){…} float g(int x1,int x2){…}} 及A a1=new A( );则下列用法中非法的是( )。
第21题:
设x和y均为int型变量,则执行下的循环后,y值为()for(y=1,x=1;y<=50;y) {if(x==10))break; if(x%2==1) {x=5;continue;} x-=3; }
第22题:
Which two code fragments are most likely to cause a StackOverflowError?()
第23题:
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); }