Select chapter



basics (7.papers)
constructors (1.papers)
packages (1.papers)
inheritance (7.papers)
misc (3.papers)
exceptions (5.papers)
threads (4.papers)
overloading (1.papers)
jsp (3.papers)
servlets (9.papers)
jdbc (2.papers)
util (1.papers)
xml (2.papers)
IO stream (3.papers)
Hide

Sponsored Links


  

java interview questions and answers

Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
3
A bean named fruit has been created in the session. The JSP page used  <jsp:useBean id="rose" class="Flower" scope="session"/>  Which of the following statement can be used to print the value of color property of the bean.
  1. <jsp:getColor bean="rose"/>
  2. <jsp:getProperty id="rose" property="color"/>
  3. <jsp:getProperty bean="rose" property="color"/>
  4. <jsp:getProperty name="rose" property="color"/>
Show Answer
Share Facebook gmail Twitter
4
You are testing a JSP code. There is a line
<jsp:forward page="pass.jsp"></jsp:forward>
 code and currently you don’t want this statement to be executed. How can you achieve this without removing this statement?
  1. Comment this line as : <!--<jsp:forward page="pass.jsp"></jsp:forward> --
  2. Comments this line as : //<jsp:forward page="pass.jsp"></jsp:forward> 
  3. Comments this line as : /*<jsp:forward page="pass.jsp"></jsp:forward> */
  4. <%--<jsp:forward page="pass.jsp"></jsp:forward> --%>
Show Answer
Share Facebook gmail Twitter
5
Consider the following JSP code:<%! String x="abc"; %> 
<% 
String y=x.toUpperCase();
<%=y>
%>
Will this code display ABC in the page?
  1. No, but if <%=x> is replaced by System.out.println(<%=y>);  it will print ABC  in the page
  2. No, but <%=x> is replaced by System.out.println(y); , it will print ABC in the page
  3. if <%=y> is placed outside <% and %> it will print ABC  in the page
  4. Yes it will print ABC  in the page
Show Answer
Share Facebook gmail Twitter
6
A page is requested using the URL http://localhost:8080/register.jsp?name="Mary". How can the name parameter be obtained in the JSP page?
  1. <%=request.getParameter()>
  2. <%=request.getParameter("name") %>
  3. <%=getRequest().getParameter("name") %>
  4. none of the baove
Show Answer
Share Facebook gmail Twitter
7
A JSP code has the following 
<%!java.util.Date d= new java.util.Date();%> 
<%=d %>
Which of the following is true?
  1. The page will display the current dateand time of the server every time it is requested after it has been uploaded
  2. The page will display the current date and time of the client every time it is requested after it has been uploaded
  3. The page will display the same date and time every time it is requested after it has been uploaded
  4. The page will throw an error at runtime
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
10
A common header and footer has to be imported to all pages. Which of the following is  most appropriate for this?
  1. include directive
  2. include method of RequestDispatcher
  3. forward method of RequestDispatcher
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
12
Which of the following should be added in JSP to use ArrayList without its fully qualified name?
  1. Add "<%@ page language="Java" import=“java.util.ArrayList" %>" in the page
  2. Add "<% page language='Java' import=“java.util.*" %>" in the page
  3. Add "<%@ page language="Java" include=“java.util.ArrayList" %>" in the page
  4. Add "<% page language="Java" include=“java.util.ArrayList" %>" in the page
Show Answer
Share Facebook gmail Twitter
13
Which of the following is the correct way to import multiple package using page directive?
  1. %@page import=java.util.*; java.lang.*%
  2. %@page import="java.util.*, java.lang.*"%
  3. <%@page import="java.util.*" import="java.lang.*"%>
  4. <%@page import="java.util.* & java.lang.*"%>
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
17
Which of the following is correct way to initialize and print the value of i?
  1. <%int i = 1;%> <%= i; %>
  2. <%int i = 1; i; %>
  3. <%int i = 1%> <%= i %>
  4. <%int i = 1;%> <%= i %>
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
19
Which of the following in tld ensures there is no body of the custom tag ?
  1. <body-content>empty</body-content>
  2. <body-content>null</body-content>
  3. <body-content/>
  4. <body-content>none</body-content>
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Read more papers :