JSP MCQ QUESTION
WITH ANSWER
J2EE
1. Which option is true about session
scope?
◦ A. Objects are accessible only from the page in which they are created
◦ B. Objects are accessible only from the pages which are in same session
◦ C. Objects are accessible only from the pages which are processing the same
request
◦ D. Objects are accessible only from the pages which reside in same
application
◦ Answer: B
2. Which of the scripting of JSP not putting
content into service method of the
converted servlet?
◦A. Declarations
◦B. Scriptlets
◦C. Expressions
◦D. None of the above
◦ Answer: C
3. Why is XML a good way to transfer text-
based data from one program or tool to
another?
◦ A. XML imposes important limitations on the receiving program or
tool
◦ B. The receiving program or tool can use the XML tagging
information to determine how to best handle the incoming data
◦ C. XML tags offer an extra level of security
◦ D. XML tags specify to the receiving program or tool exactly how to
format and display the data
◦ Answer: B
4. The method forward(request,
response) will
◦ A. return back to the same method from where the forward was
invoked
◦ B. not return back to the same method from where the forward was
invoked and the web pages navigation continues
◦ C. Both A and B are correct
◦ D. None of the above
◦ Answer: A
5. The difference between Servlets
and JSP is the …………….
◦A. translation
◦B. compilation
◦C. syntax
◦D. Both A and B
◦ Answer: C
6. Which of the following are the valid
scopes in JSP?
◦A. request, page, session, application
◦B. request, page, session, global
◦C. response, page, session, application
◦D. request, page, context, application
◦ Answer: A
7. JSP includes a mechanism for
defining ……………. or custom tags.
◦A. static attributes
◦B. local attributes
◦C. dynamic attributes
◦D. global attributes
◦ Answer: C
8. Which describes best an EJB
handle?
◦ A. An EJB handle is used to handle exceptions when accessing EJB
objects
◦ B. An EJB handle is used to store a reference to a specific EJB object
◦ C. An EJB handle is part of the Home interface
◦ D. An EJB handle is used for local references inside the EJB container
◦ Answer: B
9. Why DB connections are not
written directly in JSPs?
◦A. Response is slow
◦B. Not a standard J2EE architecture
◦C. Load Balancing is not possible
◦D. Both B and C
◦ Answer: D
10. How many jsp implicit objects are there
and these objects are created by the web
container that are available to all the jsp
pages?
◦A. 8
◦B. 9
◦C. 10
◦D. 7
◦ Answer: B
11. Why use Request Dispatcher to forward a
request to another resource, instead of using a
sendRedirect?
◦ 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, and
thus is more efficient and allows the server to maintain request state
◦ Answer: D
12. Which is not a directive?
◦A. include
◦B. page
◦C. export
◦D. useBean
◦ Answer: C
13. Which attribute specifies a JSP page that should
process any exceptions thrown but not caught in the
current page?
◦A. The ErrorPage Attribute
◦B. The IsErrorPage Attribute
◦C. Both A & B
◦D. None of the above
◦ Answer: A
14. Which http method send by browser that
asks the server to get the page only?
◦A. get
◦B. post
◦C. option
◦D. put
◦ Answer: A
15. JDBC is a ……… interface, which means that it is
used to invoke SQL commands directly
◦A. low-level
◦B. middle-level
◦C. higher-level
◦D. user
◦ Answer: A
16. Which can generate HTML dynamically on the client but
can hardly interact with the web server to perform complex
tasks like database access and image processing etc. in JSP?
◦A. vs.Static HTML
◦B. vs.Server-Side Includes
◦C. vs.Pure Servlets
◦D. Vs.JavaScript
◦ Answer: D
17. What is JDBC?
◦A. java compiler
◦B. Java API
◦C. Java interpreter
◦D. Both A and B
◦ Answer: B
18. Dynamic interception of requests and
responses to transform the information is
done by
◦A. servlet container
◦B. servlet config
◦C. servlet context
◦D. servlet filter
◦ Answer: D
19. What type of scriptlet code is better-suited to
being factored forward into a servlet?
◦A. Code that deals with logic that is common across
requests
◦B. Code that deals with logic that is vendor specific
◦C. Code that deals with logic that relates to database
access
◦D. Code that deals with logic that relates to client scope
◦ Answer: A
20. This is a software distribution model in which applications
are hosted by a vendor or service provider and made available
to customers over a network, typically the Internet.
◦A. Platform as a Service (PaaS)
◦B. Infrastructure as a Service (IaaS)
◦C. Software as a Service (SaaS)
◦D. None
◦ Answer: C
21. What is the initial contact point for
handling a web request in a Page-Centric
architecture?
◦A. A JSP page
◦B. A JavaBean
◦C. A servlet
◦D. A session manager
◦ Answer: A
22. Java Soft provides ……... JDBC product
components as part of the java Developer’s Kit
(JDK)
◦A. three
◦B. two
◦C. four
◦D. single
◦ Answer: A
23. How to send data in get method?
◦A. We can't
◦B. Through url
◦C. Through payload
◦D. None of these
◦ Answer: B
24. What is the name of the organization
helping to foster security standards for cloud
computing?
◦A. Cloud Security Standards Working
◦B. Cloud Security Alliance
◦C. Cloud Security Watchdog
◦D. Security in the Cloud Alliance
◦ Answer: B
25. Which of the following statements is true
regarding the scope of 'request' in JSP?
◦ A. Objects with request scope are accessible from pages processing the same
request where they were created
◦ B. All references to the object shall be released after the request is processed; in
particular, if the request is forwarded to a resource in the same run time, the
object is still reachable
◦ C. References to objects with request scope are stored in the request object
◦ D. All of the above
◦ Answer: D
THANK YOU

JSP MCQ Question with Answer

  • 1.
  • 2.
    1. Which optionis true about session scope? ◦ A. Objects are accessible only from the page in which they are created ◦ B. Objects are accessible only from the pages which are in same session ◦ C. Objects are accessible only from the pages which are processing the same request ◦ D. Objects are accessible only from the pages which reside in same application ◦ Answer: B
  • 3.
    2. Which ofthe scripting of JSP not putting content into service method of the converted servlet? ◦A. Declarations ◦B. Scriptlets ◦C. Expressions ◦D. None of the above ◦ Answer: C
  • 4.
    3. Why isXML a good way to transfer text- based data from one program or tool to another? ◦ A. XML imposes important limitations on the receiving program or tool ◦ B. The receiving program or tool can use the XML tagging information to determine how to best handle the incoming data ◦ C. XML tags offer an extra level of security ◦ D. XML tags specify to the receiving program or tool exactly how to format and display the data ◦ Answer: B
  • 5.
    4. The methodforward(request, response) will ◦ A. return back to the same method from where the forward was invoked ◦ B. not return back to the same method from where the forward was invoked and the web pages navigation continues ◦ C. Both A and B are correct ◦ D. None of the above ◦ Answer: A
  • 6.
    5. The differencebetween Servlets and JSP is the ……………. ◦A. translation ◦B. compilation ◦C. syntax ◦D. Both A and B ◦ Answer: C
  • 7.
    6. Which ofthe following are the valid scopes in JSP? ◦A. request, page, session, application ◦B. request, page, session, global ◦C. response, page, session, application ◦D. request, page, context, application ◦ Answer: A
  • 8.
    7. JSP includesa mechanism for defining ……………. or custom tags. ◦A. static attributes ◦B. local attributes ◦C. dynamic attributes ◦D. global attributes ◦ Answer: C
  • 9.
    8. Which describesbest an EJB handle? ◦ A. An EJB handle is used to handle exceptions when accessing EJB objects ◦ B. An EJB handle is used to store a reference to a specific EJB object ◦ C. An EJB handle is part of the Home interface ◦ D. An EJB handle is used for local references inside the EJB container ◦ Answer: B
  • 10.
    9. Why DBconnections are not written directly in JSPs? ◦A. Response is slow ◦B. Not a standard J2EE architecture ◦C. Load Balancing is not possible ◦D. Both B and C ◦ Answer: D
  • 11.
    10. How manyjsp implicit objects are there and these objects are created by the web container that are available to all the jsp pages? ◦A. 8 ◦B. 9 ◦C. 10 ◦D. 7 ◦ Answer: B
  • 12.
    11. Why useRequest Dispatcher to forward a request to another resource, instead of using a sendRedirect? ◦ 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, and thus is more efficient and allows the server to maintain request state ◦ Answer: D
  • 13.
    12. Which isnot a directive? ◦A. include ◦B. page ◦C. export ◦D. useBean ◦ Answer: C
  • 14.
    13. Which attributespecifies a JSP page that should process any exceptions thrown but not caught in the current page? ◦A. The ErrorPage Attribute ◦B. The IsErrorPage Attribute ◦C. Both A & B ◦D. None of the above ◦ Answer: A
  • 15.
    14. Which httpmethod send by browser that asks the server to get the page only? ◦A. get ◦B. post ◦C. option ◦D. put ◦ Answer: A
  • 16.
    15. JDBC isa ……… interface, which means that it is used to invoke SQL commands directly ◦A. low-level ◦B. middle-level ◦C. higher-level ◦D. user ◦ Answer: A
  • 17.
    16. Which cangenerate HTML dynamically on the client but can hardly interact with the web server to perform complex tasks like database access and image processing etc. in JSP? ◦A. vs.Static HTML ◦B. vs.Server-Side Includes ◦C. vs.Pure Servlets ◦D. Vs.JavaScript ◦ Answer: D
  • 18.
    17. What isJDBC? ◦A. java compiler ◦B. Java API ◦C. Java interpreter ◦D. Both A and B ◦ Answer: B
  • 19.
    18. Dynamic interceptionof requests and responses to transform the information is done by ◦A. servlet container ◦B. servlet config ◦C. servlet context ◦D. servlet filter ◦ Answer: D
  • 20.
    19. What typeof scriptlet code is better-suited to being factored forward into a servlet? ◦A. Code that deals with logic that is common across requests ◦B. Code that deals with logic that is vendor specific ◦C. Code that deals with logic that relates to database access ◦D. Code that deals with logic that relates to client scope ◦ Answer: A
  • 21.
    20. This isa software distribution model in which applications are hosted by a vendor or service provider and made available to customers over a network, typically the Internet. ◦A. Platform as a Service (PaaS) ◦B. Infrastructure as a Service (IaaS) ◦C. Software as a Service (SaaS) ◦D. None ◦ Answer: C
  • 22.
    21. What isthe initial contact point for handling a web request in a Page-Centric architecture? ◦A. A JSP page ◦B. A JavaBean ◦C. A servlet ◦D. A session manager ◦ Answer: A
  • 23.
    22. Java Softprovides ……... JDBC product components as part of the java Developer’s Kit (JDK) ◦A. three ◦B. two ◦C. four ◦D. single ◦ Answer: A
  • 24.
    23. How tosend data in get method? ◦A. We can't ◦B. Through url ◦C. Through payload ◦D. None of these ◦ Answer: B
  • 25.
    24. What isthe name of the organization helping to foster security standards for cloud computing? ◦A. Cloud Security Standards Working ◦B. Cloud Security Alliance ◦C. Cloud Security Watchdog ◦D. Security in the Cloud Alliance ◦ Answer: B
  • 26.
    25. Which ofthe following statements is true regarding the scope of 'request' in JSP? ◦ A. Objects with request scope are accessible from pages processing the same request where they were created ◦ B. All references to the object shall be released after the request is processed; in particular, if the request is forwarded to a resource in the same run time, the object is still reachable ◦ C. References to objects with request scope are stored in the request object ◦ D. All of the above ◦ Answer: D
  • 27.