When using versions of Java technology earlier than 5.0.
When sharing a StringBuffer among multiple threads.
When using the java.io class StringBufferInputStream.
When you plan to reuse the StringBuffer to build more than one string.
第1题:
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?()
第2题:
Given this method in a class: public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(‟<‟); buffer.append(this.name); buffer.append(‟>‟); return buffer.toString(); } Which is true?()
第3题:
Which methods from the String and StringBuffer classes modify the object on which they are called?()
第4题:
A developer chooses to avoid using SingleThreadModel but wants to ensure that data is updated in athread-safe manner. Which two can support this design goal?()
第5题:
A Company.com developer chooses to avoid using SingleThreadModel but wants to ensure that data is updated in a thread-safe manner. Which two can support this design goal?()
第6题:
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft ADO.NET to develop an application. The database on the Microsoft SQL Server 2005 database has two tables that are displayed by using two SqlConnection objects in two different GridView controls. You want the tables to be displayed at the same time with the use a single SqlConnection object. What should you do?()
第7题:
第8题:
Store the data in a local variable.
Store the data in an instance variable.
Store the data in the HttpSession object.
Store the data in the ServletContext object.
Store the data in the ServletRequest object.
第9题:
synchronize the log method
replace StringBuilder with StringBuffer
No change is necessary, the current MyLogger code is already thread-safe.
replace StringBuilder with just a String object and use the string concatenation (+=) within the log method
第10题:
a WDM system that is compatible with EDFA technology
an optical technology for transmitting up to 16 channels over multiple fiber strands
an optical technology for transmitting up to 32 channels over multiple fiber strands
a technology for transmitting multiple optical signals using less sophisticated transceiver designthen CWDM
a technology for transmitting more closely packed optical signals using more sophisticatedtransceiver designs than CWDM
第11题:
When using versions of Java technology earlier than 5.0.
When sharing a StringBuffer among multiple threads.
When using the java.io class StringBufferInputStream.
When you plan to reuse the StringBuffer to build more than one string.
Enitiation of separate design processes to the separation of users
第12题:
optical technology for transmitting up to 32 channels over multiple fiber strands
optical technology for transmitting up to 16 channels over multiple fiber strands
a WDM system that is compatible with EDFA technology
a technology for transmitting more closely packed optical signals using more sophisticated transceiver designs than CWDM .
第13题:
What two descriptions best define DWDM? ()
第14题:
public class Team extends java.util.LinkedList { public void addPlayer(Player p) { add(p); } public void compete(Team opponent) { /* more code here */ } } class Player { /* more code here */ } Which two are true?()
第15题:
Public class test ( Public static void stringReplace (String text) ( Text = text.replace (‘j’ , ‘i’); ) public static void bufferReplace (StringBuffer text) ( text = text.append (“C”) ) public static void main (String args[]} ( String textString = new String (“java”); StringBuffer text BufferString = new StringBuffer (“java”); stringReplace (textString); bufferReplace (textBuffer); System.out.printLn (textString + textBuffer); ) ) What is the output?()
第16题:
public class MyLogger { private StringBuilder logger = new StringBuuilder(); public void log(String message, String user) { logger.append(message); logger.append(user); } } The programmer must guarantee that a single MyLogger object works properly for a multi-threaded system. How must this code be changed to be thread-safe?()
第17题:
Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object?()
第18题:
This code is NOT thread-safe.
The programmer can replace StringBuffer with StringBuilder with no other changes.
This code will perform well and converting the code to use StringBuilder will not enhance the performance.
This code will perform poorly. For better performance, the code should be rewritten: return “<“+ this.name + “>”;
第19题:
This code will compile.
This code demonstrates proper design of an is-a relationship.
This code demonstrates proper design of a has-a relationship.
A Java programmer using the Team class could remove Player objects from a Team object.
第20题:
The hashCode method for a given class can be used to test for object equality and object inequality for that class.
The hashCode method is used by the java.util.SortedSet collection class to order theelements within that set.
The hashCode method for a given class can be used to test for object inequality, but NOT object equality, for that class.
The only important characteristic of the values returned by a hashCode method is that the distribution of values must follow a Gaussian distribution.
The hashCode method is used by the java.util.HashSet collection class to group the elements within that set into hash buckets for swift retrieval.
第21题:
When using versions of Java technology earlier than 5.0.
When sharing a StringBuffer among multiple threads.
When using the java.io class StringBufferInputStream.
When you plan to reuse the StringBuffer to build more than one string.
第22题:
Store the data in a local variable.
Store the data in an instance variable.
Store the data in the HttpSession object.
Store the data in the ServletContext object.
Store the data in the ServletRequest object.
第23题:
The charAt() method of the String class.
The toUpperCase() method of the String class.
The replace() method of the String class.
The reverse() method of the StringBuffer class.
The length() method of the StringBuffer class.
第24题:
String s = “123456789”; s = (s-”123”).replace(1,3,”24”) - “89”;
StringBuffer s = new StringBuffer(”123456789”); s.delete(0,3).replace( 1,3, “24”).delete(4,6);
StringBuffer s = new StringBuffer(”123456789”); s.substring(3,6).delete( 1 ,3).insert(1, “24”);
StringBuilder s = new StringBuilder(”123456789”); s.substring(3,6).delete( 1 ,2).insert( 1, “24”);
StringBuilder s = new StringBuilder(”123456789”); s.delete(0,3).delete( 1 ,3).delete(2,5).insert( 1, “24”);