单选题Given the HttpServlet code:   getServletContext().setAttribute(“foo”, “value”); What is the result?()AThe attribute foo is placed in the applicationBA ServletContextListener registered for that servlet is notifiedCA ServletAttributeListener registered 

题目
单选题
Given the HttpServlet code:   getServletContext().setAttribute(“foo”, “value”); What is the result?()
A

 The attribute foo is placed in the application

B

 A ServletContextListener registered for that servlet is notified

C

 A ServletAttributeListener registered for that servlet is notified

D

 An HttpSessionAttributeListener registered for that servlet is notified


相似考题
参考答案和解析
正确答案: B
解析: 暂无解析
更多“单选题Given the HttpServlet code:   getServletContext().setAttribute(“foo”, “value”); What is the result?()A  The attribute foo is placed in the applicationB  A ServletContextListener registered for that servlet is notifiedC  A ServletAttributeListener regis”相关问题
  • 第1题:

    Given: String value = getServletContext().getInitParameter("foo"); in an HttpServlet and a web applicationdeployment descriptor that contains: foo frodo Which two are true?()

    • A、The foo initialization parameter CANNOT be set programmatically.
    • B、Compilation fails because getInitParameter returns type Object.
    • C、The foo initialization parameter is NOT a servlet initialization parameter.
    • D、Compilation fails because ServletContext does NOT have a getInitParameter method.
    • E、The foo parameter must be defined within the  element of the deployment descriptor.

    正确答案:A,C

  • 第2题:

    Given:  8.int index = 1:  9.Boolean [] test = new boolcan [3];  10.boolcan foo = test [index];   What is the result()?  

    • A、 foo has the value of 0.
    • B、 foo has the value of null.
    • C、 foo has the value of true.
    • D、 foo has the value of false.
    • E、 An-exception is thrown.
    • F、 The code will not compile.

    正确答案:D

  • 第3题:

    int index = 1;   int foo = new int ;   int bar = foo [index];   int baz = bar + index;   What is the result?()

    • A、 Baz has the value of 0
    • B、 Baz has the value of 1
    • C、 Baz has the value of 2
    • D、 An exception is thrown.
    • E、 The code will not compile.

    正确答案:B

  • 第4题:

    int index = 1;  String [] test = new String[3];  String foo = test[index];     What is the result?()  

    • A、 Foo has the value “”
    • B、 Foo has the value null
    • C、 An exception is thrown
    • D、 The code will not compile

    正确答案:B

  • 第5题:

    单选题
    int index = 1;  boolean[] test = new Boolean[3];  boolean foo= test [index];   What is the result?()
    A

     Foo has the value of 0.

    B

     Foo has the value of null.

    C

     Foo has the value of true.

    D

     Foo has the value of false.

    E

     An exception is thrown.

    F

     The code will not compile.


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

  • 第6题:

    单选题
    public class Foo {  public int a;  public Foo() { a = 3; }  public void addFive() { a += 5; }  }  and:  public class Bar extends Foo { public int a;  public Bar() { a = 8; }  public void addFive() { this.a +=5; }  }  invoked with:  Foo foo = new Bar();  foo.addFive();  System.out.println(”Value: “+ foo.a);  What is the result?()
    A

     Value: 3

    B

     Value: 8

    C

     Value: 13

    D

     Compilation fails.

    E

     The code runs with no output.

    F

     An exception is thrown at runtime.


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

  • 第7题:

    单选题
    int index = 1;  String [] test = new String[3];  String foo = test[index];     What is the result?()
    A

     Foo has the value “”

    B

     Foo has the value null

    C

     An exception is thrown

    D

     The code will not compile


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

  • 第8题:

    多选题
    Given: String value = getServletContext().getInitParameter("foo"); in an HttpServlet and a web applicationdeployment descriptor that contains: foo frodo Which two are true?()
    A

    The foo initialization parameter CANNOT be set programmatically.

    B

    Compilation fails because getInitParameter returns type Object.

    C

    The foo initialization parameter is NOT a servlet initialization parameter.

    D

    Compilation fails because ServletContext does NOT have a getInitParameter method.

    E

    The foo parameter must be defined within the  element of the deployment descriptor.


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

  • 第9题:

    单选题
    Given:  8.int index = 1:  9.Boolean [] test = new boolcan [3];  10.boolcan foo = test [index];   What is the result()?
    A

     foo has the value of 0.

    B

     foo has the value of null.

    C

     foo has the value of true.

    D

     foo has the value of false.

    E

     An-exception is thrown.

    F

     The code will not compile.


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

  • 第10题:

    单选题
    Given the HttpServlet code:   getServletContext().setAttribute(“foo”, “value”); What is the result?()
    A

     The attribute foo is placed in the application

    B

     A ServletContextListener registered for that servlet is notified

    C

     A ServletAttributeListener registered for that servlet is notified

    D

     An HttpSessionAttributeListener registered for that servlet is notified


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

  • 第11题:

    单选题
    int index = 1;   boolean test = new Boolean;   boolean foo= test [index];  What is the result?()
    A

     Foo has the value of 0.

    B

     Foo has the value of null.

    C

     Foo has the value of true.

    D

     Foo has the value of false.

    E

     An exception is thrown.

    F

     The code will not compile.


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

  • 第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题:

    int index = 1;   boolean test = new Boolean;   boolean foo= test [index];  What is the result?()

    • A、 Foo has the value of 0.
    • B、 Foo has the value of null.
    • C、 Foo has the value of true.
    • D、 Foo has the value of false.
    • E、 An exception is thrown.
    • F、 The code will not compile.

    正确答案:D

  • 第14题:

    String foo = “blue”;  Boolean[]bar = new Boolean [1];  if (bar[0])  {  foo = “green”;  }   What is the result? () 

    • A、 Foo has the value of “”
    • B、 Foo has the value of null.
    • C、 Foo has the value of “blue”
    • D、 Foo has the value of “green”
    • E、 An exception is thrown.
    • F、 The code will not compile.

    正确答案:F

  • 第15题:

    Given the HttpServlet code:   getServletContext().setAttribute(“foo”, “value”); What is the result?()

    • A、 The attribute foo is placed in the application
    • B、 A ServletContextListener registered for that servlet is notified
    • C、 A ServletAttributeListener registered for that servlet is notified
    • D、 An HttpSessionAttributeListener registered for that servlet is notified

    正确答案:A

  • 第16题:

    public class Foo {  public int a;  public Foo() { a = 3; }  public void addFive() { a += 5; }  }  and:  public class Bar extends Foo { public int a;  public Bar() { a = 8; }  public void addFive() { this.a +=5; }  }  invoked with:  Foo foo = new Bar();  foo.addFive();  System.out.println(”Value: “+ foo.a);  What is the result?() 

    • A、 Value: 3
    • B、 Value: 8
    • C、 Value: 13
    • D、 Compilation fails.
    • E、 The code runs with no output.
    • F、 An exception is thrown at runtime.

    正确答案:A

  • 第17题:

    多选题
    Given: 6. Which two successfully translate and result in a value of true?()
    A

    ${true or false}

    B

    ${requestScope[foo][0] > 500}

    C

    ${requestScope[’foo’][1] = 420}

    D

    ${(requestScope[’foo’][0] lt 50) && (3 gt 2)}


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

  • 第18题:

    单选题
    int index = 1;  int [] foo = new int [3];  int bar = foo [index];  int baz = bar + index;   What is the result?()
    A

     Baz has the value of 0

    B

     Baz has the value of 1

    C

     Baz has the value of 2

    D

     An exception is thrown.

    E

     The code will not compile.


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

  • 第19题:

    单选题
    String foo = “blue”;  Boolean[]bar = new Boolean [1];  if (bar[0])  {  foo = “green”;  }   What is the result? ()
    A

     Foo has the value of “”

    B

     Foo has the value of null.

    C

     Foo has the value of “blue”

    D

     Foo has the value of “green”

    E

     An exception is thrown.

    F

     The code will not compile.


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

  • 第20题:

    单选题
    String foo = “blue”;    Booleanbar = new Boolean [1];    if (bar[0]) {    foo = “green”;    }   What is the result?()
    A

     Foo has the value of “”

    B

     Foo has the value of null.

    C

     Foo has the value of “blue”

    D

     Foo has the value of “green”

    E

     An exception is thrown.

    F

     The code will not compile.


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

  • 第21题:

    多选题
    Given: String value = getServletContext().getInitParameter("foo"); in an HttpServlet and a web applicationdeployment descriptor that contains: foo frodo Which two are true?()
    A

    The foo initialization parameter CANNOT be set programmatically.

    B

    Compilation fails because getInitParameter returns type Object.

    C

    The foo initialization parameter is NOT a servlet initialization parameter.

    D

    Compilation fails because ServletContext does NOT have a getInitParameter method.

    E

    The foo parameter must be defined within the  element of the deployment descriptor.


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

  • 第22题:

    单选题
    int index = 1;   String test = new String;   String foo = test[index];  What is the result?()
    A

      Foo has the value “”

    B

     Foo has the value null

    C

     An exception is thrown

    D

     The code will not compile


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

  • 第23题:

    单选题
    What is the result?()
    A

     foo has the value””

    B

     foo has the value null.

    C

     An exception is thrown.

    D

     The code will not compile.


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

  • 第24题:

    单选题
    int index = 1;   int foo = new int ;   int bar = foo [index];   int baz = bar + index;   What is the result?()
    A

     Baz has the value of 0

    B

     Baz has the value of 1

    C

     Baz has the value of 2

    D

     An exception is thrown.

    E

     The code will not compile.


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