Tải bản đầy đủ (.doc) (23 trang)

Dynamic Pages using JSP

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (144.74 KB, 23 trang )

Dynamic Pages using JSP
1. The three main types of JSP constructs that can be embedded in a Java Server
page are
[2.0]
a) Directives c) Actions
b) Scripting Elements d) Methods
2. The three most important methods of the servlets are [2.5]
a) Init() d) Destroy()
b) Service() e) Run()
c) Resume()
3. The _____ method performs the cleanup of objects created during requests and
responses between clients and servers
[2.5]
a) Init() c) Destroy()
b) Resume() d) Run()
4. The two primary constituents of JavaBean are [2.5]
a) Properties c) Directives
b) Methods d) Scripting Elements
5. The used in JavaServer Pages are [2.5]
a) Jsp:useBean c) Jsp:setProperty
b) Jsp:ReuseBean d) Jsp:getProperty
6. J2EE consists of the following three tiers [2.5]
a) Presentation tier c) Implementation tier
b) Business tier d) Data tier
7. The JSP Model I architecture uses which of the following
i) It uses JSP along with beans
ii) JSP instantiates the bean, and then gets data from the bean for presentation
iii) View is the JSP
iv) Controller is the Servlet or JSP
[2.5]
a) i-ii


b) ii-iii
c) iii-iv
d) i-iv
8. ________ are small pieces of information that are deposited on the client by the
server
[2.0]
a) Session c) Directives
b) Cookies d) Scriptlets
9. _____ is a process which allows the bean container to examine any class at run-
time to determine its method signatures
[2.0]
a) Reflection c) Sockets
b) Cookies d) Serialization
10. _______ is the process of creating a copy of an object suitable for passing to
another object
[2.0]
a) Reflection c) Sockets
b) Cookies d) Serialization
11. The TCP/IP protocol is composed of the following layers [2.0]
a) Internet protocol c) Secure Socket Layer
b) Transmission control protocol d) Sockets
12. Which of the following are characteristics of JSP actions?
i) The tags are case-sensitive
ii) Actions can access, modify and create objects on the current server pages
iii) Tags must not have a closing delimiter
iv) new actions cannot be built
[2.0]
a) ii-iii c) ii-iv
b) iii-iv d) i-ii
13. In Javaserver pages one cannot separate content generation from presentation. [2.0]

a) True b) False
14. A java bean in a JSP can have which of the following attributes [2.5]
a) Page d) User
b) Request e) Application
c) Session
15. The ________ component is used to locate resources over the network such as
EJB components, database drivers and security credentials
[2.5]
a) JNDI c) JavaMail
b) JMS d) EJB
16. The two different errors that may occur during the lifecycle of JSP are [2.0]
a) Translation time errors c) Request time errors
b) Compile time errors d) Response time errors
17. The ________ represents a generic exception for the JSP packages [2.0]
a) JspException b) JspError
18. The concept of maintaining a state between different requests is known as Session
Tracking
[1.5]
a) True b) False
19. The jdbc classes are present in the java.lang package [1.5]
a) True
b) False
20. A JDBC application does the following in what order of steps?
i) Connects to a JDBC data source
ii) Parses the results of the query
iii) Executes a query
iv) closes the connection after the database operation
[2.5]
a) i-ii-iii-iv c) i-iii-ii-iv
b) iv-iii-ii-i d) ii-iii-iv-i

21. Which of the following can be used to access database from JSPs? [2.5]
a) Beans c) Custom tags
b) Scriplets d) Directives
22. The ________ interface is used to encapsulate SQL queries used for retrieving
data from the database
[2.0]
a) statement b) Driver
23. The different types of JDBC driver are [2.0]
a) Jdbc-odbc bridge, plus odbc driver d) Jdbc-net, pure Java driver
b) Native-API, partly Java driver e) Native-protocol pure java driver
c) Native-API, pure Java driver
24. JSPs can be deployed on a Web Logic Server. [0.5]
a) True b) False
25. 'out' is an instance of javax.jsp.JspWriter that
has several methods you can use to send output back to the browser.
[0.5]
a) False b) True
26. response.getWriter() method can be used within a JSP page. [0.5]
a) True b) False
27. class-scope objects are shared between multiple threads being
executed in the same instance of a servlet.
[0.5]
a) True b) False
28. Setting isThreadSafe to false consumes additional memory
And can cause performance to degrade.
[1.0]
a) True b) False
29. Which Two Errors occur when a JavaServer Page is first requested,
and goes through the initial translation from a source file to a servlet
class file.

[1.5]
a) Translation time errors c) Run time error
b) Request time errors d) Exception error
30. The Two main methods that JSP employs to track sessions are : [1.5]
a) Cookies c) URL rewriting
b) Applets d) Servlets
31. JSP is used for creating dynamic web pages using pure Java codes embedded as
_____________, _________________ and _________________.
[2.0]
a) Scriptlets c) User-defined tags
b) HTML tags d) Applets
32. The errorPage attribute of the page directive defines the current page as an error
page.
[1.5]
a) True b) False
33. Which of the following are true about a taglib directive? [2.0]
a) It declares that the page uses
custom tags.
c) It specifies a unique name for
the library of classes
referenced by the page
b) It specifies a unique name for the
library of custom tags
d) It associates a tag prefix that will
distinguish the usage of those
tags from regular tags.
34. Which of the following can be used for session tracking in JSP? [2.0]
a) Cookies c) URL rewriting
b) Session object d) All of the above
35. Which of the following is not a valid setting for the scope attribute of jsp: useBean

tag?
[2.0]
a) Page c) Local
b) Request d) Application
36. A jsp: setProperty tag cannot have both param and value attributes. [1.5]
a) True b) False
37. _________is an architecture for building re-usable server-side components. [2.0]
a) JSP c) JavaBean
b) Servlet d) EJB
38. Which of the following methods are the methods supported by RequestDispatcher
interface?
[2.5]
a) Forward() c) direct ()
b) include() d) redirect()
39. In case of JSP forward mechanism, the request object reaches the second
resource directly.
[2.0]
a) True b) False
40. SQL statement without parameters are normally executed using ________objects [1.5]
a) Statement c) PreparedStatement
b) CallableStatement
41. Which of the following classes can be extended to make a tag handler class for
JSP?
[2.5]
a) Tag c) BodyTagSupport
b) TagSupport
42. The __________attribute is used to define the location of the tag library
description file.
[2.0]
a) uri c) url

b) urn
43. The ________________approach of JSP model involves request invocations
being made directly to JSP.
[2.5]
a) Page-centric b) Dispatcher
44. __________are the errors resulting from the compilation failure of JSP source
files
[2.0]
a) Translation time errors c) Request time errors
b) Run time errors
45. In JSP model I architecture, the presentation logic is taken care by JSPs. [2.0]
a) True b) False
46. A generic Servlet should override which method to handle requests as
appropriate for the Servlet
[2.0]
a) DoGet c) Service
b) DoPost d) None of these
47. Which of the following are true about a JavaBean? [2.0]
a) A bean class must be concrete c) It must be serializable
b) It must have a default
constructor
d) A bean class must be abstract
48. ________class gives users an opportunity to save data to a database or file or to
do any other cleanup actions.
[2.0]
a) HttpSession c) HttpSessionContext
b) HttpSessionBindingListener d) HttpSessionBiningEvent
49. The class, BodyContent subclasses __________to accumulate the contents of a
BodyTag.
[2.5]

a) JspWriter c) PageContext
b) JspPage d) JspFactory
50. Servlets generally use ServletOutputStream to write text data to the response [1.0]
a) True b) False
51. The class, ServletConfig encapsulates servlet configuration and give access to
the application object.
[1.0]
a) True b) False
52. To load a java class file e.g. Aptech class, in the browser URL location bar we type [2.0]
a) http://localhost:8080/servlet/Aptec
h
c) http://localhost:9090/servlet/Aptech
b) http://localhost:3030/servlet/Aptech d) http://localhost:/servlet/Aptech
53. The service method of the GenericServlet Class is: [2.0]
a) Overridden c) Overloop
b) Overhidden d) Both
54. User define Servlet use two methods such as: [2.0]
a) Init and Destroy c) Both
b) Get and Post d) Only Init
55. The following techniques can be employed to maintain state in Web Applications: [2.0]
a) HTTP Information d) Jspinit ()
b) Hidden Fields e) getWriter()
c) Extended path information and
the URL Rewriting Cookies
56. Which of the following items can exist in a web application? [2.0]
a) JavaServer Pages c) Meta information that describes
the web application
b) Static Documents including,
XHTML, images etc.
d) All of the above

57. File Servlet is used [2.5]
a) As a Java web server
administration tool
c) For serving documents files for
the java web server
b) To invokes user written Servlets
files
d) None of the above
58. If the service method is not overridden by the user in servlet class then the
service method calls the ________
[2.5]
a) Sub Class Service c) Both
b) Super Class Service d) None of the options given

Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×