Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

11 most tricky JSP Questions

  Date: Nov 24    Category: Java    Views: 2151
  

Please try and answer the foll questions :
1. Select the correct option
<%!
HashMap users2resource = new HashMap();
%>
<% HashMap people = new HashMap() %>
<% users2resource.put(..) %>
<% int j;
j = j+1; %>
.
.
.
<%= users2resource.get(..) %>
What potential problem, if any, exists for the sample JSP page above?
Choice 1
j = j+1 is not atomic.
Choice 2
The resources put into people will never be garbage collected.
Choice 3
There is no problem.
Choice 4
The users2resource is not thread safe.
Choice 5
The people is not thread safe

2.A banking application has been written that stores current context in a
Session-level bean. The typical data stored in the context is the current
user name and current account being viewed.
Referring to the above scenario, what defect does this application
suffer from because of how it is using the Session-level bean?

Choice 1
Storing information in this way may open a security hole that allows
hackers to retrieve user information very easily.

Choice 2
Storing this information on the Web Server is likely to increase the
burden on the Web Server, damaging performance.

Choice 3
Use of a Web browser's Back button could cause operations to be carried
out against the wrong account.

Choice 4
If the user does not log out, then the information stored in the context
will remain in the Web Server until the user next logs on.

Choice 5
The information concerning the account the customer is viewing because
the account number is not stored in the Request-level bean.

3.How do you place the text <% and %> in a JSP such that neither was
recognized as a scriptlet bracket?
Choice 1
<\% and \%>
Choice 2
<\\% and \\%>
Choice 3
<%% and %%>
Choice 4
<\% and %\>
Choice 5
\<\% and \%\>

4. How many javax.servlet.ServletContext objects can typically exist
within a single Java virtual machine that hosts four different domains?
Choice 1
One for each JSP page in every domain
Choice 2
One for each Web Server within every domain
Choice 3
One for each Java virtual machine
Choice 4
One for each different domain
Choice 5
One for each web application deployed in each domain

5.
When a custom tag implements the BodyTag Interface, how does the JSP
Engine handle nested tags?
Choice 1
It is the responsibility of the nested tag to pass information to its
parent tag.
Choice 2
JSP does not support nested tags.
Choice 3
The contents of the nested tags are sent to the browser in a depth first
traversal of the nested hierarchy.
Choice 4
The output of a nested tag is sent to a buffer that the parent tag can
see.
Choice 5
The contents of the nested tags are sent to the browser in a breadth
first traversal of the nested hierarchy.

6.
Which one of the following methods sends the HTTP HEADER values to the
client browser WITHOUT stopping the JSP page?
Choice 1
response.sendheaders()
Choice 2
out.flush()
Choice 3
response.flushheaders()
Choice 4
out.close()
Choice 5
response.release()

7.A security policy domain is a scope over which security policies are
defined and enforced by a security administrator.
Based on the information above, which one of the following is NOT a
characteristic of a security policy domain upon which a JSP can run?
Choice 1
The security policy may have groups to simplify setting of security
policies.
Choice 2
The security policy uses a well-defined authentication protocol(s) for
authenticating users.
Choice 3
The security policy has a collection of users or principals.
Choice 4
The security policy ensures that multiple security policy domains can
exist within a single technology domain.
Choice 5
The security policy contains an object that encapsulates single state
information between two entities.

8.
Your JSP file compiles just fine; however, you always get a
NoClassDefFoundError when you try to access a bean via the useBean tag.
All of the required files have been included on the CLASSPATH and exist on
the Web Server.
Why does the above problem occur?
Choice 1
The useBean tag has not been defined from within the script.
Choice 2
Your beans do not belong to the package.
Choice 3
The client browser is not using Java 1.1.1.
Choice 4
All of the .class files have not been sent to the Web Server.
Choice 5
You are using API 2.1 instead of API 2.2.

10.
A Web Application written using JSP pages makes use of Wizard-style
walkthroughs to aid users whenever they make complicated changes. A change
to the ordering of each JSP page in the Wizard takes over 3 hours to
complete. This is unacceptable for such a trivial and common operation.
Given the above scenario, what is a possible approach for reducing the
time taken to change the ordering of pages?
Choice 1
Implement the JSP pages with more embedded scriptlets designed to make
page ordering easier to change.
Choice 2
Implement the JSP pages using a templating scheme.
Choice 3
Implement the JSP pages using a Model 1 architecture.
Choice 4
Do not share JSP pages between Wizards.
Choice 5
Use a Servlet to abstract the difference between page control and page
visualization.

11.
A JSP page is compiled into a Servlet; therefore, it can do everything
that a Servlet can do.
If the above statement is TRUE, then why is an IllegalStateException
thrown when opening a Binary Stream output to the client from a JSP page
but NOT to a Servlet?
Choice 1
JSP pages can write a Binary Stream using its implicit out stream.
Choice 2
JSP pages use a different Streaming mechanism to Servlets.
Choice 3
JSP pages have more security settings than Servlets.
Choice 4
JSP has already opened the stream as a JspWriter.
Choice 5
JSP pages must flush their buffers before changing the stream type;
Servlets do not have this limitation.

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on 11 most tricky JSP Questions Or get search suggestion and latest updates.




Tagged: