niusouti.com

单选题Given:   11. String test = "This is a test";   12. String[] tokens = test.split("/s");   13. System.out.println(tokens.length);   What is the result?()AAn exception is thrown at runtime.B1C4DCompilation fails.E0

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


相似考题
更多“单选题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  1C  4D  Compilation fails.E  0”相关问题
  • 第1题:

    public static void main(String[] args) {  String str = “null‟;  if (str == null) {  System.out.println(”null”);  } else (str.length() == 0) {  System.out.println(”zero”);  } else {  System.out.println(”some”);  }  }  What is the result?()

    • A、 null
    • B、 zero
    • C、 some
    • D、 Compilation fails.
    • E、 An exception is thrown at runtime.

    正确答案:D

  • 第2题:

    Given: 11.String test = "a1b2c3"; 12.String[] tokens = test.split("//d"); 13.for(String s: tokens) System.out.print(s + " "); What is the result?()

    • A、a b c
    • B、1 2 3
    • C、a1b2c3
    • D、a1 b2 c3

    正确答案:A

  • 第3题:

    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.

    正确答案:B

  • 第4题:

    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

  • 第5题:

    11. public static void test(String str) {  12. if(str == null | str.lellgth() == 0) {  13. System.out.println(”String is empty”);  14. } else {  15. System.out.println(”String is not empty”);  16. }  17. }  And the invocation:  31. test(llull);  What is the result?() 

    • A、 Au exception is thrown at runtime.
    • B、 “String is empty” is printed to output.
    • C、 Compilation fails because of au error in line 12.
    • D、 “String is not empty” is printed to output.

    正确答案:A

  • 第6题:

    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、0
    • B、1
    • C、4
    • D、Compilation fails.

    正确答案:D

  • 第7题:

    单选题
    11. String test = “Test A. Test B. Test C.”;  12. // insert code here  13. String[] result = test.split(regex);  Which regular expression inserted at line 12 will correctly split test into “Test A,” “Test B,” and “Test C”?()
    A

     String regex = “”;

    B

     String regex = “ “;

    C

     String regex = “.*“.

    D

     String regex = “//s”

    E

     String regex = “//.//s*”;

    F

     String regex = “//w[ /.] +“;


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

  • 第8题:

    单选题
    11. public static void test(String str) {  12. if(str == null | str.lellgth() == 0) {  13. System.out.println(”String is empty”);  14. } else {  15. System.out.println(”String is not empty”);  16. }  17. }  And the invocation:  31. test(llull);  What is the result?()
    A

     Au exception is thrown at runtime.

    B

     “String is empty” is printed to output.

    C

     Compilation fails because of au error in line 12.

    D

     “String is not empty” is printed to output.


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

  • 第9题:

    单选题
    public static void main(String[] args) {  String str = “null‟;  if (str == null) {  System.out.println(”null”);  } else (str.length() == 0) {  System.out.println(”zero”);  } else {  System.out.println(”some”);  }  }  What is the result?()
    A

     null

    B

     zero

    C

     some

    D

     Compilation fails.

    E

     An exception is thrown at runtime.


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

  • 第10题:

    单选题
    Given: 11.String test = "Test A. Test B. Test C."; 12.// insert code here 13.String[] result = test.split(regex); Which regular expression, inserted at line 12,correctly splits test into "Test A","Test B",and "Test C"?()
    A

    String regex = ;

    B

    String regex =  ;

    C

    String regex = .*;

    D

    String regex = //s;

    E

    String regex = //.//s*;


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

  • 第11题:

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

  • 第12题:

    单选题
    11. String test= “a1b2c3”;  12. String[] tokens = test.split(”//d”);  13. for(String s: tokens) System.out.print(s +“ “);  What is the result?()
    A

     a b c

    B

     1 2 3

    C

     a1b2c3

    D

     a1 b2 c3

    E

     Compilation fails.

    F

     The code runs with no output.

    G

     An exception is thrown at runtime.


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

  • 第13题:

    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

    正确答案:D

  • 第14题:

    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.

    正确答案:B

  • 第15题:

    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

  • 第16题:

    String a = null;  a.concat(“abc”);  a.concat(“def”);  System.out.println(a);   What is the result?()  

    • A、 abc
    • B、 null
    • C、 abcdef
    • D、 Compilation fails.
    • E、 The code runs with no output.
    • F、 An exception is thrown at runtime.

    正确答案:F

  • 第17题:

    11. String test = “Test A. Test B. Test C.”;  12. // insert code here  13. String[] result = test.split(regex);  Which regular expression inserted at line 12 will correctly split test into “Test A,” “Test B,” and “Test C”?()

    • A、 String regex = “”;
    • B、 String regex = “ “;
    • C、 String regex = “.*“.
    • D、 String regex = “//s”
    • E、 String regex = “//.//s*”;
    • F、 String regex = “//w[ /.] +“;

    正确答案:E

  • 第18题:

    Given: 11.String test = "Test A. Test B. Test C."; 12.// insert code here 13.String[] result = test.split(regex); Which regular expression, inserted at line 12,correctly splits test into "Test A","Test B",and "Test C"?()

    • A、String regex = "";
    • B、String regex = " ";
    • C、String regex = ".*";
    • D、String regex = "//s";
    • E、String regex = "//.//s*";

    正确答案:E

  • 第19题:

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

  • 第20题:

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

    0

    B

    1

    C

    4

    D

    Compilation fails.


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

  • 第21题:

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

  • 第22题:

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

  • 第23题:

    单选题
    Given: 11.String test = "a1b2c3"; 12.String[] tokens = test.split("//d"); 13.for(String s: tokens) System.out.print(s + " "); What is the result?()
    A

    a b c

    B

    1 2 3

    C

    a1b2c3

    D

    a1 b2 c3


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