69
80k
Chapter:

20+ JSP Solved MCQs

in Advanced JAVA

These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Master of Science in Information Technology (MSc IT) , Master of Science in Computer Science (MSc CS) , Bachelor of Business Administration in Computer Applications (BBA [CA]) , Programming Languages , Master of Science in Software Engineering (MSc SE) .

Chapters

Chapter: JSP
1.

Which one is the correct order of phases in JSP life cycle?

A. Initialization, Cleanup, Compilation, Execution
B. Initialization, Compilation, Cleanup, Execution
C. Compilation, Initialization, Execution, Cleanup
D. Cleanup, Compilation, Initialization, Execution
Answer» C. Compilation, Initialization, Execution, Cleanup
2.

Which technology do we mix our business logic with the presentation logic?

A. Servlet
B. JSP
C. Both A and B
D. None of the above
Answer» A. Servlet
3.

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. The ErrorPage Attribute
4.

The ASP and JSP technologies are quite similar in the way they support the creation of Dynamic pages, using HTML templates, scripting code and components for business logic.

A. True
B. False
C. none
D. all
Answer» A. True
5.

Which of the following is an advantage of the statement – Separation of business logic from JSP ?

A. Custom Tags in JSP
B. JSP Standard Tag Library
C. All the above
D. None of the above
Answer» A. Custom Tags in JSP
6.

JSPs eventually are compiled into Java servlets, you can do as much with JSPs as you can do with Java servlets.

A. True
B. False
C. none
D. all
Answer» A. True
7.

JavaServer Pages often serve the same purpose as programs implemented using the Common Gateway Interface (CGI)

A. True
B. False
C. none
D. all
Answer» A. True
8.

Which is the Microsoft solution for providing dynamic Web content?

A. ASP
B. JSP
C. Both A and B
D. None of the above
Answer» A. ASP
9.

Which tag is used to execute java source code in JSP?

A. Declaration Tag
B. Scriptlet tag
C. Expression tag
D. None of the above
Answer» B. Scriptlet tag
10.

A JSP page consists of which tags?

A. HTML tags
B. JSP tags
C. Both A & B
D. None of the above
Answer» C. Both A & B
11.

Which packages does a JSP API consist of?

A. javax.servlet.jsp
B. java.servlet
C. javax.servlet.jsp.tagext
D. Both A & C
Answer» D. Both A & C
12.

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. Expressions
13.

The difference between Servlets and JSP is the …………….

A. translation
B. compilation
C. syntax
D. Both A and B
Answer» C. syntax
14.

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. request, page, session, application
15.

JSP includes a mechanism for defining …………………………. or custom tags.

A. static attributes
B. local attributes
C. dynamic attributes
D. global attributes
Answer» C. dynamic attributes
16.

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. Both B and C
17.

Which is not a directive?

A. include
B. page
C. export
D. taglib
Answer» C. export
18.

Which http method send by browser that asks the server to get the page only?

A. get
B. option
C. put
D. post
Answer» A. get
19.

Which tag should be used to pass information from JSP to included JSP?

A. Using <%jsp:page> tag
B. Using <%jsp:param> tag
C. Using <%jsp:import> tag
D. Using <%jsp:useBean> tag
Answer» B. Using <%jsp:param> tag
20.

_jspService() method of HttpJspPage class should not be overridden.

A. True
B. False
C. none
D. all
Answer» A. True
21.

Which is not a directive?

A. include
B. page
C. export
D. useBean
Answer» C. export
22.

Attribute used to handle web flow requests.

A. servlet-mapping
B. servlet-attr
C. servlet-flow
D. servlet-requests
Answer» A. servlet-mapping
23.

To resolve Facelets views we configure:

A. ViewFacelets
B. ViewResolver
C. View-resolver
D. View_Resolver
Answer» B. ViewResolver
24.

File extension of a view state’s name which is by default loaded by facelet page.

A. .xml
B. .hbm.xml
C. .xhtml
D. none of the mentioned
Answer» C. .xhtml
25.

Navigation in traditional JSF applications is handled by:

A. linking directly linking to a resource
B. commandLink
C. invoking an action
D. all of the mentioned
Answer» D. all of the mentioned
26.

For cross field validation or some sort of barrier to ensure state before you start a flow, we use.

A. FacesContext
B. FaceletContext
C. FacesResolver
D. All of the mentioned
Answer» A. FacesContext
27.

Component which additionally provides a pop-up date picker control for its enclosed input field.

A. clientDateValidator
B. clientValidator
C. dateValidator
D. validator
Answer» A. clientDateValidator
28.

Component which encloses command button.

A. validateAll
B. validateAllClick
C. validateAllInClick
D. validateAllOnClick
Answer» C. validateAllInClick

Done Studing? Take A Test.

Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.