多选题Given: 3.class MyServlet extends HttpServlet { 4.public void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException,IOException { 5.// servlet code here ... 26.} 27.} If the DD contains a single security constraint associated w

题目
多选题
Given: 3.class MyServlet extends HttpServlet { 4.public void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException,IOException { 5.// servlet code here ... 26.} 27.} If the DD contains a single security constraint associated with MyServlet and its only  tagsand  tags are:GETPUT Admin Which four requests would be allowed by the container?()
A

A user whose role is Admin can perform a PUT.

B

A user whose role is Admin can perform a GET.

C

A user whose role is Admin can perform a POST.

D

A user whose role is Member can perform a PUT.

E

A user whose role is Member can perform a POST.

F

A user whose role is Member can perform a GET.


相似考题
更多“Given: 3.class MyServlet extends HttpServlet { 4.public void”相关问题
  • 第1题:

    Given the web application deployment descriptor elements: 11. 12.ParamAdder 13.com.example.ParamAdder 14.... 24. 25.ParamAdder 26.MyServlet 27. 28. Which element, inserted at line 27,causes the ParamAdder filter to be applied when MyServlet is invokedby another servlet using the RequestDispatcher.include method?()

    • A、<include/>
    • B、<dispatcher>INCLUDE</dispatcher>
    • C、<dispatcher>include</dispatcher>
    • D、<filter-condition>INCLUDE</filter-condition>
    • E、<filter-condition>include</filter-condition>

    正确答案:B

  • 第2题:

    Given the following interface definition, which definitions are valid?()   interface I {   void setValue(int val);   int getValue();   }    DEFINITION a:   (a) class a extends I {  int value;   void setValue(int val) { value = val;  }   int getValue() {  return value;  }   }   DEFINITION b:   (b) interface b extends I {   void increment();   }   DEFINITION c:   (c) abstract class c implements I {   int getValue() {  return 0;  }  abstract void increment();   }   DEFINITION d:   (d) interface d implements I {  void increment();  }   DEFINITION e:   (e) class e implements I {  int value;   public void setValue(int val) { value = val; }  }  

    • A、Definition a.
    • B、Definition b.
    • C、Definition c.
    • D、Definition d.
    • E、Definition e.

    正确答案:B,C

  • 第3题:

    1.public class Test {  2.public static void main (String args[]) {  3.class Foo {  4.public int i = 3;  5.}  6.Object o = (Object) new Foo();  7.Foo foo = (Foo)o;  8.System.out.printIn(foo. i); 9. }  10.}   What is the result?()  

    • A、 Compilation will fail.
    • B、 Compilation will succeed and the program will print “3”
    • C、 Compilation will succeed but the program will throw a ClassCastException at line 6.
    • D、 Compilation will succeed but the program will throw a ClassCastException at line 7.

    正确答案:B

  • 第4题:

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

  • 第5题:

    单选题
    Given: 11.public class MyServlet extends HttpServlet { 12.public void service(HttpServletRequest request, 13.HttpServletResponse response) 14.throws ServletException, IOException { 15.// insert code here 16.} 17.} and this element in the web application’s deployment descriptor: 302 /html/error.html Which,inserted at line 15,causes the container to redirect control to the error.html resource?()
    A

    response.setError(302);

    B

    response.sendError(302);

    C

    response.setStatus(302);

    D

    response.sendRedirect(302);

    E

    response.sendErrorRedirect(302);


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

  • 第6题:

    单选题
    现有:  interface Data {public void load();}  abstract class Info {public abstract void load();}      下列类定义中正确使用Data和Info的是哪项?()
    A

     public class Employee implements Info extends Data { public void load(){/*dosomething*/}     }

    B

    public class Employee extends Inf.implements Data{ public void load() {/*do something*/}     }

    C

    public class Empl.yee implements Inf extends Data{ public void Data.1oad(){* do something*/}     public void load(){/*do something*/}     }

    D

    public class Employee extends Inf implements Data  {  public void Data.1oad()  {/*do something*/)     public void info.1oad(){/*do something*/}    }


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

  • 第7题:

    单选题
    Given: 1.package test; 2. 3.class Target { 4.public String name = "hello";5.} What can directly access and change the value of the variable name?()
    A

    any class

    B

    only the Target class

    C

    any class in the test package

    D

    any class that extends Target


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

  • 第8题:

    填空题
    Given the following code, write a line of code that, when inserted at the indicated location, will make the overriding method in Extension invoke the overridden method in class Base on the current object.   class Base {   public void print( ) {   System.out.println("base");   }   }   class Extention extends Base {   public void print( ) {   System.out.println("extension");   // insert line of implementation here   }   }   public class Q294d {   public static void main(String args[]) {   Extention ext = new Extention( );   ext.print( );   }   }   Fill in a single line of implementation.()

    正确答案: super.print();
    解析: 暂无解析

  • 第9题:

    单选题
    Given the web application deployment descriptor elements: 11. 12.ParamAdder 13.com.example.ParamAdder 14.... 24. 25.ParamAdder 26.MyServlet 27. 28. Which element, inserted at line 27,causes the ParamAdder filter to be applied when MyServlet is invokedby another servlet using the RequestDispatcher.include method?()
    A

    <include/>

    B

    <dispatcher>INCLUDE</dispatcher>

    C

    <dispatcher>include</dispatcher>

    D

    <filter-condition>INCLUDE</filter-condition>

    E

    <filter-condition>include</filter-condition>


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

  • 第10题:

    多选题
    abstract class A {  abstract void al();  void a2() { }  }  class B extends A {  void a1() { }  void a2() { }  }  class C extends B { void c1() { } }  and:  A x = new B(); C y = new C(); A z = new C();  Which four are valid examples of polymorphic method calls?()
    A

    x.a2();

    B

    z.a2();

    C

    z.c1();

    D

    z.a1();

    E

    y.c1();

    F

    x.a1();


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

  • 第11题:

    单选题
    Given the definition of MyServlet: 11.public class MyServlet extends HttpServlet { 12.public void service(HttpServletRequest request, 13.HttpServletResponse response) 14.throws ServletException, IOException { 15.HttpSession session = request.getSession(); 16.session.setAttribute("myAttribute","myAttributeValue"); 17.session.invalidate(); 18.response.getWriter().println("value=" + 19.session.getAttribute("myAttribute")); 20.} 21.} What is the result when a request is sent to MyServlet?()
    A

    An IllegalStateException is thrown at runtime.

    B

    An InvalidSessionException is thrown at runtime.

    C

    The string value=null appears in the response stream.

    D

    The string value=myAttributeValue appears in the response stream.


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

  • 第12题:

    单选题
    现有:  1.  interface Animal  f      2.    void eat();      3.    }      4.  5.  // insert code here      6.  7. public class HouseCat implements Feline  {      8.    public void eat()    {  }     9.  }  和以下三个接口声明:  interface Feline extends Animal  (  )  interface Feline extends Animal  {void eat();    }  interface Feline extends Animal  {void eat()    {  }  }   分别插入到第5行,有多少行可以编译?
    A

      0

    B

      1

    C

      2

    D

      3


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

  • 第13题:

    interface Data { public void load(); }  abstract class Info { public abstract void load(); }  Which class correctly uses the Data interface and Info class?() 

    • A、 public class Employee extends Info implements Data { public void load() { /*do something*/ } }
    • B、 public class Employee implements Info extends Data { public void load() { /*do something*/ } }
    • C、 public class Employee extends Info implements Data { public void load() { /*do something */ } public void Info.load() { /*do something*/ } }
    • D、 public class Employee implements Info extends Data { public void Data.load() { /*dsomething */ } public void load() { /*do something */ } }
    • E、 public class Employee implements Info extends Data { public void load() { /*do something */ } public void Info.load(){ /*do something*/ } }
    • F、 public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ } public void Info.load() { /*do something*/ } }

    正确答案:A

  • 第14题:

    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

  • 第15题:

    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

  • 第16题:

    多选题
    Given: 10. interface Jumper { public void jump(); } ...   20. class Animal {} ...   30. class Dog extends Animal {   31. Tail tail;   32. }   ...   40. class Beagle extends Dog implements Jumper{   41. public void jump() {}  42. }   ...   50. class Cat implements Jumper{   51. public void jump() {}   52. }. Which three are true?()
    A

    Cat is-a Jumper

    B

    Cat is-a Animal

    C

    Dog is-a Jumper

    D

    Dog is-a Animal

    E

    Beagle has-a Jumper

    F

    Cat has-a Animal

    G

    Beagle has-a Tail


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

  • 第17题:

    多选题
    Given: 3.class MyServlet extends HttpServlet { 4.public void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException,IOException { 5.// servlet code here ... 26.} 27.} If the DD contains a single security constraint associated with MyServlet and its only  tagsand  tags are:GETPUT Admin Which four requests would be allowed by the container?()
    A

    A user whose role is Admin can perform a PUT.

    B

    A user whose role is Admin can perform a GET.

    C

    A user whose role is Admin can perform a POST.

    D

    A user whose role is Member can perform a PUT.

    E

    A user whose role is Member can perform a POST.

    F

    A user whose role is Member can perform a GET.


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

  • 第18题:

    单选题
    interface Data { public void load(); }  abstract class Info { public abstract void load(); }  Which class correctly uses the Data interface and Info class?()
    A

     public class Employee extends Info implements Data { public void load() { /*do something*/ } }

    B

     public class Employee implements Info extends Data { public void load() { /*do something*/ } }

    C

     public class Employee extends Info implements Data { public void load() { /*do something */ } public void Info.load() { /*do something*/ } }

    D

     public class Employee implements Info extends Data { public void Data.load() { /*dsomething */ } public void load() { /*do something */ } }

    E

     public class Employee implements Info extends Data { public void load() { /*do something */ } public void Info.load(){ /*do something*/ } }

    F

     public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ } public void Info.load() { /*do something*/ } }


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

  • 第19题:

    多选题
    public abstract class Shape {  private int x;  private int y;  public abstract void draw();  public void setAnchor(int x, int y) {  this.x = x;  this.y = y;  }  }  Which two classes use the Shape class correctly?()
    A

    public class Circle implements Shape { private int radius; }

    B

    public abstract class Circle extends Shape { private int radius; }

    C

    public class Circle extends Shape { private int radius; public void draw(); }

    D

    public abstract class Circle implements Shape { private int radius; public void draw(); }

    E

    public class Circle extends Shape { private int radius;public void draw() {/* code here */} }

    F

    public abstract class Circle implements Shape { private int radius;public void draw() { / code here */ } }


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

  • 第20题:

    单选题
    Given: 1.package test; 2. 3.class Target { 4.public String name = "hello";5.} What can directly access and change the value of the variable name?()
    A

    any class

    B

    only the Target class

    C

    any class in the test package

    D

    any class that extends Target


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

  • 第21题:

    单选题
    public class TestA{   public void methodA()  throws IOException{   //……   }   }   public class TestB extends TestA{   public void methodA()  throws EOFException{   //……   }   }   public class TestC extends TestA{   public void methodA()  throws Exception{   //……   }   }   当编译类TestC的时候,结果是哪项?()
    A

     正常

    B

     编译错误

    C

     运行错误

    D

     以上都不对


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

  • 第22题:

    单选题
    Given a class Repetition: 1.package utils; 2. 3.public class Repetition{ 4.public static String twice(Strings){returns+s;} 5.} and given another class Demo: 1.//insert code here2. 3.public class Demo{ 4.public static void main(String[]args){ 5.System.out.println(twice("pizza")); 6.} 7.} Which code should be inserted at line 1 of Demo.java to compile and run Demo to print“pizzapizza”?()
    A

    import utils.*;

    B

    static import utils.*;

    C

    importutils.Repetition.*;

    D

    static importutils.Repetition.*;

    E

    import utils.Repetition.twice();

    F

    import static utils.Repetition.twice;

    G

    static import utils.Repetition.twice;


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

  • 第23题:

    单选题
    1.public class Test {  2.public static void main (String args[]) {  3.class Foo {  4.public int i = 3;  5.}  6.Object o = (Object) new Foo();  7.Foo foo = (Foo)o;  8.System.out.printIn(foo. i); 9. }  10.}   What is the result?()
    A

     Compilation will fail.

    B

     Compilation will succeed and the program will print “3”

    C

     Compilation will succeed but the program will throw a ClassCastException at line 6.

    D

     Compilation will succeed but the program will throw a ClassCastException at line 7.


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

  • 第24题:

    单选题
    1. interface Animal {   2. void eat();   3. }   4.   5. // insert code here   6.   7. public class HouseCat implements Feline {   8. public void eat() { }   9. }   和以下三个接口声明:   interface Feline extends Animal { }   interface Feline extends Animal { void eat(); }   interface Feline extends Animal { void eat() { } }   分别插入到第 5 行,有多少行可以编译?()
    A

    0

    B

    1

    C

    2

    D

    3


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