0% found this document useful (0 votes)
13 views8 pages

APMCQPracticeSet Updated A344111b 6c7e 4950 Ac00 26fb9a92bbd9 99133

Uploaded by

krishna00rads11
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views8 pages

APMCQPracticeSet Updated A344111b 6c7e 4950 Ac00 26fb9a92bbd9 99133

Uploaded by

krishna00rads11
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

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. request.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. ServletConfig object is for each


a. Servlet
b. Web Application
c. JavaServerPage
d. None of above

20. Which of the following is not JSP implicit object


a. Request
b. Response
c. Cookies
d. Exception
21. When running the select query we use the _________ method.
a. st.executeUpdate()
b. st.executeQuery()
c. st.runQuery()
d. st.getQuery()

22. 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)

23. Which package is used to implement JDBC?


a. Java.sql
b. Javax.sql
c. Java.jdbc.sql
d. Javax.jdbc.sql

24. 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)

25. 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
26. <%=statement %>
a. Scriptlet tag
b. Expression tag
c. Declaration tag
d. None of above

27. Which JSTL tag is used to iterate?


a. <fn:iterate>
b. <c:iterate>
c. <fn:forEach>
d. <c:forEach>

28. Which JSTL tag library provides support for string manipulation?
a. JSTL Formatting
b. JSTL Function
c. JSTL Query
d. JSTL String

29. 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

30. 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)
31. Which of the following code will set age/expiry time to the session.
a. setMaxAge()
b. setMaxInactiveInterval()
c. setSessionTimeOut()
d. Both a and b

32. Which implicit object is created by the web container for each JSP
a. Request
b. Response
c. Config
d. Exception

33. How to correctly end the session?


a. session.setMaxAge(0)
b. session.endSession()
c. session.invalidate()
d. session.destroy()

34. Which of the following is not JSP directive element


a. Page directive
b. Include directive
c. Taglib directive
d. Cookies directive

35. 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”)
36. Correct code to get a web browser url address in Java is __________.
a. response.getURI()
b. request.getURI()
c. response.getRequestURI()
d. request.getRequestURI()

37. What is the default port number of mysql database


a. 8080
b. 3306
c. 80
d. 127.0.0.1

You might also like