250+ TOP MCQs on Servlets and JSP and Answers

RDBMS Multiple Choice Questions on “Servlets and JSP”.

1. The _______ specification defines an application programming interface for communication between the server and the application program
a) Java Servlet
b) JDBC
c) Java Applet
d) Java Swing

Answer: a
Clarification: The java servlet specification defines an application programming interface for communication between the server and the application program. The HttpServlet class in Java implements the servlet API specification.

2. State true or false: Servlets are used to generate dynamic responses to HTTP requests.
a) True
b) False

Answer: a
Clarification: Servlets are used to generate dynamic responses to HTTP requests. The task of a servlet is to process a request dynamically.

3. Which of these functions is not a part of the servlet lifecycle
a) Checking if an instance of servlet exists or not
b) Invoking the service method of the servlet
c) Shutting down the servlet
d) Pausing the servlet for a given period of time.

Answer: d
Clarification: Pausing the servlet for a given amount of time is not a part of the servlet lifecycle. A servlet can be checked, invoked and destroyed but it cannot be paused.

4. Which of the following application servers do not provide built in support for servlets?
a) Tomcat server
b) Glassfish
c) JBoss
d) None of the mentioned

Answer: d
Clarification: All of the mentioned application servers provide built in support for servlets. Glassfish and Tomcat are the most prominently used application servers.

5. What is the full form of JSP?
a) Java servlet program
b) Java server pages
c) Java server pages
d) Java server program

Answer: b
Clarification: The full form of JSP is Java Server Pages. It is a scripting language that allows HTML programmers to mix static HTML with dynamically generated HTML.

6. While using Javascript, the browser parses the HTML code into a tree like structure defined by a standard called ________
a) DOS
b) DOD
c) DOM
d) DON

Answer: c
Clarification: While using Javascript, the browser parses the HTML code into a tree like structure defined by a standard called Document Object Model (DOM). Javascript code can modify the tree structure to carry out certain operations.

7. Javascript is used to create dynamic webpages using technologies that are collectively called ________
a) Ajax
b) Thor
c) Dynamo
d) Achilles

Answer: a
Clarification: Javascript is used to create dynamic webpages using technologies that are collectively called Ajax.

8. What are scripting languages?
a) The programming languages that pre decide the web page content
b) The programming languages that are simpler and offer same protection
c) The programming languages that trade off simplicity for protection.
d) None of the mentioned

Answer: b
Clarification: Scripting languages are those languages that are simpler with enriched user interface features but offer the same protection as that of Java.

9. What are client side scripting languages?
a) The languages designed to be executed on the client’s web browser
b) The languages designed to be executed on the server
c) The languages designed to reduce the amount of data costs incurred at the client end
d) The languages designed to be executed in multiple computers paralleled with each other

Answer: a
Clarification: Client side scripting languages are those languages that are designed to be executed on the client’s web browser. These languages provide constructs that can be embedded with an HTML document.

10. State true or false: Executing programs at the client side is slower than executing programs on the server
a) True
b) False

Answer: b
Clarification: Executing programs on the client side is faster than executing programs on the server which includes sending every interaction to the server.

Leave a Reply

Your email address will not be published. Required fields are marked *