File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Soft Skills this week in the Jobs Discussion 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
Author

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

shailendra shrivastava
Greenhorn

Joined: Nov 16, 2004
Posts: 5
PAPER :
__1_________________________________________________________________
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)
___________________________________________________________________
3..
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.
___________________________________________________________________
4...
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)
___________________________________________________________________
6...........
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)
___________________________________________________________________
7....
Which of the following JSP expressions are valid ?
(a) <%= "Sorry"+"for the"+"break" %>
(b) <%= "Sorry"+"for the"+"break"; %>
(c) <%= "Sorry" %>
(d) <%= "Sorry"; %>
ANS:
___________________________________________________________________
8....
A class can be converted to a thread by implementing the interface __________
(a) Thread
(b) Runnable
ANS: (b)
___________________________________________________________________
9...
What is the output of following block of program ?
boolean var = false;
if(var = true) {
System.out.println("TRUE");
} else {
System.out.println("FALSE");
}

(a) TRUE
(b) FALSE
(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
ANS:
___________________________________________________________________
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
ANS:
___________________________________________________________________
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
ANS:
___________________________________________________________________
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()
ANS:
___________________________________________________________________
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
ANS:
___________________________________________________________________
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
Rancher

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.

Dave
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: solutions to multiple q, i attentd a test and want to coform the solutions