单选题25.intx=12;  26. while (x < 10) {  27. x--;  28. }  29. System.out.print(x); What is the result?()A0B10C12DLine 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

 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.”相关问题
  • 第1题:

    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.

    正确答案:C

  • 第2题:

    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.

    正确答案:C

  • 第3题:

    20. public float getSalary(Employee e) {  21. assert validEmployee(e);  22. float sal = lookupSalary(e);  23. assert (sal>0);  24. return sal;  25. }  26. private int getAge(Employee e) {  27. assert validEmployee(e);  28. int age = lookupAge(e);  29. assert (age>0);  30. return age;  31. }  Which line is a violation of appropriate use of the assertion mechanism?()  

    • A、 line 21
    • B、 line 23
    • C、 line 27
    • D、 line 29

    正确答案:A

  • 第4题:

    int x= 10;  do {  x--;  } while(x< 10);  How many times will line 37 be executed?() 

    • A、 ten times
    • B、 zero times
    • C、 one to me times
    • D、 more than ten times

    正确答案:D

  • 第5题:

    1. public class Test {  2. int x= 12;  3. public void method(int x) {  4. x+=x;  5. System.out.println(x);  6. }  7. }  Given:  34. Test t = new Test();  35. t.method(5);  What is the output from line 5 of the Test class?() 

    • A、 5
    • B、 10
    • C、 12
    • D、 17
    • E、 24

    正确答案:B

  • 第6题:

    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、Line29willneverbereached.

    正确答案:C

  • 第7题:

    单选题
    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

    Line29willneverbereached.


    正确答案: B
    解析: 暂无解析

  • 第8题:

    单选题
    int x= 10;  do {  x--;  } while(x< 10);  How many times will line 37 be executed?()
    A

     ten times

    B

     zero times

    C

     one to me times

    D

     more than ten times


    正确答案: D
    解析: 暂无解析

  • 第9题:

    单选题
    Click the Exhibit button.   Given this code from Class B:   25. A a1 = new A();   26. A a2 = new A();   27. A a3 = new A();   28. System.out.println(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

     Compilation fails because of an error on line 28.

    E

     A runtime error occurs when line 25 executes.


    正确答案: E
    解析: 暂无解析

  • 第10题:

    单选题
    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.


    正确答案: B
    解析: 暂无解析

  • 第11题:

    单选题
    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.


    正确答案: D
    解析: 暂无解析

  • 第12题:

    单选题
    20. public float getSalary(Employee e) {  21. assert validEmployee(e);  22. float sal = lookupSalary(e);  23. assert (sal>0);  24. return sal;  25. }  26. private int getAge(Employee e) {  27. assert validEmployee(e);  28. int age = lookupAge(e);  29. assert (age>0);  30. return age;  31. }  Which line is a violation of appropriate use of the assertion mechanism?()
    A

     line 21

    B

     line 23

    C

     line 27

    D

     line 29


    正确答案: B
    解析: 暂无解析

  • 第13题:

    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 = 0
    • B、 The output is x = 7 y = 0
    • C、 The output is x = 6 y = -1
    • D、 The output is x = 7 y = -1
    • E、 Compilation will fail.

    正确答案:E

  • 第14题:

    1.public class Test{ 2.int x=12; 3.public void method(intx){ 4.x+=x; 5.System.out.println(x); 6.} 7.} Given: 34.Test t=new Test(); 35.t.method(5); What is the output from line 5 of the Test class?()

    • A、5
    • B、10
    • C、12
    • D、17
    • E、24

    正确答案:B

  • 第15题:

    int x=0; int y=10; do{l3.y--; ++x; }while(x<5); System.out.print(x+","+y); What is the result?()

    • A、5,6
    • B、5,5
    • C、6,5
    • D、6,6

    正确答案:B

  • 第16题:

    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.

    正确答案:A

  • 第17题:

    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.

    正确答案:A

  • 第18题:

    单选题
    Given: What is the result?()
    A

    Canada

    B

    null Canada

    C

    Canada null

    D

    Canada Canada

    E

    Compilation fails due to an error on line 26.

    F

    Compilation fails due to an error on line 29.


    正确答案: A
    解析: 暂无解析

  • 第19题:

    单选题
    1. public class Test {  2. int x= 12;  3. public void method(int x) {  4. x+=x;  5. System.out.println(x);  6. }  7. }  Given:  34. Test t = new Test();  35. t.method(5);  What is the output from line 5 of the Test class?()
    A

     5

    B

     10

    C

     12

    D

     17

    E

     24


    正确答案: B
    解析: 暂无解析

  • 第20题:

    单选题
    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.


    正确答案: C
    解析: 暂无解析

  • 第21题:

    单选题
    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 = 0

    B

     The output is x = 7 y = 0

    C

     The output is x = 6 y = -1

    D

     The output is x = 7 y = -1

    E

     Compilation will fail.


    正确答案: E
    解析: 暂无解析

  • 第22题:

    单选题
    int x=0;  int y 10;  do {  y--;  ++x;  } while (x < 5);  System.out.print(x + “,“ + y);  What is the result?()
    A

     5,6

    B

     5,5

    C

     6,5

    D

     6,6


    正确答案: B
    解析: 暂无解析

  • 第23题:

    单选题
    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.


    正确答案: E
    解析: 暂无解析

  • 第24题:

    单选题
    int x=0; int y=10; do{l3.y--; ++x; }while(x<5); System.out.print(x+","+y); What is the result?()
    A

    5,6

    B

    5,5

    C

    6,5

    D

    6,6


    正确答案: C
    解析: 暂无解析