1/394
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
_____ provides a way to identify a user across more than one page request or visit to a Web site and to store information about that user.
Select one:
a. Cookie
b. Hidden Field
c. Session management
d. URL Rewrite
c
Which of the following directories are legal locations for the deployment descriptor file? Note that all paths are shown as from the root of the machine or drive.
Select one:
a. /WEB-INF
b. /WEB-INF/xml
c. /WEB-INF/classes
d. None of others
a
Name the default value of the scope attribute of
A. request
B. page
C. application
D. session
B
The web.xml file for a webapp contains the following XML fragment for configuring session timeout.
What would be the session timeout interval for the sessions created in this web application?
A. 300 seconds
B. 300 hours
C. 300 minutes
D. 300 milliseconds
C
The following line of code exists in the doGet method of Servlet:
String sid = request.getParameter("jsessionid");
Which of the option is NOT a standard technique for retrieving the HttpSession associated with the request?
A. HttpSession session = request.getSession(true);
B. HttpSession session = request.getSession(false);
C. HttpSession session = request.getSession();
D. HttpSession session = request. getSession(sid);
D
Consider the following taglibrary descriptor element:
Which of the following is NOT a valid value for
A. generic
B. empty
C. JSP
A
The HttpServletRequest has methods by which you can find out about incoming information such as:
A. form data
B. the client's hostname
C. cookies
D. HTTP request headers
E. All of the others
E
Which of the following statement is correct?
A. Authentication means determining whether one has access to a particular resource or not.
B. Data Integrity means that the data cannot be viewed by anybody other than it's intended recepient.
C. Data Integrity means that the data is not modified in transit between the sender and the receiver.
C
Which method of LoginServlet will be called when the user clicks on "Submit" button for the following form.
A. servicePost(HttpServletRequest, HttpServletResponse);
B. doPost(HttpSevletRequest, HttpServletResponse);
C. doPOST(HttpServletRequest, HttpServletResponse);
D. post(HttpServletRequest, HttpServletResponse);
E. doPUT(HttpServletRequest, HttpServletResponse);
B
... is the well-known host name that refers to your own computer.
A. localhost
B. ip
C. DNS
D. computer name
A
Which of the following elements defines the properties of an attribute that a tag needs?
A. attribute
B. tag-attribute-type
C. attribute-type
D. tag-attribute
A
Which interface and method should be used to retrieve a servlet initialization parameter value?
A. ServletConfig: getInitParameter(String name)
B. ServletConfig: getParameter(String name)
C. ServletConfig: getInitParameterNames(String name)
D. SevletContext: getInitParameter(String name)
A
Which of the given jsp statement is equivalent to:
A.
B.
C.
D.
D
Which of the following is NOT a valid attribute for a useBean tag?
A. className
B. beanName
C. scope
A
You need to make sure that the response stream of your web application is secure. Which factor will you look at?
A. authorization
B. authentication
C. data integrity
C
Which is NOT a standard technique for a session be definitely invalidated?
A. The container is shutdown and brought up again.
B. No request comes from the client for more than "session timeout" period.
C. If the session time out is set to 0 using setMaxInactiveInterval() method.
D. A servlet explicitly calls invalidate() on a session object.
C
Which statements are BEST describe include directive of JSP file?
A. Allows programmers to include their own new tags in the form of tag libraries. These libraries can be used to encapsulate functionality and simplify the coding of a JSP.
B. The scripting language used in the JSP. Currently, the only valid for this attribute is java.
C. Causes the JSP container to perform a translation-time insertion of another resource's content. As the JSP is translated into a servlet and compiled, the referenced file replaces the include directive and is translated as if it were original part of the JSP.
D. Defines page setting for the JSP container to process.
C
A JSP page uses the java.util.ArrayList class many times. Instead of referring the class by its complete package name each time, we want to just use ArrayList. Which attribute of page directive must be specified to achieve this.
A. extends
B. import
C. include
D. package
E. classpath
B
Browsers typically cache the server's response to a POST request.
A. True
B. False
B
Which security mechanism limits access to the availability of resources to permitted groups of users or programs?
A. MD5 encryption
B. Authentication
C. Data integrity
D. Authorization
E. Confidentiality
F. Checksum validation
D
The two most common HTTP requests are get and put.
A. False
B. True
A
Identify correct statement about a WAR file:
A. It is used by web application developer to deliver the web application in a single unit
B. It cannot be unpackaged by the container
C. It is an XML document
D. It contains web components such as servlets as well as EJBs
E. It cannot contain third party jar and class files.
D
Your web application logs a user in when she supplies username/password. At that time a session is created for the user. Your want to let the user to be logged in only for 20 minutes. The application should redirect the user to the login page upon any request after 20 minutes of activity. Which of the following HttpSession methods would be helpful to you for implementing this functionality?
A. getCreationTime()
B. getLastAccessedTime()
C. getMaxInactiveInterval()
D. getLastAccessTime()
B
Which statements are BEST describe page attribute of
A. Dynamically includes another resource in a JSP. As the JSP executes, the referenced resource is included and processed
B. Forwards request processing to another JSP, servlet or static page. This action terminates the current JSP's execution
C. Specifies the relative URI path of the resource to include. The resource must be part of the same Web application
D. Specifies that the JSP uses a JavaBean instance. This action specifies the scope of the bean and assigns it an ID that scripting components can use to manipulate the bean
A
Select the correct directive statement insert into the first line of following lines of code:
1 Insert code here
Today's Date is
A.
B.
C.
D.
B
Which of the following statements are correct about HTTP Basic authentication mechanism?
A. HTML FORM is used to capture username and password
B. Password is transmitted either in encrypted text or in plain text depending on the browser
C. Password is transmitted in an encrypted form
D. Password is transmitted as text
D
Which of the following statement is correct?
A. Authentication means determining whether one has access to a particular resource or not
B. Confidentiality and Authorization are one and the same thing
C. Authentication means proving whether one is what one claims to be
C
Which statements are BEST describe errorPage attribute of
A. Specifies the MIME type of the data in the response to the client. The default type is text/html.
B. Specifies the class from which the translated SP will be inherited. This attribute must be a fully qualified package and class name.
C. Any exceptions in the current page that are not caught are sent to the error page for processing. The error page implicit object exception references the original exception.
D. Specifies if the current page is an error page that will be invoked in response to an error on another page. If the attribute value is true, the implicit object exception is created and references the original exception that occurred.
C
In which of the following cases will the method doEndTag() of a tag handler be invoked?
A. It will be invoked only if doStartTag() or doAfterBody() return Tag.DO_END_TAG
B. It will be invoked only if doStartTag() and doAfterBody() complete successfully
C. This method is invoked if doStartTag() method returns true
D. It will be invoked in all case even if doStartTag() or doAfterBody() throw an exception
A
The path in a URL typically specifies a resource's exact location on the server
A. False
B. True
B
Which of the following classes define the methods setStatus(...) and sendError(...) used to send an HTTP error back to the browser?
A. Both are defined in HttpServletResponse
B. Both are defined in ServletRequest
C. Both are defined in ServletResponse
D. Both are defined in HttpServletRequest
A
A Java bean with a property color is loaded using the following statement
What is the effect of the following statement.
Select one correct answer.
A. An error gets generated because the value attribute of setAttribute is not defined
B. The color attribute is assigned a value null
C. The color attribute is assigned a value ""
D. If there is a non-null request parameter with name color, then its value gets assigned to color property of Java Bean fruit
D
Which of the following file is the correct name and location of deployment descriptor of a web application? Assume that the web application is rooted at \doc-root.
A. \doc-root\dd.xml
B. \doc-root\web.xml
C. \doc-root\WEB-INF\web.xml
D. \doc-root\WEB_INF\dd.xml
E. \doc-root\WEB-INF\dd.xml
F. \doc-root\WEB_INF\web.xml
C
Given the following JSP and tag handler code, what is the result of accessing the JSP?
START
END
Tag Handler Code for
package examples;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
public class TestTag extends TagSupport {
@Override
public int doStartTag() throws JspException {
return EVAL_PAGE;
}
@Override
public int doEndTag() throws JspException {
return SKIP_PAGE;
}
}
Assume *.tld and web.xml files are correct
A. START
B. START
END
C. END
START
D. END
A
Which directory is legal location for the deployment descriptor file? Note that all paths are shown as from the root of the web application directory
A. \WEB-INF
B. \WEB-INF\xml
C. \WEB-INF\classes
A
Your jsp page uses java.util.TreeMap. Adding which of the following statement will ensure that this class is available to the page?
A.
B.
C.
D.
A
A bean present in the page and identified as 'mybean' has a property named 'name'. Which of the following is a correct way to print the value of this property?
A.
B.
C.
D.
C
Which of these is true about include directive?
A. The included file must have jsp extension.
B. The XML syntax of include directive in
C. The content of file included using include directive, cannot refer to variables local to the original page.
D. When using the include directive, the JSP container treats the file to be included as if it was part of the original file.
D
Identify the method used to get an object available in a session.
A. getValue of Session
B. getValue of HttpSession
C. getAttribute of Session
D. getAttribute of HttpSession
D
A JSP file uses a tag as
A. tagname
B. name
C. tag
D. prefix
B
What gets printed when the following JSP code is invoked in a browser?
hello
hi
A. The browser will print either hello or hi based upon the return value of random.
B. The string hello will always get printed.
C. The string hi will always get printed.
D. The JSP file will not compile.
D
Which of the following is a properly formatted taglib element occurring in web.xml?
A.
B.
C.
D.
B
The
A. True
B. False
A
What is the output of the following code snippet of a JSP page?
${empty "")
${empty "sometext"}
A. true
false
B. false
true
C. false
D. true
A
Session death is more likely to come about through a time-out mechanism. If there is no activity on a session for a predefined length of time, the web container invalidates the session.
A. False
B. True
B
What should be the value of
A. null
B. false
C. empty
D. blank
C
Study the statements:
1) Every web application within a web container has a unique context path
2) The context path and any directories you choose to create within it contain resources that are accessible through HTTP
A. Only statement 1 is true
B. Only statement 2 is true
C. Both 1 and 2 are true
D. Both 1 and 2 are false
C
Servlets usually are used on the client side of a networking application.
A. False
B. True
A
Which are the correct lines of code to get information in the following
A. request.getParameter("machineName");
B. ServletContext sc = getServletContext();
String serverName = sc.getInitParameter("machineName");
C. ServletConfig sc = getServletConfig().
String serverName = sc.getInitParameter("machineName");
D. response.getParameter("machineName");
B
Which jsp tag can be used to set bean property?
A. jsp:useBean.setProperty
B. jsp:useBean.property
C. jsp:setProperty
D. jsp:property
E. jsp:useBean
C
Which of the following are correct JSP expressions?
A.
B.
C.
D.
C
Your web application named "FWorks" uses SpecialMath.class. This is an unbundled class and is not contained in any jar file.
Where will you keep this class file?
A. FWorks/WEB-INF/classes
B. FWorks/classes
C. FWorks/WEB-INF
D. FWorks/WEB-INF/lib/classes
A
You need to modify the deployment descriptor for a web application installed in MyWebApp directory. Which file would you look for?
A. MyWebApp.xml MyWebApp
B. web.xml in MyWebApp
C. MyWebApp.xml in MyWebApp/WEB-INF
D. web.xml in MyWebApp/WEB-INF
D
Login ID:
Password:
Study the above html code. Assume that user clicks button Reset.
What is the correct statement?
A. All inputs are cleared.
B. Nothing changes.
A
The deployment descriptor of a web application must have the name web.xml. In the same way the tag librapy descriptor file must be called taglib.xml
A. True
B. False
B
A JavaBeans component has the following field.
private boolean enabled
Which pairs of method declarations follow the JavaBeans standard for accessing this field?
A. public boolean setEnabled( boolean enabled)
public boolean getEnabled()
B. public void setEnabled(boolean enabled)
public boolean getEnabled()
C. public Boolean setEnabled( boolean enabled)
public boolean isEnabled()
D. public void setEnabled( boolean enabled)
public void isEnabled()
B
Which is NOT a scope of implicit objects of JSP file?
A. application
B. session
C. page
D. request
E. response
E
JSP ____ let you inserts arbitrary code into servlet's jspService method (which is called by service)
A. declarations
B. scriptlets
C. expressions
B
(Choose 1 answer)
Study the statements:
1) The context path contains a special directopy called WEB-INF which contains the deployment descriptor file web.xml
2) A client application may directly access resources in WEB-INF or Its subdirectones through HTTP_
A. Both 1 and 2 are true
B. Only statement 1 is true
C. Only statement 2 is true
D. Both 1 and 2 are not true
B
You can set a page to be an error page either through web.xml or by adding a page directive
A.
B.
C.
B
When implementing a tag, if the tag does not include the body, then the tag handler class must extend the BodyTagSupport class.
Is this statement true of false?
A. True
B. False
B
Which of the following XML fragments correctly specify the class name for a servlet in a deployment descriptor of a webapp?
A.
B.
C.
D.
A
Complete the statement:
A. specify the mapping of the name and the TLD file for a tag library
B. specify the parameters needed by a tag library
C. specify a URI identifying a tag library
A
Which of these is legal attribute of page directive?
A. include
B. scope
C. errorPage
D. debug
C
_________ includes a static file in a JSP file, parsing the file's JSP elements.
A.
B.
C. import directive
D.
E. include directive
E
Consider the HTML code below. Which of the following method calls can retrieve the "email" value sent from the browser? (Choose one)
A. getFormValue("email") of HttpServletRequest
B. getParameters("email") of HttpServlet
C. getParameter("email") of ServletRequest
D. getField("email") of HttpServletRequest
C
A bean with a property color is loaded using the following statement
Which statement may be used to set the color property of the bean. A. B. C. D. E. F.
E
Which of the following implicit variables should be used by a jsp page to access a resource and to foward a request to another jsp page?(Choose one)
A pageContext and config
B config and pageContext
C application for both
D config for both.
A
How can you ensure the continuity of the session while using HttpServletResponse.sendRedirect() method when cookies are not supported by the client?
A By using hidden parameters.
B By using HttpServletRequest.encodeURL() method.
C By enconding the redirect path with HttpServletResponse.encodeRedirectURL() method
D HttpServletResponse.encodeRedirectURL() method
C
In which of the following case will the method doStartTag() of a tag handler be invoked?
A. If doEndTag() returns EVAL TAG AGAIN
B. This method is invoked if doTag() method returns true.
C. It will be invoked only If the use of that tag is not enclosed in another custom tag.
D. This method is invoked if doTag() method returns DO START
E. This method is always invoked whenever the tag's use is encountered in the jsp page.
E
Identify the parent element of
A.
B.
C.
D.
C
Which of the following defines the type of the content that a tag can accept?
A. content-type
B. body-content
C. content
D. tag-content-type
B
Host names are translated into IP addresses by web servers.
A. False
B. True
A
Which of these is a correct fragment within the web-app element of deployment descriptor
A.
B.
C.
B
Which technology is used for processing HTTP requests and mapping those requests to business objects
A. EJB
B. JMS
C. Servlets
D. MOM (Message-Oriented Middleware Product)
C
(Choose 1 answer)
Which of the statements regarding the following code are correct?
public void doPost(HttpServletRequest req. HttpServletResponse res) throws lOException. ServletException {
res.getWriter().print("Hello");
RequestDispatcher rd = getServletContext().getRequestDispatcher("test.jsp");
rd.include(req, res);
res.getWriter().print("World"):
}
A. Only "World" will be a part of the output
B. Neither will be a part of the output
C. Only "Hello" will be a part of the output
D. "Hello" and "World" both will be a part of the output
D
Identify the correct element is required for a valid
A.
B.
C.
D.
E.
A
Which of the following statements is correct? Select the one correct answer.
A. The response from the server to a GET request does not contain a document
B. The setStatus method defined in the HttpServletRequest class takes an int as an argument and sets the status of Http response
C. The response from the server to a HEAD request consists of status line, content type and the document
D. The HttpServletResponse defines constants like SC_NOT_FOUND that may be used as a parameter to setStatus method.
D
Which is NOT associated with the business tier in a JEE (J2EE) web-based application?
A. Entity Beans
B. JSP
C. Stateless Session Beans
B
Which option can be used to predefine Java Persistence queries for easy use?
A. @NamedNativeQuery annotation
B. @NamedQuery annotation
C. using the named-native-query element in the XML descriptor
B
Which of the following is a sensible way of sending an error page to the client in case of a business exception that extends from java.lang.Exception? (Choose one)
A. Don't do anything, the servlet container will automatically send a default error page.
B. Don't catch the exception and define the 'exception to error-page' mapping in web.xml
C. Catch the exception, wrap it into ServletException and define the 'business exception to error-page' mapping in web.xml
C
Which of the following task may happen in the translation phase of JSP page? (Choose one)
A. Instantiation of the servlet class.
B. Creation of the servlet class corresponding to the JSP file.
C. None of the others
D. Execution of JspServiceQ method.
B
A JSP page has the following page directives:
Which of the following implicit object is NOT available to the jsp page?
A. session
B. response
C. application
D. exception
D
Which security mechanism proves that data has not been tampered with during its transit through the network?
A. Packet sniffing
B. Data integrity
C. Data validation
D. Authentication
E. Data privacy
F. Authorization
B
What would be the best directory in which to store a supporting JAR file for a web application? Note that in the list below, all directories begin from the context root
A. \WEB-INF\lib
B. \jars
C. \WEB-INF
D. \WEB-INF\classes
A
A parameter is defined in a
A. It is accessible only to the servlet it is defined for.
B. It is accessible to all the servlets of all the webapps of the container.
C. It is accessible to all the servlets of the webapp.
C
Which is NOT a core component of JSP?
A. actions
B. name of a jsp file
C. tag libraries
D. scriptlets
E. directives
D
Which of the following methods can be used to add cookies to a servlet response?
A. HttpServletResponse.addCookie(Cookie cookie)
B. ServletResponse.addCookie(Cookie cookie)
C. ServletResponse.addCookie(String contents)
D. HttpServletResponse.addCookie(String contents)
E. ServletResponse.addHeader(String name. String value)
A
A Java developer needs to be able to send email, containing XML attachments, using SMTP. Which JEE (J2EE) technology provides this capability?
A. Servlet
B. JSP
C. EJB
D. JavaMail
D
Which is NOT a correct statement about entity beans?
A. They are used to share data among clients
B. They are used to store persistent data
C. They are used to represent data stored in a RDBMS
D. They are used to implement business processes
D
A JSP _____ lets you define methods or fields that get inserted into the main body of the servlet class (outside of the JspService method that is called by service to process the request).
A. expression
B. scriptlet
c. declaration
C
You have to send a pdf file to the client as a response to a request. Which of the following calls will you have to make? (Choose one)
A. response.setType("application/pdf");
B. response.setContentType("image/pdf");
C. response.setContentType("application/pdf");
D. response.setType("image/pdf);
C
Identify the technique that can be used to implement 'sessions' if the client browser does not support cookies.(Choose one)
A. It cannot be done without cookie support
B. Using Http headers.
C. URL Writing
D. Hidden form fields.
D
Consider the following java code:
//in file Book.java
package com.bookstore;
public class Book {
private long isbn;
public BookO{ isbn = 0;}
public long getlsbn(){ return isbn;}
public void setlsbn(long value){ this.isbn = value;}
}
Code for browse.jsp:
LINE 1:
Which of the following statements are correct?
A. The isbn property of new book will be set to 1000 if nbsp;nbsp;'value' attribute of 'setProperty' tag is given as: value=1000
B. The isbn property of newbook will be set to 1000.
C. It will not compile.
B
Which statements are BEST describe class attribute of
A. The name of a bean that can be used with method instantiate of class java.beans.Beans to load a JavaBean into memory.
B. The fully qualified class name of the Java object
C. The name used to manipulate the Java object with actions
D. The type of the JavaBean. This can be the same type as the class attribute, a superclass of that type or an interface implemented by that type. The default value is the same as for attribute class.
B
Study the statements:
1) The special directory /WEB-INF/lib contains Java class files—servlets and supporting code.
2) The special directory /WEB-INF/classes contains JAR files with supporting libraries of code.
A. Only statement 1 is true
B. Only statement 2 is true
C. Both 1 and 2 are true
D. Both 1 and 2 are not true
D
What is the consequence of attempting to access the following JSP page?
A
Given that a servlet has been mapped to /account/*.
Identity the HttpServletRequest methods that will return the /myapp segement for the URL: /myapp/account/*.
A. getPathInfo
B. getServletPath
C. getContextPath
C
Which of the following are potential legal of JSP source ? (choose 2)
A.
B.
C.
D.
E.
B C
Name the class that includes the SetSession method that is used to get the HttpSession object
A. HttpSevletRequest
B. HttpSevletResponse
C. SessionContext
D. SessionConfig
A