niusouti.com

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、Http

题目

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

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

    Given an HttpServletRequest request and an HttpServletResponse response: 41.HttpSession session = null; 42.// insert code here 43.if(session == null) { 44.// do something if session does not exist 45.} else { 46.// do something if session exists47. } To implement the design intent,which statement must be inserted at line 42?()

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

    正确答案: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题:

    Given a Filter class definition with this method: 21.public void doFilter(ServletRequest request, 22.ServletResponse response, 23.FilterChain chain) 24.throws ServletException, IOException { 25.// insert code here26. } Which should you insert at line 25 to properly invoke the next filter in the chain,or the target servlet if thereare no more filters?()

    • A、chain.forward(request, response);
    • B、chain.doFilter(request, response);
    • C、request.forward(request, response);
    • D、request.doFilter(request, response);

    正确答案:B

  • 第4题:

    Given the following code:     1) class Parent {     2) private String name;     3) public Parent(){}     4) }  5) public class Child extends Parent {     6) private String department;  7) public Child() {}  8) public String getValue(){ return name; }     9) public static void main(String arg[]) {     10) Parent p = new Parent();     11) }  12) }  Which line will cause error?()   

    • A、 line 3
    • B、 line 6
    • C、 line 7
    • D、 line 8
    • E、 line 10

    正确答案:D

  • 第5题:

    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

  • 第6题:

    Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) Which three statements inserts a row into the table? ()

    • A、INSERT INTO employees VALUES (NULL, 'JOHN','Smith');
    • B、INSERT INTO employees( first_name, last_name) VALUES ('JOHN','Smith');
    • C、INSERT INTO employees VALUES ('1000','JOHN','NULL');
    • D、INSERT INTO employees(first_name,last_name, employee_id) VALUES ('1000, 'john','Smith');
    • E、INSERT INTO employees (employee_id) VALUES (1000);
    • F、INSERT INTO employees (employee_id, first_name, last_name) VALUES ( 1000, 'john',");

    正确答案:C,E,F

  • 第7题:

    Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) Which three statements insert a row into the table? ()

    • A、INSERT INTO employees VALUES (NULL, 'John', 'smith');
    • B、INSERT INTO employees (first_name, last_name) VALUES ('John', 'smith');
    • C、INSERT INTO employees VALUES ('1000, 'John', 'smith');
    • D、INSERT INTO employees (first_name, last_name, employee_id) VALUES (1000, 'John', 'smith');
    • E、INSERT INTO employees (employee_id) VALUES (1000);
    • F、INSERT INTO employees ( employee_id, first_name, last_name, ) VALUES (1000, 'John','');

    正确答案:C,E,F

  • 第8题:

    Given:   10. class One {   11. void foo() { }   12. }   13. class Two extends One {   14. //insert method here   15. }   Which three methods, inserted individually at line 14, will correctly complete class Two?()

    • A、 public void foo() { /* more code here */ }
    • B、 private void foo() { /* more code here */ }
    • C、 protected void foo() { /* more code here */ }
    • D、 int foo() { /* more code here */ }  
    • E、 void foo() { /* more code here */ }

    正确答案:A,C,E

  • 第9题:

    单选题
    Given that session is a valid HttpSession object:   Int max = session.getAttribute(“MyReallyLongName”);   Which is true?()
    A

     The value returned needs to be cast to an int.

    B

     The getAttribute methos takes two arguments.

    C

     Primitive CANNOT be stored in the HttpSession.

    D

     The HttpSession attribute name must NOT exceed eight characters.


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

  • 第10题:

    多选题
    Given 11.public interface Status { 12./* insert code here */ int MY_VALUE = 10; 13.} Which three are valid on line 12?()
    A

    final

    B

    static

    C

    native

    D

    public

    E

    private


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

  • 第11题:

    多选题
    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,D
    解析: 暂无解析

  • 第12题:

    单选题
    Given a Filter class definition with this method: 21.public void doFilter(ServletRequest request, 22.ServletResponse response, 23.FilterChain chain) 24.throws ServletException, IOException { 25.// insert code here 26.} Which should you insert at line 25 to properly invoke the next filter in the chain, or the target servlet if thereare no more filters?()
    A

    chain.forward(request, response);

    B

    chain.doFilter(request, response);

    C

    request.forward(request, response);

    D

    request.doFilter(request, response);


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

  • 第13题:

    1. public class Employee {  2. String name;  3. double baseSalary;  4. Employee(String name, double baseSalary) {  5. this.name = name;  6. this.baseSalary = baseSalary;  7. }  8. }  And:  1. public class Salesperson extends Employee { 2. double commission;  3. public Salesperson(String name, double baseSalary,  4. double commission) {  5. // insert code here  6. } 7. }  Which code, inserted at line 7, completes the Salesperson constructor?() 

    • A、 this.commission = commission;
    • B、 superb(); commission = commission;
    • C、 this.commission = commission; superb();
    • D、 super(name, baseSalary); this.commission = commission;
    • E、 super(); this.commission = commission;
    • F、 this.commission = commission; super(name, baseSalary);

    正确答案:D

  • 第14题:

    Given the uncompleted code of a class:     class Person {  String name, department;     int age;  public Person(String n){  name = n; }  public Person(String n, int a){  name = n;  age = a;  }  public Person(String n, String d, int a) {  // doing the same as two arguments version of constructor     // including assignment name=n,age=a    department = d;     }     }  Which expression can be added at the "doing the same as..." part of the constructor?() 

    • A、 Person(n,a);
    • B、 this(Person(n,a));
    • C、 this(n,a);
    • D、 this(name,age);

    正确答案:C

  • 第15题:

    Given: 10.public void service(ServletRequest request, 11.ServletResponse response) { 12.ServletInputStream sis = 13.// insert code here 14.} Which retrieves the binary input stream on line 13?()

    • A、request.getWriter();
    • B、request.getReader();
    • C、request.getInputStream();
    • D、request.getResourceAsStream();

    正确答案:C

  • 第16题:

    Given the JSP code: <% request.setAttribute("foo", "bar"); %>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)

    正确答案:D

  • 第17题:

    Given that session is a valid HttpSession object:   Int max = session.getAttribute(“MyReallyLongName”);   Which is true?()  

    • A、 The value returned needs to be cast to an int.
    • B、 The getAttribute methos takes two arguments.
    • C、 Primitive CANNOT be stored in the HttpSession.
    • D、 The HttpSession attribute name must NOT exceed eight characters.

    正确答案:C

  • 第18题:

    Which three statements inserts a row into the table?()

    • A、INSERT INTO employees   VALUES ( NULL, ‘John’,‘Smith’);
    • B、INSERT INTO employees( first_name, last_name)   VALUES(‘John’,‘Smith’);
    • C、INSERT INTO employees   VALUES (‘1000’,‘John’,NULL);
    • D、INSERT INTO employees(first_name,last_name, employee_id)   VALUES ( 1000, ‘John’,‘Smith’);
    • E、INSERT INTO employees (employee_id)   VALUES (1000);
    • F、INSERT INTO employees (employee_id, first_name, last_name)   VALUES ( 1000, ‘John’,‘’);

    正确答案:C,E,F

  • 第19题:

    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

  • 第20题:

    Given 11.public interface Status { 12./* insert code here */ int MY_VALUE = 10; 13.} Which three are valid on line 12?()

    • A、final
    • B、static
    • C、native
    • D、public
    • E、private

    正确答案:A,B,D

  • 第21题:

    单选题
    Given the following code:     1) class Parent {     2) private String name;     3) public Parent(){}     4) }  5) public class Child extends Parent {     6) private String department;  7) public Child() {}  8) public String getValue(){ return name; }     9) public static void main(String arg[]) {     10) Parent p = new Parent();     11) }  12) }  Which line will cause error?()
    A

     line 3

    B

     line 6

    C

     line 7

    D

     line 8

    E

     line 10


    正确答案: D
    解析: 第8行的getValue()试图访问父类的私有变量,错误。

  • 第22题:

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

  • 第23题:

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