0% found this document useful (0 votes)
1K views

Advance Java MCQ Toupload

This document contains 20 multiple choice questions about Java concepts like servlets, JSP, and JDBC. The questions cover topics such as servlet mappings, servlet interfaces, request types, servlet lifecycle methods, RequestDispatcher usage, JSP compilation, scripting elements, and JSP scopes. An XML syntax for the JSP include directive is requested in one question.

Uploaded by

Rupam Patel
Copyright
© Attribution Non-Commercial (BY-NC)
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)
1K views

Advance Java MCQ Toupload

This document contains 20 multiple choice questions about Java concepts like servlets, JSP, and JDBC. The questions cover topics such as servlet mappings, servlet interfaces, request types, servlet lifecycle methods, RequestDispatcher usage, JSP compilation, scripting elements, and JSP scopes. An XML syntax for the JSP include directive is requested in one question.

Uploaded by

Rupam Patel
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 3

Advance Java MCQ model paper

1.In which file do we define a servlet mapping?

a.web.xml b. servlet.mapping c. Struts-config.xml d. None of these

2. All servlets must implement the Servlet interface of package:

a. java.servlet b.javax.Servlet c.javax.servlet d. All are same

3. A get request gets information from a client. A post request posts data to a client.

a.true b. false c. Not always d. None of these

4. The Web server that executes the servlet creates an _________ object and passes this to the
servlet's service method (which, in turn, passes it to doGet or doPost).

a. HttpServletResponce b. servletRequest c. HttpRequest d. HttpServletRequest

5. Which of the following can be used to store client side user state information while avoiding
any impact due to the users web browser configuration ?

a. Cookie b.Url Rewriting c. Hidden tags d. HttpSession

6. The servlet initialization parameters are specified in the _______ file as part of a servlet
element.

7. Which of the following is NOT true about servlets ?

a. They are instantiated every time a request is made.

b. They are a mechanism used by the class loader to download applets.

c. They can be used instead of CGI scripts.

8. Which of the following is response code for “Unsupported Media Type” ?

a.205 b.303 c.415 d.505

9. Which of the following is response Header , that should be included to response when status
code is 300 ?

a.Refresh b.Expire c.Location 4.WWW.Authenticate

10.Which of the following is not part of Servlet life cycle methods?

a.doGet() b.Service() c.init()

11. Why use RequestDispatcher to forward a request to another resource, instead of using a
sendRedirect ?
Advance Java MCQ model paper
a. Redirects are no longer supported in the current servlet API.

b. Redirects are not a cross-platform portable mechanism.

c. The RequestDispatcher does not use the reflection API.

d. The RequestDispatcher does not require a round trip to the client,via network,hense it is more
efficient.

12. What alternatives exist to embedding Java code directly within the HTML markup of your JSP page ?

a.Scriptlets b.javascript c.javabean

12. What is wrong with the following code?

<% If strPassword.equals(“boss”)

{ <jsp:forward page=”Welcome.jsp” flush=”true” /> }

else {}

%>

a. Unmatched bracket in for statement

b. Flush attribute must be false

c. Keyword 'file' should be used instead of 'page' in the <jsp:forward/> action

d. Actions cannot be used within scriptlet blocks

13. When a JSP page is compiled, what is it turned into ?

a.Applet b.Application c.Servlet d.java bean

14. Which is not a standard scripting element?

a.<% %> <%= %> <%! %> <%@ @>

15. Which of the following can not be used as the scope when using a JavaBean with JSP ?

a. application b.response c.request d.session

16. What is JSP ?

a.java server pages b.java special pages c.java static pages

17 How many jsp directive we have ?

a. 4 b.3 c.7 d.9

18. Which is not a implicit object of jsp ?


Advance Java MCQ model paper

a.request b. out c. exception d. config

19.JDBC-ODBC driver implementation is slower than a pure java driver implementation . state
true/false?

20. XML syntax for include directive is


________________________________________________________

You might also like