网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
单选题
25.intx=12; 26. while (x < 10) { 27. x--; 28. } 29. System.out.print(x); What is the result?()
A
0
B
10
C
12
D
Line 29 will never be reached.
参考答案
参考解析
解析:
暂无解析
更多 “单选题25.intx=12; 26. while (x 10) { 27. x--; 28. } 29. System.out.print(x); What is the result?()A 0B 10C 12D Line 29 will never be reached.” 相关考题
考题
intx=12;26.while(x10){27.x--;28.}29.System.out.print(x);What is the result?()
A.0B.10C.12D.Line29willneverbereached.
考题
11.classCup{}12.classPoisonCupextendsCup{}21.publicvoidtakeCup(Cupc){22.if(cinstanceofPoisonCup){23.System.out.println(”Inconceivable!”);24.}elseif(cinstanceofCup){25.System.out.println(”Dizzyingintellect!”);26.}else{27.System.exit(0);28.}29.}Andtheexecutionofthestatements:Cupcup=newPoisonCup();takeCup(cup);Whatistheoutput?()A.Inconceivable!B.Dizzyingintellect!C.Thecoderunswithnooutput.D.Anexceptionisthrownatruntime.E.Compilationfailsbecauseofanerrorinline22.
考题
intx=10;do{x--;}while(x10);Howmanytimeswillline37beexecuted?()
A.tentimesB.zerotimesC.onetometimesD.morethantentimes
考题
以下不会造成死循环的C语句是(49)。A.while(x=8)x--;B.for(i=10;sum=0;sum<=i;)sum=--i;C.for(y=0,x=1;x>++y;x=i++)i=x;D.for(x=10;;x+=i);
考题
有以下程序: #includestdio.h main { int x=4,y; do { y=x; if(!y)printf("x"); else printf("y"): x--; }while(x); } 程序的输出结果是( )。A. xyyxB.yyyyC.yyxxD.yxyx
考题
有如下程序:includemain(){int x=23; do {Printf("%d",x--);} while(! x);}该程序的执
有如下程序: #include <stdio.h> main() { int x=23; do { Printf("%d",x--);} while(! x); } 该程序的执行结果是( )。A.321B.23C.不输出任何内容D.陷入死循环
考题
有以下程序:#includestdio.hmain{ int x=4,y;do{ y=x;if(!y)printf(x);elseprintf(y):x--;}while(x);}程序的输出结果是( )。A.A.xyyxB.yyyyC.yyxxD.yxyx
考题
25.intx=12; 26. while (x 10) { 27. x--; 28. } 29. System.out.print(x); What is the result?()A、 0B、 10C、 12D、 Line 29 will never be reached.
考题
Assume that country is set for each class. Given: 10. public class Money { 11. private String country, name; 12. public getCountry() { return country; } 13.} and: 24. class Yen extends Money { 25. public String getCountry() { return super.country; } 26. } 27. 28. class Euro extends Money { 29. public String getCountry(String timeZone) { 30. return super.getCountry(); 31. } 32. } Which two are correct?()A、 Yen returns correct values.B、 Euro returns correct values.C、 An exception is thrown at runtime.D、 Yen and Euro both return correct values.E、 Compilation fails because of an error at line 25.F、 Compilation fails because of an error at line 30.
考题
20. public float getSalary(Employee e) { 21. assert validEmployee(e); 22. float sal = lookupSalary(e); 23. assert (sal0); 24. return sal; 25. } 26. private int getAge(Employee e) { 27. assert validEmployee(e); 28. int age = lookupAge(e); 29. assert (age0); 30. return age; 31. } Which line is a violation of appropriate use of the assertion mechanism?() A、 line 21B、 line 23C、 line 27D、 line 29
考题
int x= 10; do { x--; } while(x 10); How many times will line 37 be executed?() A、 ten timesB、 zero timesC、 one to me timesD、 more than ten times
考题
1. public class A { 2. 3. private int counter = 0; 4. 5. public static int getInstanceCount() { 6. return counter; 7. } 8. 9. public A() { 10. counter++; 11. } 12. 13. } Given this code from Class B: 25.A a1 =new A(); 26. A a2 =new A(); 27. A a3 =new A(); 28. System.out.printIn(A.getInstanceCount() ); What is the result?() A、 Compilation of class A fails.B、 Line 28 prints the value 3 to System.out.C、 Line 28 prints the value 1 to System.out.D、 A runtime error occurs when line 25 executes.E、 Compilation fails because of an error on line 28.
考题
25.intx=12; 26.while(x10){ 27.x--; 28.} 29.System.out.print(x); What is the result?()A、0B、10C、12D、Line29willneverbereached.
考题
单选题11. class Cup { } 12. class PoisonCup extends Cup { } 21. public void takeCup(Cup c) { 22. if(c instanceof PoisonCup) { 23. System.out.println(”Inconceivable!”); 24. } else if(c instanceof Cup) { 25. System.out.println(”Dizzying intellect!”); 26. } else { 27. System.exit(0); 28. } 29. } And the execution of the statements: Cup cup = new PoisonCup(); takeCup(cup); What is the output?()A
Inconceivable!B
Dizzying intellect!C
The code runs with no output.D
An exception is thrown at runtime.E
Compilation fails because of an error in line 22.
考题
单选题25.intx=12; 26.while(x10){ 27.x--; 28.} 29.System.out.print(x); What is the result?()A
0B
10C
12D
Line29willneverbereached.
考题
单选题int x= 10; do { x--; } while(x 10); How many times will line 37 be executed?()A
ten timesB
zero timesC
one to me timesD
more than ten times
考题
单选题23. Object [] myObjects = { 24. new integer(12), 25. new String(”foo”), 26. new integer(5), 27. new Boolean(true) 28. }; 29. Arrays.sort(myObjects); 30. for( int i=0; i31. System.out.print(myObjects[i].toString()); 32. System.out.print(” “); 33. } What is the result?()A
Compilation fails due to an error in line 23.B
Compilation fails due to an error in line 29.C
A ClassCastException occurs in line 29.D
A ClassCastException occurs in line 31.E
The value of all four objects prints in natural order.
考题
单选题20. public float getSalary(Employee e) { 21. assert validEmployee(e); 22. float sal = lookupSalary(e); 23. assert (sal0); 24. return sal; 25. } 26. private int getAge(Employee e) { 27. assert validEmployee(e); 28. int age = lookupAge(e); 29. assert (age0); 30. return age; 31. } Which line is a violation of appropriate use of the assertion mechanism?()A
line 21B
line 23C
line 27D
line 29
热门标签
最新试卷