You are on page 1of 5

User

Which of the following attributes are mandatory in <jsp:useBean /> tag?


Select one:
a. type, class
b. id, type
c. id, class
d. type,property

ChatGPT
The correct option is:
c. id, class

User
Which of the following code is used to get PrintWriter object in servlet?
Select one:
a. None of the above.
b. response.getWriter
c. new PrintWriter
d. request.getWriter
ChatGPT
The correct option is:
b. response.getWriter

User
If a jsp is to generate a xml page, what attribute of page directive it should use?
Select one:
a. contentType
b. generateXML
c. typeXML
d. contentXML
ChatGPT
The correct attribute to use in the page directive for generating an XML page in
JSP is:
a. contentType

User
Which method does not exists in HtppServlet
Select one:
a. init
b. service
c. doGet
d. dopost
ChatGPT
The correct option is:
d. dopost

User
Which of the following attribute is used to mark a page as error processing page?
Select one:
a. isErrorPage
b. errorPage
c. exceptionPage
d. exception
ChatGPT
The correct attribute used to mark a page as an error processing page in JSP is:
a. isErrorPage
User
Which is the methods of generated Servlet?
Select one:
a. jspDestroy()
b. jspInit()
c. _jspService()
d. All of the above
ChatGPT
The correct option is:
d. All of the above

In a generated servlet from a JSP file, all three methods (jspInit(), jspDestroy(),
and _jspService()) are present.

User
Which http method is idempotent
Select one:
a. get
b. trace
c. post
d. option
ChatGPT
The idempotent HTTP methods are those that can be repeated or retried multiple
times with the same effect, and they do not produce different results. Among the
options provided, the idempotent method is:
a. get

HTTP methods like GET, HEAD, PUT, and DELETE are considered idempotent, while
methods like POST are not idempotent.

User
Which of the following attributes are mandatory in <jsp:getProperty /> tag?
Select one:
a. type, id
b. id, property
c. name, type
d. name, property
ChatGPT
The correct option is:
b. id, property

User
Setting isThreadSafe false can lead to poor performance.
Select one:
True
False
ChatGPT
True.

Setting isThreadSafe to false means that the servlet or JSP page is not thread-
safe, and multiple threads cannot execute the same instance simultaneously. This
can lead to poor performance in a multi-threaded environment, as it may result in
contention for resources and increased synchronization overhead. In general, it is
advisable to design servlets and JSP pages to be thread-safe unless there are
specific reasons not to do so.

User
Where filters are defined?
Select one:
a. Filters are defined in the jsp pages.
b. None of the above.
c. Both of the above.
d. Filters are defined in the deployment descriptor file web.xml.
ChatGPT
The correct option is:
d. Filters are defined in the deployment descriptor file web.xml.

User
session is instance of which class?

Select one:
a. ServletSession
b. HttpSession
c. Session
d. HttpServletSession
ChatGPT
The correct option is:
b. HttpSession

User
Which of the following step is taken by JSP container during Compilation phase?
Select one:
a. All of the above.
b. Parsing the JSP.
c. Compiling the servlet.
d. Turning the JSP into a servlet.
ChatGPT
The correct option is:
d. Turning the JSP into a servlet.

User
jspDestroy method of HttpJspPage class can be overridden.
Select one:
True
False
ChatGPT
True.

The jspDestroy method is part of the HttpJspPage interface, and it can be


overridden in a JSP page. This method is called when the JSP page is being
destroyed, providing an opportunity to release any resources held by the JSP.

User
The web server that executes the servlet creates an ___________ object and passes
this to the servlet's service method (which, in turn , pass it to doGet or doPost)
Select one:
a. HttpServletRequest
b. HttpRequest
c. HttpServletResponse
d. ServletRequest
ChatGPT
The correct option is:
a. HttpServletRequest

User
Which of the following is true about <jsp:setProperty> action?
Select one:
a. The setProperty action sets the properties of a Bean.
b. None of the above.
c. Both of the above.
d. The Bean must have been previously defined before using setProperty action.
ChatGPT
The correct option is:
a. The setProperty action sets the properties of a Bean.

User
which life-cycle method make ready the servlet for garbage collection:
Select one:
a. Destroy
b. system.gc
c. init
d. service
ChatGPT
The correct option is:
a. Destroy

User
What is default value of isThreadSafe?
Select one:
True
False
ChatGPT
The default value of isThreadSafe for a JSP page is:
True

User
Can a JSP page process HTML FORM data?
Select one:
True
False
ChatGPT
True.

Yes, a JSP page can process HTML FORM data. You can use the <form> tag in HTML to
create a form, and the form can submit data to a JSP page. In the JSP page, you can
use the request object to retrieve and process the form data. Typically, this
involves using the getParameter method of the request object to access the values
submitted in the form.

User
out is instance of which class?
Select one:
a. javax.servlet.jsp.PringWriter
b. javax.servlet.jsp.JspWriter
c. javax.servlet.Writer
d. javax.servlet.jsp.Writer
ChatGPT
The correct option is:
b. javax.servlet.jsp.JspWriter

User
Which of the following is true about buffer Attribute?
Select one:
a. None of the above.
b. The buffer attribute specifies the size of buffer.
c. The buffer attribute specifies buffering characteristics for the server output
response object.
d. Both of the above.
ChatGPT
The correct option is:
c. The buffer attribute specifies buffering characteristics for the server output
response object.

You might also like