Question - 1
JSP container creates ______________ methods so it should not be overridden.
_jspService()
jdbcservice()
Both A and B
None of these
Show Answer
Solutions
Answer- A
Question - 2
Which of the following is not a valid attribute of page directives?
language
extend
export
import
Show Answer
Solutions
Answer- C
Question - 3
Which of the following attribute is used to mark a page as an error processing page?
isErrorPage
errorPage
exception
exceptionPage
Show Answer
Solutions
Answer- A
Question - 4
Where filters are defined?
Filters are defined in the deployment descriptor file web.xml
Filters are defined in the jsp pages
Both A and B
None of these
Show Answer
Solutions
Answer- A
Question - 5
What happens when autoFlush is set to a value "false"?
JSP container throws exception to indicate buffer overflow when buffer is filled
JSP container flushed the buffered output when buffer is filled
Both A and B
None of these
Show Answer
Solutions
Answer- A
Question - 6
Which of the scripting of JSP not putting content into service method of the converted servlet?
Declarations
Expressions
Scriptlets
None of the above
Show Answer
Solutions
Answer- B
Question - 7
The method forward(request, response) will ________________.
return back to the same method from where the forward was invoked
not return back to the same method from where the forward was invoked and the web pages navigation continues
Both A and B
None of these
Show Answer
Solutions
Answer- A
Question - 8
The difference between Servlets and JSP is the _______________.
translation
compilation
syntax
Both A and B
Show Answer
Solutions
Answer- C
Question - 9
Which of the following are the valid scopes in JSP?
request, page, session, application
request, page, session, global
request, page, context, application
response, page, session, application
Show Answer
Solutions
Answer- A
Question - 10
JSP includes a ___________ mechanism for defining or custom tags.
static attributes
local attributes
dynamic attributes
global attributes
Show Answer
Solutions
Answer- C
Question - 11
Why DB connections are not written directly in JSPs?
Response is slow
Not a standard J2EE architecture
Load Balancing is not possible
Both B and C
Show Answer
Solutions
Answer- D
Question - 12
How many JSP implicit objects are there and these objects are created by the web container that is available to all the JSP pages?
Answer- B
Question - 13
Why use Request Dispatcher to forward a request to another resource, instead of using a sendRedirect?
Redirects are no longer supported in the current servlet API
Redirects are not a cross-platform portable mechanism
The RequestDispatcher does not use the reflection API
The RequestDispatcher does not require a round trip to the client, and thus is more efficient and allows the server to maintain request state
Show Answer
Solutions
Answer- D
Question - 14
Which is not a directive?
include
page
export
useBean
Show Answer
Solutions
Answer- C
Question - 15
Which HTTP method send by the browser asks the server to get the page only?
Answer- A
Question - 16
Which can generate HTML dynamically on the client but can hardly interact with the webserver to perform complex tasks like database access and image processing etc. in JSP?
vs.Static HTML
vs.Server-Side Includes
vs.Pure Servlets
Vs.JavaScript
Show Answer
Solutions
Answer- D
Question - 17
What is the initial contact point for handling a web request in a Page-Centric architecture?
A JSP page
A JavaBean
A servlet
A session manager
Show Answer
Solutions
Answer- A
Question - 18
Which of the following statements is true regarding the scope of 'request' in JSP?
Objects with request scope are accessible from pages processing the same request where they were created
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
References to objects with request scope are stored in the request object
All of the above
Show Answer
Solutions
Answer- D
Question - 19
Which page directive should be used in JSP to generate a PDF page?
contentType
generatePdf
typePDF
contentPDF
Show Answer
Solutions
Answer- A
Question - 20
Which option is true about session scope?
Objects are accessible only from the page in which they are created
Objects are accessible only from the pages which are in same session
Objects are accessible only from the pages which are processing the same request
Objects are accessible only from the pages which reside in same application
Show Answer
Solutions
Answer- B
Practice more set questions