File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Some Good Objective questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Some Good Objective questions" Watch "Some Good Objective questions" New topic

Some Good Objective questions

Dean Jones

Joined: Jun 18, 2002
Posts: 24
I came across these ques. during a mock test , can any one of u there tell me the solutions to these problems with proper reasons in detail
questions are
1)A Proxy design pattern is one where a surrogate or placeholder for an object is used to communicate with an object that is not locally available. Which of the following J2EE technologies use proxies that are visible to a developer?
b) RMI
c) JSP
d) EJB
Multiple Select - Please select all of the correct answers (this question has 2 correct choices).
2)When designing a distributed system, remote access to fine-grained objects should be avoided. Why?
a) Thinner clients are possible with coarse-grained objects.
b) Fine-grained objects result in increased network traffic.
c) Fine-grained objects are hard to develop and maintain.

Multiple Select - Please select all of the correct answers (this question has 2 correct choices).
3)When comparing servlets and JSPs, which of the following are true?
a) JSPs provide better performance than servlets.
b) JSPs may call servlets and servlets may also call JSPs.
c) A JSP must be compiled into a servlet before it can be used.
d) Initialization and destruction behavior is supported in both servlets and JSPs.

Multiple Select - Please select all of the correct answers (this question has 2 correct choices).

Which of the following are true with respect to state management in a web application?

a) Type of database ( DB2 UDB, Oracle, Sybase, or InstantDB )

b) URL Rewriting is an alternative to using cookies.

c) URL Rewriting does not require any client side configuration.

d) HttpSession information is available to JavaScript code in a web page.

Multiple Select - Please select all of the correct answers (this question has 2 correct choices).
Implementing the SingleThreadModel interface :

a) requires all servlet methods be declared as synchronized.

b) guarantees that synchronization problems will never occur.

c) may have a negative impact on performance.

d) prevents multiple HTTP request threads from accessing a single servlet instance concurrently.

Multiple Select - Please select all of the correct answers (this question has 2 correct choices).

Dean Jones
Alex Belt
Ranch Hand

Joined: Jul 12, 2001
Posts: 57
I can't answer Number 1, but I can help you with the others.
2. a and b. Since fine-grained objects store less data than coarse-grained objects, the system will generate more network traffic requesting and send multiple fine-grained objects than it would getting a single coarse-grained object containing the same data. In addition, having the data in a single, or at least fewer coarse grained objects means the client has fewer objects to deal with, allowing for less client code making it 'thinner'.
3. b and c. b is true by virtue of using the RequestDispatcher's forward() method, which allows you to forward requests to another resource, servlet or jsp. c is true because jsp's must be compiled prior to use, and they are compiled into servlet form by the web app server they are deployed on.
4. b and c. Cookies are typically used to maintain the client's session data on the client side. If the client has cookies disabled, the only way to maintain state is by URL rewriting, which customarily contains the session id and other data that would have been contained in the cookie(s).
c is true because URL rewriting is done by the server, not the client, and it can be used regardless of the user's browser configuration.
a is typically false unless the database is also acting as the web server, such as Lotus Domino, and d is false because javascript cannot access session resources without another entity such as an applet or activeX control.
5. c and d. c and d are true because the SingeThreadModel interface causes the servlet engine to make sure that only one thread at a time may access the servlet's service() method, potentially causing delays if the servlet is frequently accessed.
I'd be interested to know the answer to number one. I have my suspicions, but I can't say for sure.
Hope this helps.
sim sim
Ranch Hand

Joined: Jun 05, 2002
Posts: 55
Answers for question 1 are RMI and EJB.
RMI gives stubs (proxies of server object) to the client to communicate with the server.
EJB is based on RMI concepts.
I agree. Here's the link:
subject: Some Good Objective questions
jQuery in Action, 3rd edition