• No se han encontrado resultados

Desafiando a la mecánica cuántica y a la relatividad

In document Cine, Ciencia y Arte 1 (página 34-40)

C. SSL D. FORM

19. Which methods can be used for writing logging message to servlet log file?

Please select two correct answers.

A. log(String msg)

B. log(int code, String msg)

C. log(String msg, Throwable t)

D. log(int code, String msg, Throwable t)

20.Which tag is used in web.xml to mark a web application to be suitable for running between multiple systems.

Please select one correct answer.

A. multiple B. distributable C. resource-ref D. transferrable E. splitable

21. Which of the following are VALID servlet error attributes?

Please select three correct answers.

A. javax.servet.error.status_code B. javax.servet.error.exception C. javax.servet.error.uri D. javax.servet.error.message E. javax.servet.error.query

22. Which statement is TRUE about the following jsp code snippet?

Please select one correct answer.

<%

String theKey = "key";

String theValue = "value";

session.removeAttribute(theKey); //1

%>

session.setAttribute("<%= theKey %>",

"<%= theValue %>"); //2 session.getAttribute("<%= theKey %>"); //3

<%= session.getAttribute(theKey) %> //4

A. The code compiles but might have runtime NullPointerException at //1 B. There will have compilation error at //2 and //3.

C. There will have output as null at //4.

D. There will have output as theValue at //4

23. Which of the following are VALID taglib configuration?

Please select three correct answers.

A.

<taglib>

...

<tag>

<name>myTag</name>

<tag-class>MyTag</tag-class>

</tag>

...

</taglib>

B.

<taglib>

...

<tag>

<name>myTag</name>

<tag-class>MyTag</tag-class>

<body-content>SERVLET</body-content>

</tag>

...

</taglib>

C.

<taglib>

...

24.Which of the following statement is FALSE regarding JSP page directive attributes default value?

Please select one correct answer..

A. The session attribute has default value as true B. The buffer attribute has default value as 8kb C. The autoflush attribute has default value as false D. The isThreadSafe attribute has default value as true E. The isErrorPage attribute has default value as false

F. The pageEncoding attribute has default value as ISO-8859-1

25.Which of the following deployment descriptor tags are used for context level parameter initialization?

Please select three correct answers.

A. param-name

26. Given the following code snippet, what would be the output you can expect to see on the web page?

Please select one correct answer.

// Calling servlet:

public void doGet(HttpServletRequest req,

HttpServletResponse res) throws ServletException, IOException {

res.setContentType("text/html");

PrintWriter out = res.getWriter();

out.println("<HTML><BODY>");

out.println("I am calling others!");

RequestDispatcher rd= req.getRequestDispatcher("/MyServlet");

rd.include(req, res);

out.println("</BODY></HTML>");

out.close();

}

// Target servlet:

protected void doGet(HttpServletRequest req,

HttpServletResponse res) throws ServletException, IOException {

PrintWriter out = res.getWriter();

out.println("I am called by others!");

A."I am calling others!"

B."I am called by others!"

C.Both "I am calling others!" and "I am called by others!"

D.An IllegalStateException is thrown E.An IOException is thrown

27.Which statement is NOT true about the SingleThreadModel interface?

Please select one correct answer

A.By implementing this interface it ensures that servlets handle only one

B.If a servlet implements this interface, no two threads will execute concurrently in the servlet's service method

C.This interface has no methods

D.The servlet container will ensure there will be only one instance of the servlet at a time if the servlet implements this interface

E.Class variables are not protected by this interface, but instance variables are protected.

28.Which of the following method is called upon the initialization of a servlet context?

Please select one correct answer

A. contextInitializing(ServletContextEvent e) B. contextInitial(ServletContext e)

C. contextInitialize(ServletContext e) D. contextInitialize(ServletContextEvent e) E. contextInitialized(ServletContextEvent e) 29. Which of the following statements are TRUE?

Please select three correct answers

A.XML equivalent for JSP expression <%= expression %> is

<jsp:expression>expression</jsp:expression>

B.XML equivalent for JSP scriptlet <% scriptlet %> is <jsp:scriptlet>scriptlet</jsp:scriptlet>

C.XML equivalent for JSP declaration <%! declaration %> is

<jsp:declaration>declaration</jsp:declaration>.

D. XML equivalent for JSP include directive <%@ include file="url" %> is <jsp:include file="url"/>, where url must be relative

E. XML equivalent for JSP page directive <%@ page buffer="16kb" %> is <jsp:page buffer="16kb"/>

30. Please select CORRECT JSP useBean declaration methods Please select three correct answers

A.<jsp:useBean id="user" beanName="TestUser" type="com.test.model.User" />

B.<jsp:useBean id="user" beanName="TestUser" class="com.test.model.User" />

C. <jsp:useBean beanName="TestUser" class="com.test.model.User" />

D. <jsp:useBean beanName="TestUser" class="com.test.model.User" />

E. <jsp:useBean id="user" type="com.test.model.User" />

31. Which statement is TRUE regarding the following code?

Please select one correct answer.

import javax.servlet.*;

import javax.servlet.http.*;

public class MyHttpServlet extends HttpServlet implements SingleThreadModel {

StringBuffer bufferOne = new StringBuffer(); //1 static StringBuffer bufferTwo = new StringBuffer(); //2 protected void doGet(HttpServletRequest req, //3 HttpServletResponse res) throws java.io.IOException{

HttpSession session = req.getSession(); //4 res.setContentType("text/html");

java.io.PrintWriter out = res.getWriter();

out.println("<html>");

out.println("<head>");

out.println("<title>This is my servlet!</title>");

out.println("</head>");

out.println("<body>");

out.println("</body>");

out.println("</html>");

out.close();

}

A.Variable bufferOne at //1 is NOT thread-safe.

B.Variable bufferTwo at //2 is NOT thread-safe C.Both A and B

D.Variable req at //3 is NOT thread-safe E.Variable session at //4 is NOT thread-safe F.Both D and E

32.Select sample web application file listing with appropriate directory structure Please select two correct answers.

A.

index.html /login.jsp

/images/logo.gif /WEB-INF/web.xml

/WEB-INF/lib/basic.jar /WEB-INF/classes/Test.class B.

/index.html /login.jsp

/images/logo.gif /WEB-INF/web.xml

/WEB-INF/jar/basic.jar /WEB-INF/classes/Test.class C.

/index.html /login.jsp

/images/logo.gif /WEB-INF/web.xml

/WEB-INF/classes/basic.jar /WEB-INF/classes/Test.class D.

/index.html /login.jsp

/images/logo.gif /META-INF/web.xml

/WEB-INF/jar/basic.jar

33. Which of the following data element will definitely be thread-safe?

Please select one correct answer A. Local variables

B. Instance variables C. Static variables D. Class variables E. Context attributes

34. Select the correct order that JSP methods are invoked by servlet container Please select one correct answer.

A. jspInit(), jspService(), jspDestroy() B. jspInit(), _jspService(), jspDestroy() C. _jspInit(), jspService(), _jspDestroy() D. _jspInit(), _jspService(), _jspDestroy()

35. Which of the following element is not included in a URL?

Please select one correct answer A. Client ip

B.Protocol C.Server Name D.Query string E.Port name

36. Which of the following listeners is notified when a session is initialized?

Please select one correct answer.

A. HttpSessionBindingListener B. SessionBindingListener C. HttpSessionListener D. HttpSessionListener

E. HttpSessionChangedListener

37. Which of the following best describes the life cycle of a JSP?

Please select one correct answer.

A.

JSP page is translated into a servlet code Servlet code is compiled

Servlet is loaded into memory Servlet instance is created B.

JSP page is translated into a servlet code Servlet is loaded into memory

Servlet code is compiled Servlet instance is created C.

JSP is compiled

JSP is translated into a servlet code Servlet is loaded into memory

Servlet instance is created D.

JSP is loaded into memory Servlet code is compiled Servlet instance is created Servlet is loaded into memory E.

JSP page is translated into a servlet code Servlet code is compiled

Servlet instance is created Servlet is loaded into memory

38. Please identify the three methods declared in javax.servlet.Filter Please select three correct answers.

A.service B.init C.destroy D.filter E.doFilter

39.Which of the following deployment descriptor segments are VALID for security-related configuration of a web application?

Please select two correct answers.

A.

<login-config>

<auth-method>FORM</auth-method>

<login-config>

<form-login-page>/login.jsp</form-login-page>

<form-error-page>/error.jsp</form-error-page>

</login-config>

</login-config>

B.

<security-role>

<description>My description.</description>

<role-name>Manager</role-name>

</security-role>

C.

<security-constraint>

<web-resource-collection>

<web-resource-name>SecureStuff</web-resource-name>

<url-mapping>/servlet/secure</url-mapping>

<http-method>POST</http-method>

</web-resource-collection>

</security-constraint>

D.

<security-constraint>

<auth-constraint>

<role-name>Broker</role-name>

</auth-constraint>

</security-constraint>

E.

<security-constraint>

<web-resource-collection>

<web-resource-name>SecureStuff</web-resource-name>

</web-resource-collection>

<auth-constraint>

<role-name>Broker</role-name>

</auth-constraint>

</security-constraint>

40.Based on the following information, please construct the full path for the servlet.

Please select one correct answer docbase = c:/temp/

context path = /test

alias name = MyMail

servlet-name = com.jiris.common.util.MailServlet url-pattern = /mail/*

A.c:/temp/mail/com/jiris/common/util/MailServlet.class B.c:/temp/test/com/jiris/common/util/MailServlet.class C.c:/temp/mail/test/com/jiris/common/util/MailServlet.class D.c:/temp/test/mail/com/jiris/common/util/MailServlet.class

41.The ServletContext object are accessible from which of the following objects?

Please select three correct answers.

A.HttpServlet B.GenericServlet C.HttpSession D.ServletConfig E.ServletResponse

42.Which of the following method is used to store object into a request object?

Please select one correct answer

A. addAttribute(String name, String obj) B. putAttribute(String name, Object obj) C. setAttribute(String name, String obj) D. setAttribute(String name, Object obj) E. addObject(String name, Object obj)

43. Which request method will be invoked for the following code?

Please select one correct answer.

,code>

44.Which of the following method might be invoked more than one time?

Please select one correct answer A.doStartTag()

B.doInitBody() C.doAfterBody() D.doEndTag()

45.Which of the following methods are used to send an error page to the client?

Please select two correct answers A.log(String msg)

B.log(String msg, Throwable t) C.sendError(int code)

D.sendError(int code, String msg)

E.sendError(int code, String msg, Throwable t)

46.Which of the following requests should be performed by using a POST method?

Please select two corretion.

A.Inserting a record into a database B.Accessing a static page

C.Retrieving an image

D.Sending credit card number E.Searching record in a database

47.Which of the following are CORRECT ways to define inactive period of 5 minutes of a session before the server invalidates it?

Please select two correct answers

A.<session-timeout>5</session-timeout>

B.<session-timeout>300</session-timeout>

C.session.setMaxInactiveInterval(5);

D.session.setMaxInactiveInterval(300);

E.session.invalidate(5);

48.Which are the two mandatory attributes for JSP taglib directive?

Please select two correct answers.

A.uri B.id C.name D.prefix E.value F.location

49.A session can be invalidated by which of the following:

Please select three correct answers

A.After a default period of inactivity, say 30 minutes B.Client side user closes the browser

C.After a specified period of inactivity, say 10 minutes D.Client side user machine crashes

E.Explicitly invalidate a session through method calls

50.What is the method declaration for the method used in the HttpServlet class that handles the HTTP GET request?

Please select one correct answer

A.doGet(ServletRequest req, ServletResponse res) B.getPage(ServletRequest req, ServletResponse res) C.doGet(HttpServletRequest req, HttpServletResponse res) D.service(HttpServletRequest req, HttpServletResponse res)

In document Cine, Ciencia y Arte 1 (página 34-40)