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

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

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

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");

正确答案:B,C,D

第2题:

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

第3题:

Giventhatcisareferencetoavalidjava.io.Consoleobject,whichtwocodefragmentsreadalineoftextfromtheconsole?()

A.Strings=c.readLine();

B.char[]c=c.readLine();

C.Strings=c.readConsole();

D.char[]c=c.readConsole();

E.Strings=c.readLine("%s","name");

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


参考答案:A, E

第4题:

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

第5题:

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

第6题:

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”);

正确答案:B,E

第7题:

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

第8题:

Given:Which method will complete this class?()

A.public int compareTo(Object o){/*more code here*/}

B.public int compareTo(Score other){/*more code here*/}

C.public int compare(Score s1,Score s2){/*more code here*/}

D.public int compare(Object o1,Object o2){/*more code here*/}


参考答案:B

第9题:

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

第10题:

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

更多相关问题