网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
单选题
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


参考答案

参考解析
解析: 暂无解析
更多 “单选题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 registered for that servlet is notifiedD  An HttpSessionAttributeListener registered for that servlet is notified” 相关考题
考题 在J2EE中,以下关于HttpServlet说法错误的是( )A、HttpServlet是一个抽象类B、HttpServlet扩展了GenericServlet类C、HttpServlet类的子类必须至少重写service方法D、HttpServlet位于javax.servlet.http包中

考题 Given:Stringvalue=getServletContext().getInitParameter(foo);inanHttpServletandawebapplicationdeploymentdescriptorthatcontains:context-paramparam-namefoo/param-nameparam-valuefrodo/param-value/context-paramWhichtwoaretrue?()A.ThefooinitializationparameterCANNOTbesetprogrammatically.B.CompilationfailsbecausegetInitParameterreturnstypeObject.C.ThefooinitializationparameterisNOTaservletinitializationparameter.D.CompilationfailsbecauseServletContextdoesNOThaveagetInitParametermethod.E.Thefooparametermustbedefinedwithintheelementofthedeploymentdescriptor.

考题 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 */ }

考题 Given:Which exception or error will be thrown when a programmer attempts to run this code?() A.java.lang.StackOverflowErrorB.java.lang.IllegalStateExceptionC.java.lang.ExceptionInInitializerErrorD.java.lang.ArrayIndexOutOfBoundsException

考题 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*/}

考题 Given:What can be a result?() A.Compilation fails.B.An exception is thrown at runtime.C.The code executes and prints StartedComplete.D.The code executes and prints StartedComplete0123.E.The code executes and prints Started0123Complete.

考题 Click the Exhibit button. Given:Which two statements are true if a NullPointerException is thrown on line 3 of class C? () A.The application will crash.B.The code on line 29 will be executed.C.The code on line 5 of class A will execute.D.The code on line 5 of class B will execute.E.The exception will be propagated back to line 27.

考题 Given:Which code fragment, inserted at line 23, allows the code to compile?() A.df = new DateFormat();B.df = Date.getFormat();C.df = date.getFormat();D.df = DateFormat.getFormat();E.df = DateFormat.getInstance();

考题 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.

考题 J2EE中以下关于HttpServlet的说法错误的是()A、 HttpServlet是一个抽象类B、 HttpServlet类扩展了GenericServlet类C、 HttpServlet类的子类必须至少重写service方法D、 HttpServlet位于javax.servlet.http包中

考题 If a vessel subject to PSC inspection, PSC Officer shall give the inspection to the Captain, the given timeframe for rectification of each deficiency is commonly given in a coded form which called “action code”, which code listed below is used for indication of detention of the vessel?()A、10B、30C、17D、16

考题 Which code fragments will succeed in printing the last argument given on the command line to the standard output, and exit gracefully with no output if no arguments are given?()   CODE FRAGMENT a:   public static void main(String args[]) {   if (args.length != 0)   System.out.println(args[args.length-1]);   }   CODE FRAGMENT b:   public static void main(String args[]) {   try { System.out.println(args[args.length]); }   catch (ArrayIndexOutOfBoundsException e) {}   }   CODE FRAGMENT c:   public static void main(String args[]) {   int ix = args.length;   String last = args[ix];   if (ix != 0) System.out.println(last);   }   CODE FRAGMENT d:   public static void main(String args[]) {   int ix = args.length-1;   if (ix  0) System.out.println(args[ix]);   }   CODE FRAGMENT e:   public static void main(String args[]) {   try { System.out.println(args[args.length-1]);  }catch (NullPointerException e) {}   }  A、Code fragment a.B、Code fragment b.C、Code fragment c.D、Code fragment d.E、Code fragment e.

考题 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 registered for that servlet is notifiedD、 An HttpSessionAttributeListener registered for that servlet is notified

考题 Given the JSP code: 10. 11. 12. 13.Hello, ${customer.title} ${customer.lastName}, welcome 14.to Squeaky Beans, Inc. 15.16.  Which three types of JSP code are used?()A、Java codeB、Template textC、Scripting codeD、Standard actionE、Expression language

考题 单选题If a vessel subject to PSC inspection, PSC Officer shall give the inspection to the Captain, the given timeframe for rectification of each deficiency is commonly given in a coded form which called “action code”, which code listed below is used for indication of detention of the vessel?()A 10B 30C 17D 16

考题 多选题Click the Exhibit button.   Given: Which two statements are true if a NullPointerException is thrown on line 3 of class C?()AThe application will crash.BThe code on line 29 will be executed.CThe code on line 5 of class A will execute.DThe exception will be propagated back to line 27.EThe code on line 5 of class B will execute.

考题 多选题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?()Apublic void foo() { /* more code here */ }Bprivate void foo() { /* more code here */ }Cprotected void foo() { /* more code here */ }Dint foo() { /* more code here */ }Evoid foo() { /* more code here */ }

考题 单选题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”)

考题 单选题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);

考题 多选题Given: Which three methods, inserted individually at line 14, will correctly complete class Two?()Aint foo() { /* more code here */ }Bvoid foo() { /* more code here */ }Cpublic void foo() { /* more code here */ }Dprivate void foo() { /* more code here */ }Eprotected void foo() { /* more code here */ }

考题 多选题Given the JSP code: 10. 11. 12. 13.Hello, ${customer.title} ${customer.lastName}, welcome 14.to Squeaky Beans, Inc. 15.16.  Which three types of JSP code are used?()AJava codeBTemplate textCScripting codeDStandard actionEExpression language

考题 单选题Given: What is the result?()A Compilation fails.B An exception is thrown at runtime.C The code executes and prints "running".D The code executes and prints "runningrunning".E The code executes and prints "runningrunningrunning".

考题 单选题Given: What is the result?()A HelloB Hello WorldC Compilation fails.D Hello World 5E The code runs with no output.

考题 单选题Given this method in a class:  public String toString() {  StringBuffer buffer = new StringBuffer();  buffer.append(‟‟);  return buffer.toString();  }  Which is true?()A  This code is NOT thread-safe.B  The programmer can replace StringBuffer with StringBuilder with no other changes.C  This code will perform well and converting the code to use StringBuilder will not enhance the performance.D  This code will perform poorly. For better performance, the code should be rewritten: return ““+ this.name + “”;

考题 单选题Given: What is the result?()A Compilation fails.B An exception is thrown at runtime.C The code executes normally and prints "sleep".D The code executes normally, but nothing is printed.

考题 单选题J2EE中以下关于HttpServlet的说法错误的是()A  HttpServlet是一个抽象类B  HttpServlet类扩展了GenericServlet类C  HttpServlet类的子类必须至少重写service方法D  HttpServlet位于javax.servlet.http包中

考题 多选题Given: String value = getServletContext().getInitParameter("foo"); in an HttpServlet and a web applicationdeployment descriptor that contains: foo frodo Which two are true?()AThe foo initialization parameter CANNOT be set programmatically.BCompilation fails because getInitParameter returns type Object.CThe foo initialization parameter is NOT a servlet initialization parameter.DCompilation fails because ServletContext does NOT have a getInitParameter method.EThe foo parameter must be defined within the  element of the deployment descriptor.