单选题Which HttpSession method stores an object in a session?()Aput(String name. Object value)Bset(String name. Object value)CsetAttribute(String name. Object value)DputAttribute(String name. Object value)EaddAttribute(String name. Object value)

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


相似考题
更多“单选题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)”相关问题
  • 第1题:

    Which statements concerning the value of a member variable are true, when no explicit assignments have been made?()  

    • A、The value of an int is undetermined.
    • B、The value of all numeric types is zero.
    • C、The compiler may issue an error if the variable is used before it is initialized.
    • D、The value of a String variable is "" (empty string).
    • E、The value of all object variables is null.

    正确答案:B,E

  • 第2题:

    Given an HttpServletRequest request: 22.String id = request.getParameter("jsessionid"); 23.// insert code here 24.String name = (String) session.getAttribute("name"); Which three can be placed at line 23 to retrieve anexisting HttpSession object?()

    • A、HttpSession session = request.getSession();
    • B、HttpSession session = request.getSession(id);
    • C、HttpSession session = request.getSession(true);
    • D、HttpSession session = request.getSession(false);
    • E、HttpSession session = request.getSession("jsessionid");

    正确答案:A,C,D

  • 第3题:

    String s=new String("xyz");创建了几个String Object?


    正确答案: 两个或一个,”xyz”对应一个对象,这个对象放在字符串常量缓冲区,常量”xyz”不管出现多少遍,都是缓冲区中的那一个。New String每写一遍,就创建一个新的对象,它一句那个常量”xyz”对象的内容来创建出一个新String对象。如果以前就用过’xyz’,这句代表就不会创建”xyz”自己了,直接从缓冲区拿。

  • 第4题:

    Which methods from the String and StringBuffer classes modify the object on which they are called?()  

    • A、The charAt() method of the String class.
    • B、The toUpperCase() method of the String class.
    • C、The replace() method of the String class.
    • D、The reverse() method of the StringBuffer class.
    • E、The length() method of the StringBuffer class.

    正确答案:D

  • 第5题:

    You want to use te Coherence Java APIs to directly cached POJOs. Consider this snippet of code: NamedCache cache - CacheFactory.getCache("mycache");  cache.put(new Integer(I)f "hello"); cache.put(T,"hi");  cache.put(new Long(II),"hey");  This code inserts three objects into the cache.  Why ?()

    • A、 hashCode() and equals() method for each object type is different so a different key is used
    • B、 each object value string is different so a different value is inserted on each put
    • C、 equals() and compare() method is different for each put
    • D、 POF need to be implemented for this to work properly

    正确答案:A

  • 第6题:

    You work as an application developer at Certkiller .com. You are currently in the process of creating a class that stores data about Certkiller .com’s customers. Certkiller .com customers are assigned unique identifiers and various characteristics that may include aliases, shipping instructions, and sales comments. These characteristics can change in both size and data type. You start by defining the Customer class as shown below: public class Customer { private int custID; private ArrayList attributes; public int CustomerID { get {return custID;} } public Customer (int CustomerID) { this.custID = CustomerID; this.attributes = new ArrayList (); } public void AddAttribute (object att) {  attributes.Add (att); } } You have to create the FindAttribute method for locating attributes in Customer objects no matter what the data type is.You need to ensure that the FindAttributemethod returns the attribute if found,and you also need to ensure type-safety when returning the attribute.What should you do?()

    • A、 Use the following code to declare the FindAttribute method: public T FindAttribute (T att) {//Find attribute and return the value }
    • B、 Use the following code to declare the FindAttribute method: public object FindAttribute (object att) {//Find attribute and return the value }
    • C、 Use the following code to declare the FindAttribute method: public T FindAttribute  (T att) {//Find attribute and return the value }
    • D、 Use the following code to declare the FindAttribute method: public string FindAttribute (string att) {//Find attribute and return the value }

    正确答案:C

  • 第7题:

    单选题
    public class Person {  private name;  public Person(String name) {  this.name = name;  }  public int hashCode() {  return 420;  }  }  Which is true?()
    A

     The time to find the value from HashMap with a Person key depends on the size of the map.

    B

     Deleting a Person key from a HashMap will delete all map entries for all keys of typePerson.

    C

     Inserting a second Person object into a HashSet will cause the first Person object to beremoved as a duplicate.

    D

     The time to determine whether a Person object is contained in a HashSet is constant and does NOT depend on the size of the map.


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

  • 第8题:

    单选题
    public class ItemTest {  private final mt id;  public ItemTest(int id) { this.id = id; }  public void updateId(int newId) { id = newId; }  public static void main(String[] args) {  ItemTest fa = new ItemTest(42);  fa.updateId(69);  System.out.println(fa.id);  }  }  What is the result?()
    A

     Compilation fails.

    B

     An exception is thrown at runtime.

    C

     The attribute id in the Item object remains unchanged.

    D

     The attribute id in the Item object is modified to the new value.

    E

     A new Item object is created with the preferred value in the id attribute.


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

  • 第9题:

    多选题
    You are developing an application that connects to a Microsoft SQL Server database using the SqlConnection object. Your connection objects are being pooled. As the pool fills up, connection requests are queued. Some connection requests are rejected. You need to ensure that the application releases connections back to the pool as soon as possible. Also, you need to decrease the likelihood that connection requests will be rejected. Which three actions should you perform?()
    A

    Ensure that the Close method is called on each connection object after it has finished executing.

    B

    Ensure that each connection object is left open after it has finished executing.

    C

    Increase the Max Pool Size value inside the connection string.

    D

    Increase the Min Pool Size value inside the connection string.

    E

    Increase the Connection Lifetime value inside the connection string.

    F

    Increase the value of the ConnectionTimeout property of the SqlConnection object.


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

  • 第10题:

    单选题
    在J2EE中,以下是firePropertyChange的原型,正确的是()。
    A

    public void firePropertyChange(PropertyChangeListener l,String oldValue, String newValue)

    B

    public void firePropertyChange(String propertyName, Object oldValue, Object newValue)

    C

    public void firePropertyChange(PropertyChangeSupport changes)

    D

    public void firePropertyChange(Object oldValue, Object newValue)


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

  • 第11题:

    单选题
    Which methods from the String and StringBuffer classes modify the object on which they are called?()
    A

    The charAt() method of the String class.

    B

    The toUpperCase() method of the String class.

    C

    The replace() method of the String class.

    D

    The reverse() method of the StringBuffer class.

    E

    The length() method of the StringBuffer class.


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

  • 第12题:

    单选题
    Which retrieves the value associated with “foo” from within an HttpServlet?()
    A

     String value = getServletConfig( ).getParameter(“foo”);

    B

     String value = getServletContext( ).getAttribute(“foo”);

    C

     Object value = getServletContext( ).getInitParameter(“foo”);

    D

     String value = getServletContext( ).getInitParameter(“foo”)


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

  • 第13题:

    public class Person {  private name;  public Person(String name) {  this.name = name;  }  public int hashCode() {  return 420;  }  }  Which is true?() 

    • A、 The time to find the value from HashMap with a Person key depends on the size of the map.
    • B、 Deleting a Person key from a HashMap will delete all map entries for all keys of typePerson.
    • C、 Inserting a second Person object into a HashSet will cause the first Person object to beremoved as a duplicate.
    • D、 The time to determine whether a Person object is contained in a HashSet is constant and does NOT depend on the size of the map.

    正确答案:A

  • 第14题:

    在j2ee中,以下是firevetoablechange方法的正确的原型的是() 

    • A、public void fireVetoableChange(Object  oldValue,Object newValue)
    • B、 public void fireVetoableChange(String  propertyName,Object newValue)
    • C、 public void fireVetoableChange(String  propertyName, Object  oldValue ,Object newValue)throws PropertyVetoException
    • D、 public void fireVetoableChange(String  propertyName, Object  oldValue ,Object newValue)

    正确答案:C

  • 第15题:

    在J2EE中,以下是firePropertyChange的原型,正确的是()。 

    • A、public void firePropertyChange(PropertyChangeListener l,String oldValue, String newValue)
    • B、public void firePropertyChange(String propertyName, Object oldValue, Object newValue)
    • C、public void firePropertyChange(PropertyChangeSupport changes)
    • D、public void firePropertyChange(Object oldValue, Object newValue)

    正确答案:B

  • 第16题:

    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)

    正确答案:C

  • 第17题:

    You are developing an application that connects to a Microsoft SQL Server database using the SqlConnection object. Your connection objects are being pooled. As the pool fills up, connection requests are queued. Some connection requests are rejected. You need to ensure that the application releases connections back to the pool as soon as possible. Also, you need to decrease the likelihood that connection requests will be rejected. Which three actions should you perform?()

    • A、Ensure that the Close method is called on each connection object after it has finished executing.
    • B、Ensure that each connection object is left open after it has finished executing.
    • C、Increase the Max Pool Size value inside the connection string.
    • D、Increase the Min Pool Size value inside the connection string.
    • E、Increase the Connection Lifetime value inside the connection string.
    • F、Increase the value of the ConnectionTimeout property of the SqlConnection object.

    正确答案:A,C,F

  • 第18题:

    多选题
    Which statements concerning the value of a member variable are true, when no explicit assignments have been made?()
    A

    The value of an int is undetermined.

    B

    The value of all numeric types is zero.

    C

    The compiler may issue an error if the variable is used before it is initialized.

    D

    The value of a String variable is  (empty string).

    E

    The value of all object variables is null.


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

  • 第19题:

    问答题
    String s = new String("xyz");创建了几个String Object?

    正确答案: 两个对象,一个是“xyx”,一个是指向“xyx”的引用对象s。
    解析: 暂无解析

  • 第20题:

    单选题
    You want to use te Coherence Java APIs to directly cached POJOs. Consider this snippet of code: NamedCache cache - CacheFactory.getCache("mycache");  cache.put(new Integer(I)f "hello"); cache.put(T,"hi");  cache.put(new Long(II),"hey");  This code inserts three objects into the cache.  Why ?()
    A

     hashCode() and equals() method for each object type is different so a different key is used

    B

     each object value string is different so a different value is inserted on each put

    C

     equals() and compare() method is different for each put

    D

     POF need to be implemented for this to work properly


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

  • 第21题:

    单选题
    Given: What is the result?()
    A

    Compilation fails.

    B

    exception is thrown at runtime.

    C

    The attribute id in the ItemTest object remains unchanged.

    D

    The attribute id in the ItemTest object is modified to the new value.

    E

    A new ItemTest object is created with the preferred value in the id attribute.


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

  • 第22题:

    单选题
    You work as an application developer at Certkiller .com. You are currently in the process of creating a class that stores data about Certkiller .com’s customers. Certkiller .com customers are assigned unique identifiers and various characteristics that may include aliases, shipping instructions, and sales comments. These characteristics can change in both size and data type. You start by defining the Customer class as shown below: public class Customer { private int custID; private ArrayList attributes; public int CustomerID { get {return custID;} } public Customer (int CustomerID) { this.custID = CustomerID; this.attributes = new ArrayList (); } public void AddAttribute (object att) {  attributes.Add (att); } } You have to create the FindAttribute method for locating attributes in Customer objects no matter what the data type is.You need to ensure that the FindAttributemethod returns the attribute if found,and you also need to ensure type-safety when returning the attribute.What should you do?()
    A

     Use the following code to declare the FindAttribute method: public T FindAttribute (T att) {//Find attribute and return the value }

    B

     Use the following code to declare the FindAttribute method: public object FindAttribute (object att) {//Find attribute and return the value }

    C

     Use the following code to declare the FindAttribute method: public T FindAttribute  (T att) {//Find attribute and return the value }

    D

     Use the following code to declare the FindAttribute method: public string FindAttribute (string att) {//Find attribute and return the value }


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

  • 第23题:

    单选题
    在j2ee中,以下是firevetoablechange方法的正确的原型的是()
    A

    public void fireVetoableChange(Object  oldValue,Object newValue)

    B

     public void fireVetoableChange(String  propertyName,Object newValue)

    C

     public void fireVetoableChange(String  propertyName, Object  oldValue ,Object newValue)throws PropertyVetoException

    D

     public void fireVetoableChange(String  propertyName, Object  oldValue ,Object newValue)


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