File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes solutions to multiple q, i attentd a test and want to coform the solutions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "solutions to multiple q, i attentd a test and want to coform the solutions " Watch "solutions to multiple q, i attentd a test and want to coform the solutions " New topic

solutions to multiple q, i attentd a test and want to coform the solutions

shailendra shrivastava

Joined: Nov 16, 2004
Posts: 5
In the init(ServletConfig) method of Servlet life cycle, what method can be used to access the ServletConfig object ?
(a) getServletInfo()
(b) getInitParameters()
(c) getServletConfig()
ANS: ()

2......The Page directive in JSP is defined as follows:
<%@ page language="java" session="false" isErrorPage="false" %>
Then which of the implicit objects won't be available ?
(a) session, request
(b) exception, request
(c) exception, config
(d) session, exception
ANS: I think answer is (d)
ejbCreate() method of CMP bean returns
(a) null
(b) Primary Key class
(c) Home Object
(d) Remote Object
ANS: (a)
Explanation: ejbCreate() method of BMP bean returns the Primary Key, where as ejbCreate() method of CMP bean returns null.
How can a EJB pass it's reference to another EJB ?
5....Which of the following is correct syntax for an Abstract class ?
(a) abstract double area() { }
(b) abstract double area()
(c) abstract double area();
(d) abstract double area(); { }
ANS: (c)
A JSP page is opened in a particular Session. A button is present in that JSP page onclick of which a new Window gets opened.
(a) The Session is not valid in the new Window
(b) The Session is valid in the new Window
ANS: I think the answer is (b)
Which of the following JSP expressions are valid ?
(a) <%= "Sorry"+"for the"+"break" %>
(b) <%= "Sorry"+"for the"+"break"; %>
(c) <%= "Sorry" %>
(d) <%= "Sorry"; %>
A class can be converted to a thread by implementing the interface __________
(a) Thread
(b) Runnable
ANS: (b)
What is the output of following block of program ?
boolean var = false;
if(var = true) {
} else {

(a) TRUE
(c) Compilation Error
(d) Run-time Error
ANS: ()
EXPLANATION: The code compiles and runs fine and the 'if' test succeeds because 'var' is set to 'true' (rather than tested for 'true') in the 'if' argument.
10...Which is not allowed in EJB programming ?
(a) Thread Management
(b) Transient Fields
(c) Listening on a Socket
11.What happens if Database Updation code is written in ejbPassivate() method and if this method is called ?
(a) Exception is thrown
(b) Successfully executes the Database Updation code
(c) Compilation error occurs indicating that Database Updation code should not be written in ejbPassivate()
(d) ejbStore() method is called
12...A Vector is declared as follows. What happens if the code tried to add 6 th element to this Vector
new vector(5,10)
(a) The element will be successfully added
(b) ArrayIndexOutOfBounds Exception
(c) The Vector allocates space to accommodate up to 15 elements
ANS: (a) and (c)
EXPLANATION: The 1 st argument in the constructor is the initial size of Vector and the 2 nd argument in the constructor is the growth in size (for each allocation)
This Vector is created with 5 elements and when an extra element (6 th one) is tried to be added, the vector grows in size by 10.
13...Which is the data structure used to store sorted map elements ?
(a) HashSet
(b) Hashmap
(c) Map
(d) TreeMap
ANS: I think the answer is (d)
14.SessionListerner defines following methods
(a) sessionCreated, sessionReplaced
(b) sessionCreated, sessionDestroyed
(c) sessionDestroyed, sessionReplaced
15...Which of the following is true ?
(a) Stateless session beans doesn't preserve any state across method calls
(b) Stateful session beans can be accesses by multiple users at the same time
ANS: (a)
16..Stateful Session beans contain
(a) Home Interface
(b) Remote Interface
(c) Bean Class
(d) All
ANS: (d)
17..What is the Life Cycle of Session bean ?
18..Stateless session bean is instantiated by
(a) newInstance()
(b) create()
19.A servlet implements Single Thread model
public class BasicServlet extends HttpServlet implements SingleThreadModel {

int number = 0;
public void service(HttpServletRequest req, HttpServletResponse res) {
Which is thread safe ?
(a) Only the variable num
(b) Only the HttpServletRequest object req
(c) Both the variable num & the HttpServletRequest object req
20...If you are trying to call an EJB that is timed out, what will happen ?
(a) Exception
(b) It gets executed
21..A method is defined in a class as :
void processUser(int i) { }
If this method is overriden in a sub class,_____
(a) the new method should return int
(b) the new method can return any type of values
(c) the argument list of new method should exactly match that of overriden method
(d) the return type of new method should exactly match that of overriden method
ANS: (c) & (d)
22...In a JSP page, a statement is declared as follows:
<%! String strTemp = request.getParameter("Name"); %>
And below that, an _expression appears as:
<% System.out.println("The Name of person is: "+strTemp); %>
What is the output of this _expression, if this JSP page is invoked in browser using URL : http://localhost:8080/JSP/TrialPage.jsp?Name=Chetana
(Assume that this URL is correct)
(a) The Name of person is: Chetana
(b) The Name of person is:
(c) The Name of person is: null
(d) None
ANS: (a)
23...Without the use of Cartesian product, how many joining conditions are required to join 4 tables ?
(a) 1
(b) 2
(c) 3
(d) 4
24...What is the output of following piece of code ?
int x = 2;
switch (x) {
case 1:System.out.println("1");
case 2:
case 3:System.out.println("3");
case 4:
case 5:System.out.println("5");
(a) No output
(b) 3 and 5
(c) 1, 3 and 5
(d) 3
ANS: ()
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

I think we would prefer your answers or atleast guesses to each question, just in case this is homework. (you say it isn't, but lets do it my way )
We'd be happy to help you confirm answers or give you information to teach you to correct your mistakes, but you won't gain anything if we just give you the answers.

I agree. Here's the link:
subject: solutions to multiple q, i attentd a test and want to coform the solutions
Similar Threads
Test 484 ... LONG POST
To Nikhil Pendharkar for IBM 287
jsp /java i m not able to fine currect solutions
WhizLabs Trial Simulator Questions
Please answer me this question.