Time remaining
:
:
Test Status
JSPTEST2
Ques 1 :
JSP used for ?
(A) Server Side Programming
(B) Client Side Programming
(C) Both
(D) None of These
Ques 2 :
Consider the following code and select the correct statement about it from the options below.
<%! int aNum = 5%>
The value of aNum is <%= aNum%>
(A) It will not flag any compile-time or runtime errors and will not print anything to the output.
(B) It will print "The value of aNum is 5" to the output.
(C) It will flag a compile-time error because of an incorrect declaration.
(D) It will throw a runtime exception while executing the expression.
Ques 3 :
Which of the following tags can you use to print the value of an expression to the output stream?
(A) <%@ %>
(B) <%! %>
(C) <% %>
(D) <%= %>
Ques 4 :
The following declaration is valid or not?
<%@ page buffer="8kb", session="false" %>
(A) Valid
(B) Invalid
Ques 5 :
The following declaration is valid or not?
<%@ page import="org.pskills.dbconnection.* " %>
<%@ page session="true" %>
<%@ page import="java.text.*" %>
(A) Valid
(B) Invalid
Ques 6 :
The following declaration is valid or not?
<%@ page bgcolor="navy" %>
(A) Valid
(B) Invalid
Ques 7 :
The following declaration is valid or not?
<%@ page buffer="true" %>
(A) Valid
(B) Invalid
Ques 8 :
The following declaration is valid or not?
<%@ Page language='java' %>
(A) Valid
(B) Invalid
Ques 9 :
Which of the following methods is defined by the JSP engine?
(A) jspInit()
(B) _jspService()
(C) _jspService(HttpServletRequest, HttpServletResponse)
(D) jspDestroy()
Ques 10 :
What will be the output of the following code?
<% int x = 5; %>
<%! int x = 10; %>
<%! int y = 50; %>
The value of b multiplied by a is <%= y * x %>
(A) The code will not compile
(B) 30
(C) 250
(D) 500
Ques 11 :
What will be the output of the following code?
<% x = 30; %>
<% int x = 200; %>
<%! int x = 300; %>
x = <%= x %>, <%= this.x %>
(A) x = 200, 30
(B) x = 300, 30
(C) x = 30, 30
(D) x = 200, 200
Ques 12 :
Which of the following exceptions may be thrown by the _jspService() method?
(A) javax.servlet.jsp.JSPException and java.io.IOException
(B) javax.servlet.jsp.JSPException
(C) javax.servlet.ServletException and javax.servlet.jsp.JSPException
(D) javax.servlet.ServletException and java.io.IOException
Ques 13 :
Which are valid and invalid ?
a <%=myObj.m1(); %>
b <% int x=4, y=5; %>
c <%=x=y%>
d <% myObj.m1(); %>
(A) a valid, b,c,and d are invalid
(B) a invalid, b,c adn d are valid
(C) all valid
(D) all invalid
Ques 14 :
What will be the output of following code?
<%@ page language='java' %>
<%
int x = 0;
int incr()
{
return ++x;
}
%>
The value of x is <%=incr()%>
(A) The value of x is 0
(B) The value of x is 1
(C) The value of x is 2
(D) Error in Code.
Ques 15 :
What will be the output of following code?
<% int x = 3; %>
<%! int x = 5; %>
<%! int y = 6; %>
The sum of x and y is <%=x+y%>
(A) The sum of x and y is 11
(B) The sum of x and y is 6
(C) The sum of x and y is 9
(D) The sum of x and y is 3
Ques 16 :
How much implicit object in JSP?
(A) 7
(B) 8
(C) 9
(D) None of These.
Ques 17 :
Which is not a implicit object in JSP?
a) pageContext
b) pageConfig
c) config
d) context
e) page
f) exception
g) Exception
(A) b,d and f
(B) b,d and g
(C) a,c and g
(D) a,b and e
Ques 18 :
What is the term for determining whether a user has access to a particular resource?
(A) Authorization
(B) Authentication
(C) Confidentiality
(D) Secrecy
Ques 19 :
Which is not a valid syntax in JSP?
(A) request.authenticate(response)
(B) request.getAttributes("email")
(C) request.getCookies()
(D) None of These
Ques 20 :
What will be the output of the following code? (Select one)
<html>
<body>
The value is <%=""%>
</body>
</html>
(A) Compilation error
(B) Runtime error
(C) The value is
(D) The value is null
Submit Answer
Don't Refresh the Page !! ...