String[] elements = { “for”, “tea”, “too” };  String first = (elements.length > 0)? elements[0] null;  What is the result?()A、 Compilation fails.B、 An exception is thrown at runtime.C、 The variable first is set to null.D、 The variable first is set to ele

题目

String[] elements = { “for”, “tea”, “too” };  String first = (elements.length > 0)? elements[0] null;  What is the result?()

  • A、 Compilation fails.
  • B、 An exception is thrown at runtime.
  • C、 The variable first is set to null.
  • D、 The variable first is set to elements[0].

相似考题
更多“String[] elements =&e”相关问题
  • 第1题:

    Given:Andthefollowingfivefragments:publicstaticvoidmain(String...a){publicstaticvoidmain(String.*a){publicstaticvoidmain(String...a){publicstaticvoidmain(String[]...a){publicstaticvoidmain(String...[]a){Howmanyofthecodefragments,insertedindependentlyatline2,compile?()

    A.0

    B.1

    C.2

    D.3

    E.4


    参考答案:D

  • 第2题:

    下面的哪些程序片断可能导致错误() 

    • A、String s = "Gone with the wind";  String t = " good ";  String k = s + t;
    • B、String s = "Gone with the wind";  String t;  t = s[3] + "one";
    • C、String s = "Gone with the wind";  String standard = s.toUpperCase();
    • D、String s = "home directory"; String t = s - "directory"

    正确答案:B,D

  • 第3题:

    Which expressions will evaluate to true if preceded by the following code?()   String a = "hello";   String b = new String(a);   String c = a;   char[] d = { ’h’, ’e’, ’l’, ’l’, ’o’ };  

    • A、(a == "Hello")
    • B、(a == b)
    • C、(a == c)
    • D、a.equals(b)
    • E、a.equals(d)

    正确答案:C,D

  • 第4题:

    下面哪些语句能够正确地生成5个空字符串?()

    • A、String a[]=new String[5];for(int i=0;i<5;a[i++]=“”);
    • B、String a[]={“”,“”,“”,“”,“”};
    • C、String a[5];
    • D、String[5]a;
    • E、String[]a=new String[5];for(int i=0;i<5;a[i++]=null);

    正确答案:A,B

  • 第5题:

    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

  • 第6题:

    单选题
    You create a Web Form with several UI elements on it. During a code review, you realize that some of the UI elements can be grouped into user controls. You need to create a Web control to group the UI elements that do not require server-side processing. Doing so will enable you to programmatically add or remove the UI elements from the page. You want to maintain the UI elements' style properties. What should you do? ()
    A

    Use System.Web.UI.TemplateControl to group the UI elements.

    B

    Use System.Web.UI.HtmlControls.HtmlControl to group the UI elements.

    C

    Use System.Web.UI.LiteralControl to group the UI elements.

    D

    Use System.Web.UI.WebControls.Literal to group the UI elements.


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

  • 第7题:

    单选题
    String[] elements={"for","tea","too"}; String first=(elements.length>0)?elements[0]null; What is the result?()
    A

    Compilation fails.

    B

    An exception is thrown at runtime.

    C

    The variable first is set to null.

    D

    The variable first is set to elements[0].


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

  • 第8题:

    单选题
    1. import java.util.*;  2. public class TestSet {  3. enum Example { ONE, TWO, THREE }  4. public static void main(String[] args) {  5. Collection coll = new ArrayList();  6. coll.add(Example.THREE);  7. coll.add(Example.THREE);  8. coll.add(Example.THREE);  9. coll.add(Example.TWO);  10. coll.add(Example.TWO);  11. coll.add(Example.ONE);  12. Set set = new HashSet(coll);  13. }  14. }  Which statement is true about the set variable on line 12?()
    A

     The set variable contains all six elements from the coll collection, and the order is guaranteed to be preserved.

    B

     The set variable contains only three elements from the coll collection, and the order is guaranteed to be preserved.

    C

     The set variable contains all six elements from the coil collection, but the order is NOT guaranteed to be preserved.

    D

     The set variable contains only three elements from the coil collection, but the order is NOT guaranteed to be preserved.


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

  • 第9题:

    单选题
    Which statement is true for the class java.util.ArrayList?()
    A

     The elements in the collection are ordered.

    B

     The collection is guaranteed to be immutable.

    C

     The elements in the collection are guaranteed to be unique.

    D

     The elements in the collection are accessed using a unique key.

    E

     The elements in the collections are guaranteed to be synchronized.


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

  • 第10题:

    单选题
    Which HttpSession method stores an object in a session?()
    A

     put(String name. Object value)

    B

     set(String name. Object value)

    C

     setAttribute(String name. Object value)

    D

     putAttribute(String name. Object value)

    E

     addAttribute(String name. Object value)


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

  • 第11题:

    单选题
    lisa is writing a formula to determine the number of elements in a list. she wants to ensure that a value is returned, even if the value her function is evaluating turns out to be a null string . which one of the following can she so to accomplish this ?()
    A

    use a defaule formula of 1 

    B

    use @elements and add 1 to the total 

    C

    use the @count function instead of @elements 

    D

    use @texttotime to ensure that all strings arte converted to date-time values 


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

  • 第12题:

    单选题
    Given: 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*";

    F

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


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

  • 第13题:

    下面哪个方法设置MIME类型?()

    • A、setHeader(String headerName,String headerValue)
    • B、setContentType(String mimeType)
    • C、setContentLength(int length)
    • D、addCookie(Cookie c)
    • E、addHeader(String name,String value)

    正确答案:B

  • 第14题:

    Which statement is true for the class java.util.HashSet? () 

    • A、 The elements in the collection are ordered.
    • B、 The collection is guaranteed to be immutable.
    • C、 The elements in the collection are guaranteed to be unique.
    • D、 The elements in the collection are accessed using a unique key.
    • E、 The elements in the collections are guaranteed to be synchronized.

    正确答案:C

  • 第15题:

    Which declarations will allow a class to be started as a standalone program?()  

    • A、public void main(String args[])
    • B、public void static main(String args[])
    • C、public static main(String[] argv)
    • D、final public static void main(String [] array)
    • E、public static void main(String args[])

    正确答案:D,E

  • 第16题:

    Which of the following fragments might cause errors?()    

    • A、 String s = "Gone with the wind";String t = " good ";String k = s + t;
    • B、 String s = "Gone with the wind";String t;t = s[3] + "one";
    • C、 String s = "Gone with the wind";String standard = s.toUpperCase();
    • D、 String s = "home directory";String t = s - "directory";

    正确答案:B,D

  • 第17题:

    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

  • 第18题:

    单选题
    BO模板在Design模式下,可以编辑的内容有()
    A

    Only Report Elements and Formatting

    B

    Page Setup、Data Access、Report Elements Analysis and Formatting

    C

    Only Formatting、Data Access and Analysis

    D

    Only Data Access、Report Elements and Formatting


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

  • 第19题:

    单选题
    Why can’t we divide film into various elements for analysis?
    A

    Because these elements are interwoven with each other and cannot be separated without failing to appreciate a film as a whole.

    B

    Because films cannot be written down and it is inconvenient to analyze them

    C

    Because films elements are too complicated.

    D

    Because films need not to be analyzed in detail.


    正确答案: C
    解析:
    由文章第四段第一句:Dividing film into its various elements for analysis is a somewhat artificial process, for the elements of any art form never exist in isolation可知,电影中的各个元素是相互交织、相互影响的,不能分割研究,否则会影响对整体意思的理解。

  • 第20题:

    单选题
    You need to design the storage of the application texts for UI elements to fulfill the requirements. Which table and column design should you use?()
    A

    Languages (LanguageID, Name)Elements (ElementID, Description)ElementLanguages (ElementID, LanguageID, Text) 

    B

    Languages (LanguageID, Name)Elements (ElementID, LanguageID, Description, Text) 

    C

    Languages (LanguageID, Name)ElementTexts (LanguageID, Text)ElementDescriptions (ElementID, Description) 

    D

    Languages (LanguageID, Name)Elements (ElementID, Description, Text)


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

  • 第21题:

    单选题
    Given: String[] elements = { "for", "tea", "too" }; String first = (elements.length > 0) ? elements[0] : null; What is the result?()
    A

    Compilation fails.

    B

    An exception is thrown at runtime.

    C

    The variable first is set to null.

    D

    The variable first is set to elements[0].


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

  • 第22题:

    单选题
    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[ /.] +“;


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

  • 第23题:

    单选题
    The anthropologists would have considered their research a success if they would have found a language that shares lexical elements with the Borneans they were studying.
    A

    if they would have found a language that shares lexical elements with the Borneans they were studying

    B

    had they found a language that shares lexical elements with that of the Borneans they were studying

    C

    if they found a language that shares lexical elements with the Borneans they were studying

    D

    if they had found a language that shares lexical elements with the Borneans they were studying

    E

    if they would have found a language that shares lexical elements with that of the Borneans they were studying


    正确答案: D
    解析:
    划线部分的短语“if they would have”使用的虚拟语气不正确且拿语言和婆罗洲人对比不符合逻辑。