1. Trang chủ
  2. » Công Nghệ Thông Tin

Dynamic Pages using JSP

23 6,4K 19
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 23
Dung lượng 602,5 KB

Nội dung

The three main types of JSP constructs that can be embedded in a Java Server page are

Trang 1

Dynamic Pages using JSP

1 The three main types of JSP constructs that can be embedded in a Java Server

page are

[2.0]

c) Resume()

3 The _ method performs the cleanup of objects created during requests and

a) Presentation tier c) Implementation 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

Trang 2

9 _ is a process which allows the bean container to examine any class at

run-time to determine its method signatures

11 The TCP/IP protocol is composed of the following layers [2.0]

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

Trang 3

c) Session

15 The component is used to locate resources over the network such as

EJB components, database drivers and security credentials

[2.5]

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]

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]

21 Which of the following can be used to access database from JSPs? [2.5]

Trang 4

22 The interface is used to encapsulate SQL queries used for retrieving

data from the database

[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

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]

26 response.getWriter() method can be used within a JSP page [0.5]

27 class-scope objects are shared between multiple threads being

executed in the same instance of a servlet

[0.5]

28 Setting isThreadSafe to false consumes additional memory

And can cause performance to degrade

[1.0]

Trang 5

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

30 The Two main methods that JSP employs to track sessions are : [1.5]

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 thosetags from regular tags

34 Which of the following can be used for session tracking in JSP? [2.0]

Trang 6

35 Which of the following is not a valid setting for the scope attribute of jsp: useBean

Trang 7

43. The approach of JSP model involves request invocations

44. are the errors resulting from the compilation failure of JSP source

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]

46. A generic Servlet should override which method to handle requests as

appropriate for the Servlet

[2.0]

47. Which of the following are true about a JavaBean? [2.0]

a) A bean class must be concrete c) It must be serializable

Trang 8

b) It must have a default

48. class gives users an opportunity to save data to a database or file or to

51. The class, ServletConfig encapsulates servlet configuration and give access to

the application object

Trang 9

54. User define Servlet use two methods such as: [2.0]

55. The following techniques can be employed to maintain state in Web Applications: [2.0]

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

a) As a Java web server

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]

b) Super Class Service d) None of the options given

Trang 10

59. The Javax Servlet Package contains classes to support [2.0]

a) Generic Protocol Independent

b) Non Generic non independent d) None of the above

60. Servlet are durable objects because they remain in the memory until they are

destroyed _

[2.5]

61. Which of the following are the elements included in deployment descriptor? [2.0]

a) ServletContext Init Parameters c) Session Configuration

b) Global Content d) Servlet / JSP Mappings

62. Which of the following is true regarding "jar cvf onjava.war" [2.0]

a) Will produce an empty archive file

named onjava.war

c) Will produce an archive filenamed onjava.war that willcontain the partial web application

b) Will produce an archive file

named onjava.war that will

contain the entire web

application

d) The Syntax of the command iserror prone

63. Building Web pages on the fly is useful for a number of reasons [2.5]

a) The Web page is based on data

submitted by the user

d) The Web page may use information from corporate databases or other related sources

Trang 11

b) The data changes frequently e) The Web page is not based on

data submitted by the user

c) The data remains static

a) http://host

[port]/path/resource_name

[#section][?query_string]

c) http://host[port]/path/resource_name[?section][#query_string]

b) http://host

[:port]/path/resource_name

[#section][?query_string]

d) http://host[:port]/path/resource_name[?section][#query_string]

65. public void doGet ( HttpServletRequest req, HttpServletResponse res )throws

a) 14 String objects are created to

work with c) 12 String objects are created to work with

b) 13 String objects are created to

work with

d) The above will result in an error

66. Net Pure Java Driver has the following implementation features [2.0]

Trang 12

a) The size of this driver is smaller

than all other types.

c) No configuration is required

b) The size of this driver is greater

than all other types d) Configuration is required

67. getTimestamp( ) method is used for extracting [2.0]

68. Which of these operations are provided by DML Data Manipulation Language [2.5]

a) Encoding the data c) Creating table

b) Creating & deleting a table d) Inserting data and updating

71. Each JSP goes through two phases Select them [1.5]

a) Translation request time c) Translation time

b) Executable time d) Request time

Trang 13

72. Which of the following attribute represents the relative URL to the JSP that

Will handle exceptions

[1.5]

a) isErrorPage=”true | false” c) isErrorPage=”URL_error”

b) errorPage=”<error_URL>” d) errorPage=”<URL_address>”

73. Which of the following attribute determines if the output stream is buffered [1.5]

a) buffer=”output | size” c) buffer=”none | <size in kb>”

b) buffer=”<size> | none” d) Stream=”output | buffer”

74. What are the three directives defined in the JSP specification [1.5]

a) declares variables count and ctr c) Initializes variables count and ctr

b) declares variables count and ctr

and initializes them

d) Will result in an error

77. Variables created within a declaration block become _ variables [0.5]

Trang 14

a) Session c) Instance

78. Which of the following action is used to provide the tag/value pairs of information,

by including attributes like <jsp:include>

82. To invoke a servlet, create a HTML page that will send a request to the servlet

using the _ method

[1.5]

Trang 15

83. The final method overridden in the HelloServlet is [2.0]

a) getSrvlet() c) getServletInformation()

b) getServltInfo() d) getServletInfo()

a) Set a reference to the servlet by

naming it in the URL.

c) Create an HTML page, which will invoke the POST method.

b) Set a reference to the browser d) Create an applet and set a

reference to the servlet

85. Which of the following are methods contained in the javax.servlet.jsp.JspPage

(Select all that apply)

87 Definition of the tag, its attributes, and its body are interpreted, and then

grouped into collections called _

[1.0]

a) Tag collection c) Tag libraries

88. JavaBeans API can be used to create and components [1.0]

a) Platform-independent and generic c) Reusable and platform-

independent

Trang 16

b) Platform-independent and

reusable

d) Bean and Reusable

89. Statement 1: Every bean must have a default constructor

Statement 2: In JSP, JavaBeans need not implement the serializable interface

[2.0]

a) 1 is true, 2 is false c) Both are true

b) 1 is false, 2 is true d) Both are false

90. A bean communicates with the outside world through events, generated when the

internal state of the bean changes

[0.5]

91. The following event is used to notify a bean that it has been added to, or removed

a) HttpSessionBindingEvent c) HttpBindingEvent

b) SessionEvent d) SessionBindingEvent

92. Following are the advantages of beans (Select all that apply) [2.0]

a) Beans may register to receive

events from other objects

c) A bean can be designed to operate correctly in different locales.

b) Beans are not

platform-independent d) Beans can generate events that are sent to other objects

93. The action is used to associate a JavaBean in JSP [1.0]

94. Following are the attributes of setProperty (Select all that apply) [1.5]

Trang 17

96. The property tells the session, which protocol to use as the

default transport provider

[1.0]

a) mail.transport.protocol c) mail.transport

b) transport.protocol d) mail.protocol

97. The J2EE framework consists of which of the following deliverables [2.0]

a) J2EE platform specifications c) J2EE Reference

Implementation b) J2EE Compatibility Test Suite d) J2EE platform framework

98. The consists of the programming model for the J2EE applications [1.5]

a) J2EE platform specifications c) J2EE Compatibility Test Suite

99. Which component of the J2EE framework adds CORBA technology to the JAVA

Trang 18

100 What does the JAF component of the J2EE framework stand for? [1.5]

a) Java Activation Framework c) JavaBeans Activation

102 What is the syntax to indicate the page is a JSP error page [1.0]

a) <% isErrorPage=”true”%> c) <%@page isErrorPage

=”true”%>

b) <%@page Error=”true”%> d) <@page isErrorPage=”true”@>

103 The _ class in the javax.servlets.jsp package is the only predefined

Trang 19

a) It uses JSP along with beans c) Gets data from the bean for

presentation b) It follows the Bean-Data pattern d) It instantiates the bean.

106 J2EE supports cross-platform development such as (Select all that apply) [2.0]

107 The concept of maintaining a state between different requests is known as

a) Session mapping c) Session waiting

b) Session request d) Session tracking

a) Users can choose not to accept

cookies c) Browsers may not be able to accept cookies

b) Cookies take a huge amount of

space on the hard disk d) They are highly time consuming

Trang 20

111 JSPs or servlets can manipulate cookies using the _ class [1.0]

a) javax.servlets.http.Cookie c) javax.http.Cookie

b) javax.servlets.Cookie d) servlets.http.Cookie

112 The _ method is used to specify different life spans for a cookie [0.5]

a) setCookieAge(int minutes) c) setMaxAge(int seconds)

b) setCookieAge(int seconds) d) setMaxAge(int minutes)

a) For encoding URLs that send the

116 An object can be bound using the method in the HTTPRequest interface [1.0]

a) BindAttribute(string key, Object obj) c) SetAtrtibute(string key)

b) SetAttribute(string key,Object

obj)

d) Bindattribute(string object)

Trang 21

117 What are the requirements to qualify for a JSP sub-class [2.0]

a) It must provide a jspDestroy()

The above statement

1 loads the JDBC-ODBC bridge drivers

2 unloads the JDBC-ODBC bridge drivers

[1.5]

a) 1 is true, 2 is false c) 1 and 2 are true

b) 1 is false, 2 is true d) 1 and 2 are false

120 The interface is used to encapsulate SQL queries used for retrieving

121 The executeUpdate() method returns a count of rows in the table that were

affected by the query

Trang 22

123 con=DriverManager.getConnection(“jdbc:odbc: Employee”,” “,” “);

What does the above statement do

[2.0]

a) Gets a database connection with

the Employee data source.

c) Inidcates that jdbc is to be used inthe application

b) Gets connected to the employee

database

d) Retrieves data from the employeetable

124 Four different types of JDBC drivers as specified by Sun are: [2.0]

a) JDBC protocol API driver d) JDBC-net, pure Java driver

b) JDBC-ODBC Bridge, plus ODBC

c) Native-API, partly-Java driver

125 The _ interface communicates with the database, either directly or through

another database specific driver

Ngày đăng: 09/04/2013, 09:10

TỪ KHÓA LIÊN QUAN

w