Programming MCQs

Top 20 MCQ Questions on the JSP Fundamentals

Pinterest LinkedIn Tumblr
This set of MCQ questions on the JSP fundamentals includes the collection of top 20 multiple-choice questions on the fundamentals of Java Server Pages (JSP). It includes objective questions on the introduction of JSP, scripting elements used in JSP, JSP expressions, scriptlets, declarations, and the predefined variables or implicit objects used in JSP.

Read Also: Top 20 MCQ Questions on the JDBC Fundamentals

1. JSP uses server-side scripting that is actually translated into … and compiled before they are run.
A) Applet
B) Servlets
C) HTML
D) JavaScript

2. … are small programs that are downloaded into a Java Enabled Web Browser.
A) Applets
B) Servlets
C) HTML
D) JavaScript

3. State whether the following statements about the servlet are True or False.
i) Once a servlet is started it remains in memory and can handle multiple HTTP requests.
ii) Servlets do not run on the client, all execution takes place on the server.
iii) A servlet is limited by what the HTML specification supports.
A) i-True, ii-False, iii-True
B) i-True, ii-True, iii-False
C) i-False, ii-True, iii-True
D) i-True, ii-True, iii-True

4. In JSP, … are collectively called scripting elements.
i) Expressions
ii) Scriptlets
iii) Declarations
A) i and ii only
B) i and iii only
C) ii and iii only
D) All i, ii and iii

5. … elements used in JSP allow Java code to be embedded directly into the JSP page.
A) Directive
B) Declaration
C) Scriptlet
D) Action

6. … elements used in JSP allow Java code to be embedded directly into the JSP page.
A) Directive
B) Declaration
C) Scriptlet
D) Action

7. The purpose of a …. element is to initialize variables and methods and make them available to other declarations, scriptlets, and expressions.
A) directive
B) declaration
C) scriptlet
D) expression

8. State whether the following statements about the declaration element are True or False.
i) Declaration elements are effectively global.
ii) The syntax of the declaration element begins with the standard JSP open tag followed by a colon (<%:).
A) i-True, ii-False
B) i-True, ii-True
C) i-False, ii-True
D) i-False, ii-False

9. For incorporating Java code with HTML, we will use …
A) Action elements
B) Directive elements
C) Declarations elements
D) Scriptlets elements

10. Which of the following are the examples of implicit objects.
i) The in object
ii) The out object
iii) The request object
iv) The response object
A) i, ii and iii only
B) ii, iii and iv only
C) i, iii and iv only
D) All i, ii, iii and iv

11. The … is used to track information about a particular client while using stateless connection protocol such as HTTP.
A) config object
B) pageContext object
C) session object
D) application object

12. The … allows the JSP author access to the initialization parameters for the servlet or JSP engine.
A) config object
B) pageContext object
C) session object
D) application object

13. State whether the following statements about the implicit objects are True or False.
i) The response object deals with the stream of data back to the client.
ii) The response object is typically used by JSP page authors.
iii) The exception object is accessible only from an error page.
A) i-True, ii-False, iii-True
B) i-True, ii-True, iii-False
C) i-False, ii-True, iii-True
D) i-True, ii-True, iii-True

14. Which of the following are the features of custom tags used on the JSP.
i) It can access all the objects available to JSP pages.
ii) It can be customized via attributes passed from the calling page.
iii) It can be nested within one another.
A) i and ii only
B) i and iii only
C) ii and iii only
D) All i, ii and iii

15. … object is an instantiation of a javax.servlet.jsp.JspWriter object.
A) request
B) page
C) out
D) config

16. The … object is an instantiation of a java.lang.Throwable object.
A) application
B) page
C) session
D) exception

17. The … object is a representation of the JSP page through its entire lifecycle.
A) application
B) page
C) session
D) exception

18. … elements provide the information for the translation phase of the JSP page.
A) Directive
B) Declaration
C) Scriptlet
D) Action

19. The … element begins with the standard JSP start-tag followed by an equal sign (<%=).
A) directive
B) expression
C) scriptlet
D) declaration

20. State whether the following statements about the JSP scriptlets are True or False.
i) The Java code in scriptlets is executed when the user asks for the page.
ii) The JSP scriptlet is used for executing logic on the server-side.
A) i-True, ii-False
B) i-True, ii-True
C) i-False, ii-True
D) i-False, ii-False

Answers:

  1. B) Servlets
  2. A) Applets
  3. D) i-True, ii-True, iii-True
  4. D) All i, ii and iii
  5. C) Scriptlet
  6. A) Directive
  7. B) declaration
  8. A) i-True, ii-False
  9. D) Scriptlets elements
  10. B) ii, iii and iv only
  11. C) session object
  12. A) config object
  13. A) i-True, ii-False, iii-True
  14. D) All i, ii and iii
  15. C) out
  16. D) exception
  17. A) application
  18. D) Action
  19. B) expression
  20. B) i-True, ii-True
Please follow and like us:
RSS
Follow by Email
X (Twitter)
Visit Us
Follow Me
YouTube
YouTube
LinkedIn
linkedIn | Top 20 MCQ Questions on the JSP Fundamentals
Share

Author

Shuseel Baral is a web programmer and the founder of InfoTechSite has over 8 years of experience in software development, internet, SEO, blogging and marketing digital products and services is passionate about exceeding your expectations.

Comments are closed.

RSS
Follow by Email
X (Twitter)
Visit Us
Follow Me
YouTube
YouTube
LinkedIn
Share