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
(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
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
If you are trying to call an EJB that is timed out, what will happen ? (a) Exception (b) It gets executed
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
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
(a)
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
(b)
View page << Previous 1 2 [3]

Go Top