Given: String value = getServletContext().getInitParameter("

题目
多选题
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.

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

FilterConfig的哪个方法可以返回init参数的名称?()

  • A、getServletContext()
  • B、getInitParameter(Stringname)
  • C、getFilterName()
  • D、getInitParameterNames()

正确答案:D

第2题:

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

正确答案:B

第3题:

GiventheHttpServletcode:getServletContext().setAttribute(“foo”,“value”);Whatistheresult?()

A.Theattributefooisplacedintheapplication

B.AServletContextListenerregisteredforthatservletisnotified

C.AServletAttributeListenerregisteredforthatservletisnotified

D.AnHttpSessionAttributeListenerregisteredforthatservletisnotified


参考答案:A

第4题:

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

第5题:

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

第6题:

public class test(  public static void main(string[]args){  string foo = args [1];  string foo = args [2];  string foo = args [3];  }  )  And command line invocation: Java Test red green blue   What is the result?()  

  • A、 Baz has the value of “”
  • B、 Baz has the value of null
  • C、 Baz has the value of “red”
  • D、 Baz has the value of “blue”
  • E、 Bax has the value of “green”
  • F、 The program throws an exception.

正确答案:F

第7题:

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

第8题:

Given:Stringvalue=getServletContext().getInitParameter("foo");inanHttpServletandawebapplicationdeploymentdescriptorthatcontains:<context-param><param-name>foo</param-name><param-value>frodo</param-value></context-param>Whichtwoaretrue?()

A.ThefooinitializationparameterCANNOTbesetprogrammatically.

B.CompilationfailsbecausegetInitParameterreturnstypeObject.

C.ThefooinitializationparameterisNOTaservletinitializationparameter.

D.CompilationfailsbecauseServletContextdoesNOThaveagetInitParametermethod.

E.Thefooparametermustbedefinedwithintheelementofthedeploymentdescriptor.


参考答案:A, C

第9题:

public class test(   public static void main(stringargs){   string foo = args [1];   string foo = args ;   string foo = args ;   }   )   And command line invocation:  Java Test red green blue  What is the result? () 

  • A、 Baz has the value of “”
  • B、 Baz has the value of null
  • C、 Baz has the value of “red”
  • D、 Baz has the value of “blue”
  • E、 Bax has the value of “green”
  • F、 The program throws an exception.

正确答案:F

第10题:

Given the following code:    public class Test {  void printValue(int m){  do {  System.out.println("The value is"+m);     }  while( --m > 10 )     }  public static void main(String arg[]) {     int i=10;  Test t= new Test();     t.printValue(i);     }     }  Which will be output?()    

  • A、 The value is 8
  • B、 The value is 9
  • C、 The value is 10
  • D、 The value is 11

正确答案:C

更多相关问题