网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
int x = 1, y =6; while (y--) { x++; } System.out.println(“x =” + x + “y =” +y); What is the result?()
- A、 x = 6 y = 0
- B、 x = 7 y = 0
- C、 x = 6 y = -1
- D、 x = 7 y = -1
- E、 Compilation fails.
参考答案
更多 “ int x = 1, y =6; while (y--) { x++; } System.out.println(“x =” + x + “y =” +y); What is the result?() A、 x = 6 y = 0B、 x = 7 y = 0C、 x = 6 y = -1D、 x = 7 y = -1E、 Compilation fails.” 相关考题
考题
有下列程序:#include"stdio.h"main(){ int x=0;int y=0;while(x<7++y){ y--;x++;}printf("%d,%d",y,x);}程序的输出结果是( )。A.0,7B.7,7C.0,6D.1,6
考题
publicclassWhileFoo{publicstaticvoidmain(String[]args){intx=1,y=6;while(y--){x--;}system.out.printIn(x=”+xy=”+y);}}Whatistheresult?()
A.Theoutputisx=6y=0B.Theoutputisx=7y=0C.Theoutputisx=6y=-1D.Theoutputisx=7y=-1E.Compilationwillfail.
考题
intx=1,y=6;while(y--){x++;}System.out.println(x=”+x+y=”+y);Whatistheresult?()
A.x=6y=0B.x=7y=0C.x=6y=-1D.x=7y=-1E.Compilationfails.
考题
下面程序的输出是________。 main() {int x=3,y=6,a=0; while(x++!=(y=|)) { a+=1; if(y<x)break; } printf("x=%d,y=%d,a=%d\n",x,y,A) ; }A.x=4,y=4,a=1B.x=5,y=5,a=1C.x=5,y=4,a=3D.x=5,y=4,a=1
考题
下面程序的输出是______。 main() {int x=3,y=6,a=0; while(x++!=y-=1)) { a+=1; if(y<x)break; } printf("x=%d,a=%d\n",x,y,A) ; }A.x=4,y=4,a=1B.x=5,y=5,a=1C.x=5,y=4,a=3D.x=5,y=,a=1
考题
下面程序的输出是______。 main() {int x=3,y=6,a=0; while(x++!=(y-=1)) { a+=1 if(y<x)break; } printf("x=%d,y=%d,=%d\n",x,y,a); }A.x=4,y=4,a=1B.x=5,y=5,a=1C.x=5,y=4,a=3D.x=5,y=4,a=1
考题
有下列程序: #include " stdio.h" main() { int x=0; int y=0; while (x<7++y) { y--; x++;} printf("%d,%d",y,x); } 程序的输出结果是( )。A.0, 7B.7, 7C.0,6D.1,6
考题
下面程序的输出结果是main{ int x=3 ,y=6,a=0; while(x++!=(y-=1) ) { a+=1; if (yx) break; } printf("x=%d,y=%d,a=%d\n",x,y,a);}A.x=4,y=4,a=1 B.x=5,y=5,a=1 C.x=5,y=4,a=1 D.x=5,y=4,a=3
考题
有下列程序:#includestdio.hmain{ int x=0;int y=0;while(x7 &&++y){ y--;x++;}printf(%d,%d,y,x);}程序的输出结果是( )。A.0,7B.7,7C.0,6D.1,6
考题
有下列程序: #includestdio.h main { int x=0; int y=0; while(x7 &&++v) { y--; x++;} printf("%d,%d",y,x); } 程序的输出结果是( )。A.0,7B.7,7C.0,6D.1,6
考题
设以下变量均为int类型,则值不等于7的表达式是( )A.(x=y=6,x+y,x+1)
B.(x=y=6,x+y,y+1)
C.(x=6,x+1,y=6,x+y)
D.(y=6,y+1,x=y,x+1)
考题
int x=0; int y 10; do { y--; ++x; } while (x 5); System.out.print(x + “,“ + y); What is the result?() A、 5,6B、 5,5C、 6,5D、 6,6
考题
1. public class X implements Runnable( 2. private int x; 3. private int y; 4. 5. public static void main(String[]args) 6. X that = new X(); 7. (new Thread(that)).start(); 8. (new Thread(that)).start(); 9. ) 10. 11. public void run() ( 12. for (;;) ( 13. x++; 14. y++; 15. System.out.printIn(“x=” + x + “, y = ” + y); 16. ) 17. ) What is the result?()A、 Errors at lines 7 and 8 cause compilation to fail.B、 The program prints pairs of values for x and y that might not always be the same on the same line (for example, “x=2, y=1”).C、 The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears twice (for example, “x=1, y=1” followed by “x=1, y=1”).D、 The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears only for once (for example, “x=1, y=1” followed by “x=2, y=2”).
考题
class DemoApp{ public static void main(String[] args){ int x = 5; int y = ++x + x++; S ystem.out.println(“y=”+y+”,x=”+x); } } 以上程序运行后的输出结果是哪项?() A、y=10,x=5B、y=11,x=6C、y=12,x=7D、y=11,x=7
考题
public class WhileFoo { public static void main (String []args) { int x= 1, y = 6; while (y--) {x--;} system.out.printIn(“x=” + x “y =” + y); } } What is the result?() A、 The output is x = 6 y = 0B、 The output is x = 7 y = 0C、 The output is x = 6 y = -1D、 The output is x = 7 y = -1E、 Compilation will fail.
考题
public class X implements Runnable ( private int x; private int y; public static void main(String args) ( X that = new X(); (new Thread(that)) . start( ); (new Thread(that)) . start( ); ) public synchronized void run( ) ( for (;;) ( x++; y++; System.out.printIn(“x = “ + x + “, y = “ + y); ) ) ) What is the result?()A、 An error at line 11 causes compilation to fail.B、 Errors at lines 7 and 8 cause compilation to fail.C、 The program prints pairs of values for x and y that might not always be the same on the same line (for example, “x=2, y=1”)D、 The program prints pairs of values for x and y that are always the same on the same line (forexample, “x=1, y=1”. In addition, each value appears twice (for example, “x=1, y=1” followed by “x=1, y=1”)E、 The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears twice (for example, “x=1, y=1” followed by “x=2s, y=2”)
考题
public class X implements Runnable( private int x; private int y; public static void main(Stringargs) X that = new X(); (new Thread(that)).start(); (new Thread(that)).start(); ) public void run() ( for (;;) ( x++; y++; System.out.printIn(“x=” + x + “, y = ” + y); ) ) What is the result?() A、 Errors at lines 7 and 8 cause compilation to fail.B、 The program prints pairs of values for x and y that might not always be the same on the same line (for example, “x=2, y=1”).C、 The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears twice (for example, “x=1, y=1” followed by “x=1, y=1”).D、 The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears only for once (for example, “x=1, y=1” followed by “x=2, y=2”).
考题
设以下变量均为int类型,则值不等于7的表达式是()。A、(x=y=6,x+y,x+1)B、(x=y=6,x+y,y+1)C、(x=6,x+1,y=6,x+y)D、(y=6,y+1,x=y,x+1)
考题
int x=0; int y=10; do{l3.y--; ++x; }while(x5); System.out.print(x+","+y); What is the result?()A、5,6B、5,5C、6,5D、6,6
考题
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); }
考题
单选题int x = 1, y =6; while (y--) { x++; } System.out.println(“x =” + x + “y =” +y); What is the result?()A
x = 6 y = 0B
x = 7 y = 0C
x = 6 y = -1D
x = 7 y = -1E
Compilation fails.
考题
多选题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); }
考题
单选题int x=0; int y 10; do { y--; ++x; } while (x 5); System.out.print(x + “,“ + y); What is the result?()A
5,6B
5,5C
6,5D
6,6
考题
单选题设以下变量都是int类型,则值不等于7的表达式是()。A
x=y=6,x+y,x+1B
x=y=6,x+y,y+1C
x=6,x+1,y=6,x+yD
y=6,y+1,x=y,x+1
考题
单选题有以下程序:#include main(){ int x=0,y=6; do { while(--y)x++; } while(y--); printf(%d,%d,x,y); }程序的运行结果是( )。A
5,0B
6,0C
5,-1D
6,-1
考题
单选题What is the result?()A
The output is X = 6 y = 0B
The output is x = 7 y = 0C
The output is x = 6 y = -1D
The output is x = 7 y = -1E
Compilation will fail.
热门标签
最新试卷