SCWCD(310-083)

多选题Given: 3.public class MyTagHandler extends TagSupport { 4.public int doStartTag() { 5.// insert code here 6.// return an int 7.} 8.// more code here ... 18.} There is a single attribute foo in the session scope. Which three code fragments,inserted inde

题目
多选题
Given: 3.public class MyTagHandler extends TagSupport { 4.public int doStartTag() { 5.// insert code here 6.// return an int 7.} 8.// more code here ... 18.} There is a single attribute foo in the session scope. Which three code fragments,inserted independently atline 5,return the value of the attribute?()
A

Object o = pageContext.getAttribute(foo);

B

Object o = pageContext.findAttribute(foo);

C

Object o = pageContext.getAttribute(foo,PageContext.SESSION_SCOPE);

D

HttpSession s = pageContext.getSession();Object o = s.getAttribute(foo);

参考答案和解析
正确答案: C,D
解析: 暂无解析
如果没有搜索结果,请直接 联系老师 获取答案。
相似问题和答案

第1题:

Given:Which code, inserted at line 15, allows the class Sprite to compile?()

A.Foo { public int bar() { return 1; }

B.new Foo { public int bar() { return 1; }

C.new Foo() { public int bar() { return 1; }

D.new class Foo { public int bar() { return 1; }


参考答案:C

第2题:

class One {  void foo() {}  }  class Two extends One {   //insert method here  }  Which three methods, inserted individually at line 14, will correctly complete class Two?()

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

正确答案:B,C,E

第3题:

Given:Which three methods, inserted individually at line 14, will correctly complete class Two?()

A.int foo() { /* more code here */ }

B.void foo() { /* more code here */ }

C.public void foo() { /* more code here */ }

D.private void foo() { /* more code here */ }

E.protected void foo() { /* more code here */ }


参考答案:B, C, E

第4题:

public class Score implements Comparable {  private int wins, losses;  public Score(int w, int 1) { wins = w; losses = 1; }  public int getWins() { return wins; }  public int getLosses() { return losses; }  public String toString() {  return “<“ + wins + “,“ + losses + “>”; }  // insert code here  }  Which method will complete this class?() 

  • A、 public int compareTo(Object o) {/*mode code here*/}
  • B、 public int compareTo(Score other) {/*more code here*/}
  • C、 public int compare(Score s1,Score s2){/*more code here*/}
  • D、 public int compare(Object o1,Object o2){/*more code here*/}

正确答案:B

第5题:

10. interface Foo { int bar(); }  11. public class Sprite {  12. public int fubar( Foo foo) { return foo.bar(); }  13. public void testFoo() {  14. fubar(  15. // insert code here  16.);  17. }  18. }  Which code, inserted at line 15, allows the class Sprite to compile?() 

  • A、 Foo { public int bar() { return 1; } }
  • B、 new Foo { public int bar() { return 1; } }
  • C、 newFoo() { public int bar(){return 1; } }
  • D、 new class Foo { public int bar() { return 1; } }

正确答案:C

第6题:

Given: 3.public class MyTagHandler extends TagSupport { 4.public int doStartTag() { 5.// insert code here 6.// return an int 7.} 8.// more code here ... 18.} There is a single attribute foo in the session scope. Which three code fragments,inserted independently atline 5,return the value of the attribute?()

  • A、Object o = pageContext.getAttribute("foo");
  • B、Object o = pageContext.findAttribute("foo");
  • C、Object o = pageContext.getAttribute("foo",PageContext.SESSION_SCOPE);
  • D、HttpSession s = pageContext.getSession();Object o = s.getAttribute("foo");

正确答案:B,C,D

第7题:

1.class SuperFo{   2. SuperFo doStuff(int x){   3.return new SuperFo()   4.}   5.}  6.   7.class Foo extends SuperFo{   8.//insert code here   9.}   和四个声明:   Foo doStuff(int x){return new Foo();}   Foo doStuff(int x){return new SuperFoo();}   SuperFoo doStuff(int x){return new foo();}   SuperFoo doStuff(int y){return new SuperFoo();}   分别插入到第8行,有几个可以通过编译 ()

  • A、1
  • B、2
  • C、3
  • D、4
  • E、5

正确答案:C

第8题:

Given:Which method will complete this class?()

A.public int compareTo(Object o){/*more code here*/}

B.public int compareTo(Score other){/*more code here*/}

C.public int compare(Score s1,Score s2){/*more code here*/}

D.public int compare(Object o1,Object o2){/*more code here*/}


参考答案:B

第9题:

class One {   public One foo() { return this; }  }  class Two extends One {  public One foo() { return this; }  }  class Three extends Two {   // insert method here  }  Which two methods, inserted individually, correctly complete the Three class?()

  • A、 public void foo() { }
  • B、 public int foo() { return 3; }
  • C、 public Two foo() { return this; }
  • D、 public One foo() { return this; }
  • E、 public Object foo() { return this; }

正确答案:C,D

第10题:

1. class SuperFoo {  2. SuperFoo doStuff(int x) {  3. return new SuperFoo(); 4. }  5. }  6.  7. class Foo extends SuperFoo {  8. //insert code here  9. }   下面哪三项分别插入到第8行,可以编译?()

  • A、int doStuff() { return 42; }
  • B、int doStuff(int x) { return 42; }
  • C、Foo doStuff(int x) { return new Foo(); }
  • D、SuperFoo doStuff(int x) { return new Foo(); }

正确答案:A,C,D

更多相关问题