niusouti.com

多选题Given that c is a reference to a valid java.io.Console object, which two code fragments read a line of text from the console?()AString s = c.readLine();Bchar[ ] c = c.readLine();CString s = c.readConsole();Dchar[ ] c = c.readConsole();EString s = c.rea

题目
多选题
Given that c is a reference to a valid java.io.Console object, which two code fragments read a line of text from the console?()
A

String s = c.readLine();

B

char[ ] c = c.readLine();

C

String s = c.readConsole();

D

char[ ] c = c.readConsole();

E

String s = c.readLine(%s, name );

F

char[ ] c = c.readLine(%s, name );


相似考题
更多“多选题Given that c is a reference to a valid java.io.Console object, which two code fragments read a line of text from the console?()AString s = c.readLine();Bchar[ ] c = c.readLine();CString s = c.readConsole();Dchar[ ] c = c.readConsole();EString s = c.rea”相关问题
  • 第1题:

    Given that c is a reference to a valid java.io.Console object, which two code fragments read a line of text from the console?()

    • A、String s = c.readLine();
    • B、char[ ] c = c.readLine();
    • C、String s = c.readConsole();
    • D、char[ ] c = c.readConsole();
    • E、String s = c.readLine("%s", "name ");
    • F、char[ ] c = c.readLine("%s", "name ");

    正确答案:A,E

  • 第2题:

    Given that file is a reference to a File object that represents a directory, which code fragments will succeed in obtaining a list of the entries in the directory?()  

    • A、Vector filelist = ((Directory) file).getList();
    • B、String[] filelist = file.directory();
    • C、Enumeration filelist = file.contents();
    • D、String[] filelist = file.list();
    • E、Vector filelist = (new Directory(file)).files();

    正确答案:D

  • 第3题:

    Given that c is a reference to a valid java.io.Console object,which two code fragments read a line of textfrom the console?()

    • A、String s = c.readLine();
    • B、char[] c = c.readLine();
    • C、String s = c.readConsole();
    • D、char[] c = c.readConsole();
    • E、String s = c.readLine("%s", "name ");

    正确答案:A,E

  • 第4题:

    单选题
    下列选项中,正确的语句组是()。
    A

    char s[8]; s={“Beijing”};

    B

    char *s; s={“Beijing”};

    C

    char s[8]; s=“Beijing”;

    D

    char *s; s=“Beijing”;


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

  • 第5题:

    单选题
    Which signal is detected as originating from a SART?()
    A

    The Morse code distress series S-O-S repeated 3 times followed by DE and the vessel's call sign

    B

    A line of blip code on a radar screen outward from the SART's position along its line of bearing

    C

    A line of blip code on a radar screen inward from the SART's position to its own ship along its line of bearing

    D

    None of these


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

  • 第6题:

    多选题
    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;


    正确答案: A,B
    解析: A:String类型可以直接使用+进行连接运算。 
    B:String是一种Object,而不是简单的字符数组,不能使用下标运算符取其值的某个元素,错误。 
    C://toUpperCase()方法是String对象的一个方法,作用是将字符串的内容全部转换为大写并返回转换后的结果(String类型)。    
    D://String类型不能进行减(-)运算,错误。

  • 第7题:

    多选题
    You create a Web page named TestPage.aspx and a user control named TestUserControl.ascx. TestPage.aspx uses TestUserControl.ascx as shown in the following line of code. On TestUserControl.ascx, you need to add a read-only member named CityName to return the value "New York". You also must add code to TestPage.aspx to read this value. Which two actions should you perform?()
    A

    Add the following line of code to the TestUserControl.ascx.cs code-behind file. public string CityName { get { return New York; } }

    B

    Add the following line of code to the TestUserControl.ascx.cs code-behind file. protected readonly string CityName = New York;

    C

    Add the following code segment to the TestPage.aspx.cs code-behind file. protected void Page_Load(object sender, EventArgs e) { string s = testControl.CityName; }

    D

    Add the following code segment to the TestPage.aspx.cs code-behind file. protected void Page_Load(object sender, EventArgs e) { string s = testControl.Attributes[CityName]; }


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

  • 第8题:

    多选题
    The 8859-1 character code for the uppercase letter A is 65. Which of these code fragments declare and initialize a variable of type char with this value?()
    A

    char ch = 65;

    B

    char ch = ’¥65’;

    C

    char ch = ’¥0041’;

    D

    char ch = ’A’;

    E

    char ch = A;


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

  • 第9题:

    多选题
    Which two valid declarations of a char?()
    A

    Char ch = “a”;

    B

    Char ch = ‘/’ ‘;

    C

    Char ch = ‘cafe’;

    D

    Char ch = “cafe”;

    E

    Char ch = ‘/ucafe’;

    F

    Char ch = ‘/u10100’;

    G

    Char ch = (char) true;


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

  • 第10题:

    单选题
    以下选项中正确的语句组是(  )。
    A

    char s[]; s=BOOK!;

    B

    char*s; s={BOOK!};

    C

    char s[10]; s=BOOK!;

    D

    char*s; s=BOOK!;


    正确答案: D
    解析:
    AC两项错误,因为字符串常量在赋值过程中给出的是这个字符串在内存中所在的一串连续存储单元的首地址,即s是数组首地址,并非字符串变量,故错误;B项,字符串变量的赋值方式有char*s;s="BOOK!";。数组赋值的方式有:char*s;s={"BOOK!"};或是“char s[];s="BOOK!";。s为字符串变量,赋值方式应该是前者,故错误。D中先定义一个字符串变量,然后将变量指向一个字符串常量,语句正确。答案选择D选项。

  • 第11题:

    多选题
    public class TestString3 {  public static void main(String[] args) {  // insert code here  System.out.println(s);  }  }  Which two code fragments, inserted independently at line 3, generate the output 4247?()
    A

    String s = “123456789”; s = (s-”123”).replace(1,3,”24”) - “89”;

    B

    StringBuffer s = new StringBuffer(”123456789”); s.delete(0,3).replace( 1,3, “24”).delete(4,6);

    C

    StringBuffer s = new StringBuffer(”123456789”); s.substring(3,6).delete( 1 ,3).insert(1, “24”);

    D

    StringBuilder s = new StringBuilder(”123456789”); s.substring(3,6).delete( 1 ,2).insert( 1, “24”);

    E

    StringBuilder s = new StringBuilder(”123456789”); s.delete(0,3).delete( 1 ,3).delete(2,5).insert( 1, “24”);


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

  • 第12题:

    多选题
    Given: 3.public class MyTagHandler extends TagSupport { 4.public int doStartTag() { 5.// insert code here 6.// return an int 7.} 8.// more code here ... 18.} There is a single attribute foo in the session scope. Which three code fragments,inserted independently atline 5,return the value of the attribute?()
    A

    Object o = pageContext.getAttribute(foo);

    B

    Object o = pageContext.findAttribute(foo);

    C

    Object o = pageContext.getAttribute(foo,PageContext.SESSION_SCOPE);

    D

    HttpSession s = pageContext.getSession();Object o = s.getAttribute(foo);


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

  • 第13题:

    Given the following code fragment:     public void create() {     Vector myVect;     myVect = new Vector();      }  Which of the following statements are true?() 

    • A、 The declaration on line 2 does not allocate memory space for the variable myVect.
    • B、 The declaration on line 2 allocates memory space for a reference to a Vector object.
    • C、 The statement on line 2 creates an object of class Vector.
    • D、 The statement on line 3 creates an object of class Vector.
    • E、 The statement on line 3 allocates memory space for an object of class Vector.

    正确答案:A,D,E

  • 第14题:

    Given that c is a reference to a valid java.io.Console object, and: 11.String pw = c.readPassword("%s", "pw: "); 12.System.out.println("got " + pw); 13.String name = c.readLine("%s", "name: "); 14.System.out.println(" got ", name); If the user types fido when prompted for a password, and then responds bob when prompted for a name,what is the result?()

    • A、An exception is thrown at runtime
    • B、pw: fido got fido name: bob got bob
    • C、pw: got fido name: bob got bob
    • D、Compilation fails.

    正确答案:D

  • 第15题:

    You create a Web page named TestPage.aspx and a user control named TestUserControl.ascx. TestPage.aspx uses TestUserControl.ascx as shown in the following line of code. On TestUserControl.ascx, you need to add a read-only member named CityName to return the value "New York". You also must add code to TestPage.aspx to read this value. Which two actions should you perform?()

    • A、Add the following line of code to the TestUserControl.ascx.cs code-behind file. public string CityName { get { return "New York"; } } 
    • B、Add the following line of code to the TestUserControl.ascx.cs code-behind file. protected readonly string CityName = "New York"; 
    • C、Add the following code segment to the TestPage.aspx.cs code-behind file. protected void Page_Load(object sender, EventArgs e) { string s = testControl.CityName; } 
    • D、Add the following code segment to the TestPage.aspx.cs code-behind file. protected void Page_Load(object sender, EventArgs e) { string s = testControl.Attributes["CityName"]; } 

    正确答案:A,C

  • 第16题:

    多选题
    1. import java.util.*;  2. public class Test {  3. public static void main(String[] args) {  4. List strings = new ArrayList();  5. // insert code here  6. }  7. }  Which four, inserted at line 5, will allow compilation to succeed?()
    A

    String s = strings.get(0);

    B

    Iterator i1 = strings.iterator();

    C

    String[] array1 = strings.toArray();

    D

    Iterator i2 = strings.iterator();

    E

    String[] array2 = strings.toArray(new String[1]);

    F

    Iterator i3 = strings.iterator();


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

  • 第17题:

    单选题
    下列能够正确进行字符串赋值操作的是()。
    A

    char s[5]={“ABCDE”};

    B

    char *s; s=“ABCDE”;

    C

    char s[5]={‘A’,‘B’,‘C’,‘D’,‘E’};

    D

    char *s; scanf(“%s”,s);


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

  • 第18题:

    多选题
    Given the following code fragment:     public void create() {     Vector myVect;     myVect = new Vector();      }  Which of the following statements are true?()
    A

    The declaration on line 2 does not allocate memory space for the variable myVect.

    B

    The declaration on line 2 allocates memory space for a reference to a Vector object.

    C

    The statement on line 2 creates an object of class Vector.

    D

    The statement on line 3 creates an object of class Vector.

    E

    The statement on line 3 allocates memory space for an object of class Vector.


    正确答案: C,D
    解析: SL-275中指出:要为一个新对象分配空间必须执行new Xxx()调用,new调用执行以下的操作: 
    1.为新对象分配空间并将其成员初始化为0或者null。 
    2.执行类体中的初始化。(例如在类中有一个成员声明int a=10;在第一步后a=0 ,执行到第二步后a=10)    
    3.执行构造函数。 
    4.变量被分配为一个到内存堆中的新对象的引用。

  • 第19题:

    多选题
    下面哪段语法执行正确()
    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;


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

  • 第20题:

    单选题
    Given that c is a reference to a valid java.io.Console object, and: 11.String pw = c.readPassword("%s", "pw: "); 12.System.out.println("got " + pw); 13.String name = c.readLine("%s", "name: "); 14.System.out.println(" got ", name); If the user types fido when prompted for a password, and then responds bob when prompted for a name,what is the result?()
    A

    An exception is thrown at runtime

    B

    pw: fido got fido name: bob got bob

    C

    pw: got fido name: bob got bob

    D

    Compilation fails.


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

  • 第21题:

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

  • 第22题:

    多选题
    Given that c is a reference to a valid java.io.Console object,which two code fragments read a line of textfrom the console?()
    A

    String s = c.readLine();

    B

    char[] c = c.readLine();

    C

    String s = c.readConsole();

    D

    char[] c = c.readConsole();

    E

    String s = c.readLine(%s, name );


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

  • 第23题:

    单选题
    Given the JSP code: and the Classic tag handler code: 5. public int doStartTag() throws JspException { 6. // insert code here 7. // return int 8. } Assume there are no other "foo" attributes in the web application. Which invocation on the pageContextobject,inserted at line 6,assigns "bar" to the variable x?()
    A

    String x = (String) pageContext.getAttribute(foo)

    B

    String x = (String) pageContext.getRequestScope(foo)

    C

    It is NOT possible to access the pageContext object from within doStartTag

    D

    String x = (String) pageContext.getRequest().getAttribute(foo)

    E

    String x = (String) pageContext.getAttribute(foo, PageContext.ANY_SCOPE)


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