单选题Given: What is the result?()ACompilation fails.BAn exception is thrown at runtime.CdoStuff x = 6 main x = 6DdoStuff x = 6 main x = 7EdoStuff x = 7 main x = 6

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

Compilation fails.

B

An exception is thrown at runtime.

C

doStuff x = 6 main x = 6

D

doStuff x = 6 main x = 7

E

doStuff x = 7 main x = 6


相似考题
参考答案和解析
正确答案: A
解析: 暂无解析
更多“单选题Given: What is the result?()A Compilation fails.B An exception is thrown at runtime.C doStuff x = 6 main x = 6D doStuff x = 6 main x = 7E doStuff x = 7 main x = 6”相关问题
  • 第1题:

    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

  • 第2题:

    Given the command line java Pass2 and: public class Pass2{ public void main(String[]args){ int x=6; Pass2 p=new Pass2(); p.doStuff(x); System.out.print("mainx="+x); } void doStuff(intx){ System.out.print("doStuffx="+x++); } } What is the result?()

    • A、Compilation fails.
    • B、An exception is thrown at runtime.
    • C、doStuffx=6 main x=6
    • D、doStuffx=6 mainx =7
    • E、doStuffx=7 mainx =6
    • F、doStuffx=7 mainx =7

    正确答案:B

  • 第3题:

    public class Pass {  public static void main(String [1 args) {  int x 5;  Pass p = new Pass();  p.doStuff(x);  System.out.print(” main x = “+ x);  }  void doStuff(int x) {  System.out.print(” doStuff x = “+ x++);  }  }  What is the result?() 

    • A、 Compilation fails.
    • B、 An exception is thrown at runtime.
    • C、 doStuffx = 6 main x = 6
    • D、 doStuffx = 5 main x = 5
    • E、 doStuffx = 5 main x = 6
    • F、 doStuffx = 6 main x = 5

    正确答案:D

  • 第4题:

    public class Test {  private static int[] x;  public static void main(String[] args) {  System.out.println(x[0]);  }  }   What is the result?()   

    • A、 0
    • B、 null
    • C、 Compilation fails.
    • D、 A NullPointerException is thrown at runtime.
    • E、 An ArrayIndexOutOfBoundsException is thrown at runtime.

    正确答案:D

  • 第5题:

    public class TestOne {  public static void main (String[] args) throws Exception {  Thread.sleep(3000);  System.out.println(”sleep”);  }  }  What is the result?() 

    • A、 Compilation fails.
    • B、 An exception is thrown at runtime.
    • C、 The code executes normally and prints “sleep”.
    • D、 The code executes normally, but nothing is printed.

    正确答案:C

  • 第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); }

    正确答案:D,F

  • 第7题:

    单选题
    public class Pass {  public static void main(String [1 args) {  int x 5;  Pass p = new Pass();  p.doStuff(x);  System.out.print(” main x = “+ x);  }  void doStuff(int x) {  System.out.print(” doStuff x = “+ x++);  }  }  What is the result?()
    A

     Compilation fails.

    B

     An exception is thrown at runtime.

    C

     doStuffx = 6 main x = 6

    D

     doStuffx = 5 main x = 5

    E

     doStuffx = 5 main x = 6

    F

     doStuffx = 6 main x = 5


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

  • 第8题:

    单选题
    Given the command line java Pass2 and: public class Pass2{ public void main(String[]args){ int x=6; Pass2 p=new Pass2(); p.doStuff(x); System.out.print("mainx="+x); } void doStuff(intx){ System.out.print("doStuffx="+x++); } } What is the result?()
    A

    Compilation fails.

    B

    An exception is thrown at runtime.

    C

    doStuffx=6 main x=6

    D

    doStuffx=6 mainx =7

    E

    doStuffx=7 mainx =6

    F

    doStuffx=7 mainx =7


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

  • 第9题:

    单选题
    public class Starter extends Thread {  private int x= 2;  public static void main(String[] args) throws Exception {  new Starter().makeItSo();  }  public Starter() {  x=5;  start();  }  public void makeItSo() throws Exception {  join();  x=x- 1;  System.out.println(x);  }  public void run() { x *= 2; }  }  What is the output if the main() method is rum?()
    A

     4

    B

     5

    C

     8

    D

     9

    E

     Compilation fails.

    F

     An exception is thrown at runtime.

    G

     It is impossible to determine for certain.


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

  • 第10题:

    单选题
    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
    解析: 暂无解析

  • 第11题:

    单选题
    interface DeclareStuff{  public static final int EASY = 3;  void doStuff(int t); }  public class TestDeclare implements DeclareStuff {  public static void main(String [] args) {  int x=5;  new TestDeclare().doStuff(++x);  }  void doStuff(int s) {  s += EASY + ++s;  System.out.println(”s “ + s);  }  }  What is the result?()
    A

     s 14

    B

     s 16

    C

     s 10

    D

     Compilation fails.

    E

     An exception is thrown at runtime.


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

  • 第12题:

    单选题
    public class Pass{ public static void main(String[]args){ int x=5; Pass p=new Pass(); p.doStuff(x); System.out.print("mainx="+x); } void doStuff(intx){ System.out.print("doStuffx="+x++); } } What is the result?()
    A

    Compilation fails.

    B

    An exception is thrown at runtime.

    C

    doStuff x=6 main x=6

    D

    doStuff x=5 main x=5

    E

    doStuff x=5 main x=6

    F

    doStuff x=6 main x=5


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

  • 第13题:

    interface DeclareStuff{  public static final int EASY = 3;  void doStuff(int t); }  public class TestDeclare implements DeclareStuff {  public static void main(String [] args) {  int x=5;  new TestDeclare().doStuff(++x);  }  void doStuff(int s) {  s += EASY + ++s;  System.out.println(”s “ + s);  }  }  What is the result?() 

    • A、 s 14
    • B、 s 16
    • C、 s 10
    • D、 Compilation fails.
    • E、 An exception is thrown at runtime.

    正确答案:D

  • 第14题:

    Given the command line java Pass2 and:  public class Pass2 {  public void main(String [] args) {  int x=6;  Pass2 p = new Pass2();  p.doStuff(x);  System.out.print(” main x = “+ x); }  void doStuff(int x) {  System.out.print(” doStuffx = “+ x++);  }  }  What is the result?() 

    • A、 Compilation fails.
    • B、 An exception is thrown at runtime.
    • C、 doStuffx = 6 main x = 6
    • D、 doStuffx = 6 main x = 7
    • E、 doStuffx = 7 main x = 6
    • F、 doStuffx = 7 main x = 7

    正确答案:B

  • 第15题:

    1. class SuperFoo {  2. SuperFoo doStuff(int x) {  3. return new SuperFoo(); 4. }  5. }  6.  7. class Foo extends SuperFoo {  8. //insert code here  9. }   下面哪三项分别插入到第8行,可以编译?()

    • A、int doStuff() { return 42; }
    • B、int doStuff(int x) { return 42; }
    • C、Foo doStuff(int x) { return new Foo(); }
    • D、SuperFoo doStuff(int x) { return new Foo(); }

    正确答案:A,C,D

  • 第16题:

    public class Starter extends Thread {  private int x= 2;  public static void main(String[] args) throws Exception {  new Starter().makeItSo();  }  public Starter() {  x=5;  start();  }  public void makeItSo() throws Exception {  join();  x=x- 1;  System.out.println(x);  }  public void run() { x *= 2; }  }  What is the output if the main() method is rum?() 

    • A、 4
    • B、 5
    • C、 8
    • D、 9
    • E、 Compilation fails.
    • F、 An exception is thrown at runtime.
    • G、 It is impossible to determine for certain.

    正确答案:D

  • 第17题:

    现有:  1.class SuperFoo{  2.SuperFoo doStuff (int x)  {      3.return new SuperFoo();      4.    }      5.  }      6.  7. class Foo extends SuperFoo  {     8.    //insert code here     9.  }  和四个声明:   Foo doStuff (int x)  {  return new Foo();  }  Foo doStuff (int x)  {  return new SuperFoo();  }      SuperFoo doStuff(int x)  {  return new Foo();  }  SuperFoo doStuff(int y)  {  return new SuperFoo();  }    分别插入到第8行,有几个可以通过编泽?()    

    • A、 1
    • B、 2
    • C、 3
    • D、 4

    正确答案:D

  • 第18题:

    单选题
    public class Test {  private static int[] x;  public static void main(String[] args) {  System.out.println(x[0]);  }  }   What is the result?()
    A

     0

    B

     null

    C

     Compilation fails.

    D

     A NullPointerException is thrown at runtime.

    E

     An ArrayIndexOutOfBoundsException is thrown at runtime.


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

  • 第19题:

    单选题
    Given the command line java Pass2 and:  public class Pass2 {  public void main(String [] args) {  int x=6;  Pass2 p = new Pass2();  p.doStuff(x);  System.out.print(” main x = “+ x); }  void doStuff(int x) {  System.out.print(” doStuffx = “+ x++);  }  }  What is the result?()
    A

     Compilation fails.

    B

     An exception is thrown at runtime.

    C

     doStuffx = 6 main x = 6

    D

     doStuffx = 6 main x = 7

    E

     doStuffx = 7 main x = 6

    F

     doStuffx = 7 main x = 7


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

  • 第20题:

    单选题
    Given the command line java Pass2 and: What is the result? ()
    A

     doStuff x = 6 main x = 6

    B

     Compilation fails.

    C

     doStuff x = 6 main x = 7

    D

     An exception is thrown at runtime.

    E

     doStuff x = 7 main x = 6

    F

     doStuff x = 7 main x = 7


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

  • 第21题:

    单选题
    现有:  1.class SuperFoo{  2.SuperFoo doStuff (int x)  {      3.return new SuperFoo();      4.    }      5.  }      6.  7. class Foo extends SuperFoo  {     8.    //insert code here     9.  }  和四个声明:   Foo doStuff (int x)  {  return new Foo();  }  Foo doStuff (int x)  {  return new SuperFoo();  }      SuperFoo doStuff(int x)  {  return new Foo();  }  SuperFoo doStuff(int y)  {  return new SuperFoo();  }    分别插入到第8行,有几个可以通过编泽?()
    A

     1

    B

     2

    C

     3

    D

     4


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

  • 第22题:

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

    test end

    B

    Compilation fails.

    C

    test runtime end

    D

    test exception end

    E

    A Throwable is thrown by main at runtime.


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

  • 第23题:

    单选题
    public class Yippee2 {  static public void main(String [] yahoo) {  for(int x= 1; xSystem.out.print(yahoo[x] + “ “);  }  }  }  and the command line invocation: java Yippee2 a b c What is the result?()
    A

    a b

    B

    b c

    C

    a b c

    D

     Compilation fails.

    E

     An exception is thrown at runtime.


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