单选题Given: What is the result?()Atest endBCompilation fails.Ctest runtime endDtest exception endEA Throwable is thrown by main at runtime.

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


相似考题
更多“单选题Given: What is the result?()A test endB Compilation fails.C test runtime endD test exception endE A Throwable is thrown by main at runtime.”相关问题
  • 第1题:

    public class Test {  public static void main( String[] args) {  String foo = args[1];  String bar = args[2];  String baz = args[3];  System.out.println(“baz = “ + baz); }  }   And the command line invocation: java Test red green blue   What is the result?()  

    • A、 baz =
    • B、 baz = null
    • C、 baz = blue
    • D、 Compilation fails.
    • E、 An exception is thrown at runtime.

    正确答案:E

  • 第2题:

    11. String test = “This is a test”;  12. String[] tokens = test.split(”/s”);  13. System.out.println(tokens.length);  What is the result?() 

    • A、 0
    • B、 1
    • C、 4
    • D、 Compilation fails.
    • E、 An exception is thrown at runtime.

    正确答案:D

  • 第3题:

    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

  • 第4题:

    public static void test(String str) { int check = 4;  if (check = str.length()) {  System.out.print(str.charAt(check -= 1) +“, “);  } else {  System.out.print(str.charAt(0) + “, “);  }  }  and the invocation:  test(”four”);  test(”tee”); test(”to”);  What is the result?() 

    • A、 r, t, t,
    • B、 r, e, o,
    • C、 Compilation fails.
    • D、 An exception is thrown at runtime.

    正确答案:C

  • 第5题:

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

    collie

    B

    harrier

    C

    Compilation fails.

    D

    collie harrier

    E

    An exception is thrown at runtime.


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

  • 第6题:

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

  • 第7题:

    单选题
    public class Test {  public static void main(String [] args) {  System.out.println(args.length > 4 &&  args[4].equals(“-d”));  }  }   If the program is invoked using the command line: java Test One Two Three –d   What is the result?()
    A

     true

    B

     false

    C

     Compilation fails.

    D

     An exception is thrown at runtime.


    正确答案: B
    解析: The correct answer to this question is D. The args[4] generates a runtime exception error because there are only 4 strings and the expression args[4] prints the 5th String but like it was said earlier, there are only 4 strings. 

  • 第8题:

    单选题
    static void test() throws RuntimeException {  try {  System.out.print(”test “);  throw new RuntimeException();  }  catch (Exception ex) { System.out.print(”exception “); }  }  public static void main(String[] args) {  try { test(); }  catch (RuntimeException ex) { System.out.print(”runtime “); }  System.out.print(”end “);  }  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
    解析: 暂无解析

  • 第9题:

    单选题
    Given:   11. String test = "This is a test";   12. String[] tokens = test.split("/s");   13. System.out.println(tokens.length);   What is the result?()
    A

     An exception is thrown at runtime.

    B

     1

    C

     4

    D

     Compilation fails.

    E

     0


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

  • 第10题:

    单选题
    public static void test(String str) { int check = 4;  if (check = str.length()) {  System.out.print(str.charAt(check -= 1) +“, “);  } else {  System.out.print(str.charAt(0) + “, “);  }  }  and the invocation:  test(”four”);  test(”tee”); test(”to”);  What is the result?()
    A

     r, t, t,

    B

     r, e, o,

    C

     Compilation fails.

    D

     An exception is thrown at runtime.


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

  • 第11题:

    单选题
    public class Foo {  public static void main(String[] args) {  try {  return;  } finally {  System.out.println( “Finally” );  }  }  }  What is the result?()
    A

     Finally

    B

     Compilation fails.

    C

     The code runs with no output.

    D

     An exception is thrown at runtime.


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

  • 第12题:

    单选题
    11. String test = “This is a test”;  12. String[] tokens = test.split(”/s”);  13. System.out.println(tokens.length);  What is the result?()
    A

     0

    B

     1

    C

     4

    D

     Compilation fails.

    E

     An exception is thrown at runtime.


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

  • 第13题:

    public class Foo {  public static void main(String[] args) {  try {  return;  } finally {  System.out.println( “Finally” );  }  }  }  What is the result?()

    • A、 Finally
    • B、 Compilation fails.
    • C、 The code runs with no output.
    • D、 An exception is thrown at runtime.

    正确答案:A

  • 第14题:

    public class Test {  public enum Dogs {collie, harrier};  public static void main(String [] args) {  Dogs myDog = Dogs.collie;  switch (myDog) {  case collie:  System.out.print(”collie “); case harrier:  System.out.print(”harrier “);  }  }  }  What is the result?() 

    • A、 collie
    • B、 harrier
    • C、 Compilation fails.
    • D、 collie harrier
    • E、 An exception is thrown at runtime.

    正确答案:D

  • 第15题:

    static void test() throws Error {  if (true) throw new AssertionError();  System.out.print(”test “);  }  public static void main(String[] args) {  try { test(); }  catch (Exception ex) { System.out.print(”exception “); }  System.out.print(”elld “);  }  What is the result?() 

    • A、 end
    • B、 Compilation fails.
    • C、 exception end
    • D、 exception test end
    • E、 A Throwable is thrown by main.
    • F、 An Exception is thrown by main.

    正确答案:E

  • 第16题:

    public class Test {  public static void main(String [] args) {  System.out.println(args.length > 4 &&  args[4].equals(“-d”));  }  }   If the program is invoked using the command line: java Test One Two Three –d   What is the result?()  

    • A、 true
    • B、 false
    • C、 Compilation fails.
    • D、 An exception is thrown at runtime.

    正确答案:D

  • 第17题:

    单选题
    public class Test {  private static float[] f = new float[2];  public static void main(String args[]) {  System.out.println(“f[0] = “ + f[0]);  }  }   What is the result?()
    A

     f[0] = 0

    B

     f[0] = 0.0

    C

     Compilation fails.

    D

     An exception is thrown at runtime.


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

  • 第18题:

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

    r, t, t,

    B

    r, e, o,

    C

    Compilation fails.

    D

    An exception is thrown at runtime.


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

  • 第19题:

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

    TestA

    B

    TestB

    C

    Compilation fails.

    D

    An exception is thrown at runtime.


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

  • 第20题:

    单选题
    public class Test {  public static void main( String[] args) {  String foo = args[1];  String bar = args[2];  String baz = args[3];  System.out.println(“baz = “ + baz); }  }   And the command line invocation: java Test red green blue   What is the result?()
    A

     baz =

    B

     baz = null

    C

     baz = blue

    D

     Compilation fails.

    E

     An exception is thrown at runtime.


    正确答案: C
    解析: A java.lang.ArrayIndexOutOfBoundsException is thrown because of line 3, should be args[0].

  • 第21题:

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

    peep

    B

    bark

    C

    meow

    D

    Compilation fails.

    E

    An exception is thrown at runtime.


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

  • 第22题:

    单选题
    static void test() throws Error {  if (true) throw new AssertionError();  System.out.print(”test “);  }  public static void main(String[] args) {  try { test(); }  catch (Exception ex) { System.out.print(”exception “); }  System.out.print(”elld “);  }  What is the result?()
    A

     end

    B

     Compilation fails.

    C

     exception end

    D

     exception test end

    E

     A Throwable is thrown by main.

    F

     An Exception is thrown by main.


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

  • 第23题:

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

  • 第24题:

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

     NULL

    B

     Compilation fails.

    C

     The code runs with no output.

    D

     An exception is thrown at runtime.


    正确答案: C
    解析: NULL should be "null".