1.
Which scriptlet tag is known as declaration tag
a. <% %>
b. <%= %>
c. <%! %>
d. <%@ %
2. What does JSTL stand for?
a. Java Script Tag Library
b. Java Server Tag Library
c. Java Tag Library
d. Java Server Pages Standard Tag Library
3. Constructor in java
a. Has return type
b. Must be same name as class name
c. Cannot have parameter as argument
d. All of above
4. The main feature of Java is ____ .
a. self callable
b. Object oriented programming
c. Use of servlets
d. Non-Independent Platform
5. What tags in JSP Action are used for bean development?
a. jsp:setProperty
b. jsp:getProperty
c. jsp:useBean
d. All of the above
6. What does wrapper class in Java mean?
a. Primitive data type
b. Bundle of external libraries
c. Bundle of classes and interfaces
d. Encapsulation
7. How many implicit objects are there in JSP?
a. 5
b. 8
c. 9
d. 11
8. Which is the correct code to retrieve the absolute path?
a. response.contextPath()
b. request.contextPath()
c. request.getContextPath()
d. response.getContextPath()
9. Which method is used to bind objects on HttpSession instances?
a. getAttribute
b. setAttribute
c. getParameter
d. setParameter
10. The main function of servlet is used to create
a. Dynamic webpage
b. Static webpage
c. Normal webpage
d. None of above
11. Servlet file is navigated from _____.
a. Absolute path
b. Relative path
c. urlPattern
d. Both a and b
12. Which method is used to get the value from the parameter, header information
a. request.setParameter(String name);
b. request.setAttribute(variableName,Object);
c. requessst.getParameter(String name);
d. request.getAttribute(VariableName,object);
13. Sessions is a component of SessionTracking and is used to keep track of the client
state on the server.
a. True
b. False
14. Which RequestDispacher method is used to transmit the same request and response
objects to a different servlet?
a. sendRedirect()
b. <a href=””/>
c. forward()
d. Both a and c
15. The ________ package represents the servlet API classes and interfaces
a. Java.servlet
b. Javax.servlet
c. Javax.servlet.http
d. Both b and c
16. Life cycle of servlet includes
a. init, service and destroy method
b. init, service, forward and destroy method
c. init, service, include and destroy method
d. None of above
17. When does a filter's destroy() method get called?
a. The filter's life cycle ends with a single call to the destroy() method.
b. After the doFilter function has been completed by the filter, the destroy()
method is invoked.
c. A filter's destroy() method is only called once, at the beginning of its life cycle.
d. After the filter runs, the destroy() method is called.
18. The servlet's init() method is loaded via a web server.
a. True
b. False
19. The contents of the web.xml file's "servlet-name" and "servlet-class" fields
a. must match
b. cannot be the same
c. might be same
d. None of the above
20. ServletConfig object is for each
a. Servlet
b. Web Application
c. JavaServerPage
d. None of above
21. Which of the following is not JSP implicit object
a. Request
b. Response
c. Cookies
d. Exception
22. When running the select query we use the _________ method.
a. st.executeUpdate()
b. st.executeQuery()
c. st.runQuery()
d. st.getQuery()
23. Which identifies a result set that cannot be concurrently modified programmatically?
a. CONCUR_UPDATABLE
b. CONCUR_READ_ONLY
c. Both a and b
d. None of the above
24. Which method is used to set the session object in JSP
a. Session.setAttribute (String,Object)
b. request.setAttribute(Object.String)
c. response.setAttribute(String,Object)
d. cookies.setAttribute(String,Object)
25. Which package is used to implement JDBC?
a. Java.sql
b. Javax.sql
c. Java.jdbc.sql
d. Javax.jdbc.sql
26. Because the query is only compiled once when using the PreparedStatement
interface, the application's performance will be faster.
a. True
b. False
27. Which method is used to retrieve the value from session object in JSP
a. Page.getAttribute(String name)
b. exception.getAttribute(String name)
c. session.getAttribute(String name)
d. response.getAttribute(String name)
28. Which class serves as the JDBC architecture's foundation?
a. JDBC driver test suite
b. JDBC bridge
c. JDBC driver manager
d. All of the above
29. <%=statement %>
a. Scriptlet tag
b. Expression tag
c. Declaration tag
d. None of above
30. Which JSTL tag is used to iterate?
a. <fn:iterate>
b. <c:iterate>
c. <fn:forEach>
d. <c:forEach>
31. Which JSTL tag library provides support for string manipulation?
a. JSTL Formatting
b. JSTL Function
c. JSTL Query
d. JSTL String
32. Which implicit object is used to get the request information such as parameter, server
name, server port, header information
a. Request
b. Response
c. Session
d. All of above
33. Select the correct code to create a new session.
a. Session session = new Session()
b. Session session = response.getSession()
c. HttpSession session = request.getSession()
d. HttpSession session = request.getSession(false)
34. Which of the following code will set age/expiry time to the session.
a. setMaxAge()
b. setMaxInactiveIntergval()
c. setSessionTimeOut()
d. Both a and b
35. Which implicit object is created by the web container for each JSP
a. Request
b. Response
c. Config
d. Exception
36. How to correctly end the session?
a. session.setMaxAge(0)
b. session.endSession()
c. session.invalidate()
d. session.destroy()
37. Which of the following is not JSP directive element
a. Page directive
b. Include directive
c. Taglib directive
d. Cookies directive
38. How can we retrieve uploaded images from HTML form in Java?
a. Part imagePart = request.getPart(“image”)
b. MultiPart imagePart = request.getMultiPart(“image”)
c. MultiPart imagePart = request.getPart(“image”)
d. String imagePart = request.getParameter(“image”)
39. Correct code to get a web browser url address in Java is __________.
a. response.getURI()
b. request.getURI()
c. response.getRequestURI()
d. request.getRequestURI()
40. What is the default port number of mysql database
a. 8080
b. 3306
c. 80
d. 127.0.0.1