chapter 13

advertisement
Programming Right From the Start with Visual Basic.NET
CHAPTER 13
Advanced Web Forms with Databases
True-False Questions
1.
ADO.NET and ASP.NET are tools used to create three-tier application architecture.
Answer: True
Level: Easy
Section: 13-1
Page: 345
2.
The typical three-tier architecture has the database as the middle tier.
Answer: False
Level: Easy
Section: 13-1
Page: 345
3.
A medium client refers to the application layer.
Answer: False
Section: 13-1
Level: Moderate
Page: 345
4.
The logical layer acts as a mediator between the user and the database.
Answer: False
Level: Moderate
Section: 13-1
Page: 345
5.
A web browser is a good example of a thin client.
Answer: True
Section: 13-1
Level: Easy
Page: 345
6.
Business logic stored in a web server module is easy to maintain and modify.
Answer: True
Level: Moderate
Section: 13-1
Page: 345
7.
A disadvantage of using an application layer is that the number of connections is less than if users
connected directly with the database.
Answer: False
Level: Moderate
Section: 13-1
Page: 345
8.
The three-tier architecture can help to conserve network and server resources.
Answer: True
Level: Moderate
Section: 13-1
Page: 346
9.
No more than two computers may be placed in a server farm.
Answer: False
Level: Easy
Section: 13-1
Page: 346
10.
A three-tier architecture can exist on a single computer.
Answer: True
Level: Easy
Section: 13-1
Page: 346
13 - 1
Chapter 13 – Advanced Web Forms with Databases
11.
The two types of methods for tracking the state of a web page are client-side and data-side.
Answer: False
Level: Easy
Section: 13-2
Page: 346
12.
A web server needs special techniques to know the state of previous web pages.
Answer: True
Level: Easy
Section: 13-2
Page: 346
13.
The only way to store information about the state of a web page is to store it on a client machine.
Answer: False
Level: Easy
Section: 13-2
Page: 346
14.
Client-side state management techniques cannot be changed by the end user.
Answer: False
Level: Easy
Section: 13-3
Page: 346
15.
The view state is always stored on the client machine.
Answer: False
Section: 13-3
Level: Moderate
Page: 347
16.
The information about a page’s view state is visible in the HTML source.
Answer: True
Level: Moderate
Section: 13-3
Page: 347
17.
The length of a query string is limited to 128 characters.
Answer: False
Level: Easy
Section: 13-3
Page: 347
18.
A query string is information stored at the end of a URL.
Answer: True
Level: Easy
Section: 13-3
Page: 347
19.
Query strings are the most secure type of state management technique.
Answer: False
Level: Moderate
Section: 13-3
Page: 347
20.
Using cookies is unreliable because users can refuse to have them stored on a machine.
Answer: True
Level: Easy
Section: 13-3
Page: 347
21.
Cookies are attached to a web page before being sent to the browser.
Answer: False
Level: Moderate
Section: 13-3
Page: 347
22.
An appliance state is an example of a server-side state management technique.
Answer: False
Level: Moderate
Section: 13-4
Page: 348
13 - 2
Chapter 13 – Advanced Web Forms with Databases
23.
Server-side state management techniques should be used to keep sensitive information secure.
Answer: True
Level: Easy
Section: 13-4
Page: 348
24.
The application variable can be accessed by any code in any file in a web application.
Answer: True
Level: Easy
Section: 13-4
Page: 348
25.
The key term Application.VariableName is used to read or write to an application variable.
Answer: False
Level: Moderate
Section: 13-4
Page: 348
26.
An application variable is dimensioned like all other variables.
Answer: False
Level: Hard
Section: 13-4
Page: 348
27.
The syntax for creating a session variable is similar to that for creating an application variable.
Answer: True
Level: Easy
Section: 13-4
Page: 349
28.
All browsers share the same session variables.
Answer: False
Section: 13-4
Level: Easy
Page: 349
29.
Using a database means that no state information will be lost if all web servers are turned off for
maintenance.
Answer: True
Level: Moderate
Section: 13-4
Page: 349
30.
A database can efficiently store state information for high volume web applications.
Answer: True
Level: Easy
Section: 13-4
Page: 350
13 - 3
Chapter 13 – Advanced Web Forms with Databases
Multiple Choice Questions
31.
Which is not a fundamental service identified in a three-tier architecture?
a.) Association layer
b.) Connection layer
c.) Logical layer
d.) Both a and b.
e.) All of the above.
Answer: e
Section: 13-1
32.
Level: Moderate
Page: 345
Which layer is exemplified by a web server?
a.) Application
b.) Association
c.) Data
d.) Logical
e.) Presentation
Answer: a
Section: 13-1
33.
Level: Easy
Page: 345
Which layer is exemplified by a fat client?
a.) Application
b.) Association
c.) Data
d.) Logical
e.) Presentation
Answer: e
Section: 13-1
34.
Level: Moderate
Page: 345
Which layer is exemplified by the use of ADO.NET?
a.) Application
b.) Association
c.) Data
d.) Logical
e.) Presentation
Answer: c
Section: 13-1
Level: Moderate
Page: 345
13 - 4
Chapter 13 – Advanced Web Forms with Databases
35.
How will using a middle tier typically affect the number of connections to a database?
a.) Increase the number
b.) Have no effect on the number
c.) Decrease the number
d.) It depends on the type of client.
e.) It depends on the type of database.
Answer: c
Section: 13-1
36.
Level: Hard
Page: 345
An application layer:
a.) will contain business logic.
b.) manage connections to the database.
c.) can be distributed over many computers.
d.) Both a and b.
e.) All of the above.
Answer: e
Section: 13-1
37.
Level: Moderate
Page: 345
A data layer is responsible for:
a.) retrieving information from a database.
b.) updating information in a database.
c.) deleting information in a database.
d.) Both a and b.
e.) All of the above.
Answer: e
Section: 13-1
38.
Level: Easy
Page: 345
What is the minimum number of computers in a three-tier architecture?
a.) 0
b.) 1
c.) 2
d.) 3
e.) 4 or more
Answer: b
Section: 13-1
39.
Level: Easy
Page: 346
A server farm is:
a.) an example of a distributed application.
b.) makes it easy to add new computers if demand increases.
c.) applies only to web servers.
d.) Both a and b.
e.) All of the above.
Answer: d
Section: 13-1
Level: Moderate
Page: 346
13 - 5
Chapter 13 – Advanced Web Forms with Databases
40.
Which is a valid type of state management for the creation of web pages?
a.) Client side
b.) Server side
c.) Data side
d.) Both a and b.
e.) All of the above.
Answer: d
Section: 13-2
41.
Level: Easy
Page: 346
The stateless HTTP protocol refers to web pages created:
a.) on a web server.
b.) without information from a database.
c.) without knowledge of previous web pages.
d.) before a request from a client.
e.) on a client machine.
Answer: c
Section: 13-2
42.
Level: Moderate
Page: 346
Client-side state management techniques are appropriate when using:
a.) sensitive information.
b.) critical applications.
c.) an intranet.
d.) Both a and b.
e.) All of the above.
Answer: c
Section: 13-3
43.
Level: Moderate
Page: 346
Where does the view state store information?
a.) HTML source
b.) Text file
c.) URL
d.) Both a and b.
e.) All of the above.
Answer: a
Section: 13-3
44.
Level: Moderate
Page: 347
Where does the query string store information?
a.) HTML source
b.) Text file
c.) URL
d.) Both a and b.
e.) All of the above.
Answer: c
Section: 13-3
Level: Moderate
Page: 347
13 - 6
Chapter 13 – Advanced Web Forms with Databases
45.
Where do cookies store information?
a.) HTML source
b.) Text file
c.) URL
d.) Both a and b.
e.) All of the above.
Answer: b
Section: 13-3
46.
Level: Moderate
Page: 347
Which client-side technique is specific to ASP.NET?
a.) Cookies
b.) Query string
c.) View state
d.) Both a and b.
e.) All of the above.
Answer: c
Section: 13-3
47.
Level: Hard
Page: 347
Which client-side technique can be disabled by the end-user?
a.) Cookies
b.) Query string
c.) View state
d.) Both a and b.
e.) All of the above.
Answer: a
Section: 13-3
48.
Level: Moderate
Page: 347
What symbol specifies the beginning of a query string?
a.) @
b.) #
c.) $
d.) %
e.) ?
Answer: e
Section: 13-3
49.
Level: Easy
Page: 347
What is the syntax for creating and using an application variable?
a.) Application.VariableName = Value
b.) Application.VariableName = (Value)
c.) Application(VariableName) = Value
d.) Application(VariableName) = (Value)
e.) Application(“VariableName”) = Value
Answer: e
Section: 13-4
Level: Moderate
Page: 348
13 - 7
Chapter 13 – Advanced Web Forms with Databases
50.
Which server-side technique is available in ASP.NET?
a.) Application states
b.) Session states
c.) Database support
d.) Both a and b.
e.) All of the above.
Answer: d
Section: 13-4
51.
Level: Easy
Page: 349
An Application variable is created:
a.) when the application is first placed on a web server.
b.) when the web server is first started.
c.) when the first client requests a URL resource.
d.) every time a client requests a URL resource.
e.) every time a new client interacts with the web application.
Answer: c
Section: 13-4
52.
Level: Moderate
Page: 348
A Session variable is created:
a.) when the application is first placed on a web server.
b.) when the web server is first started.
c.) when the first client requests a URL resource.
d.) every time a client requests a URL resource.
e.) every time a new client interacts with the web application.
Answer: e
Section: 13-4
53.
Level: Moderate
Page: 349
If there is no activity from a browser, how long will a session variable last?
a.) 10 minutes
b.) 20 minutes
c.) 60 minutes
d.) 100 minutes
e.) 200 minutes
Answer: b
Section: 13-4
54.
Level: Easy
Page: 349
Which is not a reason for using a database to store state information?
a.) The capacity to store high volumes of information
b.) The ability to use data mining techniques on the stored information
c.) The ability to use application and session variables
d.) Security from unauthorized use
e.) The power to easily query for specific information
Answer: c
Section: 13-4
Level: Hard
Page: 350
13 - 8
Chapter 13 – Advanced Web Forms with Databases
Fill in the Blank Questions
55.
Most applications can be partitioned into three logical layers: ___presentation___,
application___, and ___data___ layers.
Level: Easy
Section: 13-1
Page: 344
56.
In a three-tier system architecture an Access database represents the ___data___ layer.
Level: Easy
Section: 13-1
Page: 345
57.
In a three-tier system architecture a web browser represents the ___presentation___ layer.
Level: Easy
Section: 13-1
Page: 345
58.
In a three-tier system architecture an IIS Web server represents the ___application___ layer.
Level: Easy
Section: 13-1
Page: 345
59.
A(n) ___fat client___ refers to a user’s computer that has a substantial processing load.
Level: Moderate
Section: 13-1
Page: 345
60.
Mobile computing devices run as a(n) ___thin client___ user layer architecture.
Level: Moderate
Section: 13-1
Page: 345
61.
Changing business rules is easy when they are contained in modules located in the
___application___ layer.
Level: Moderate
Section: 13-1
Page: 345
62.
The ___application___ layer shields the end user from the details of using the database.
Level: Moderate
Section: 13-1
Page: 345
63.
A(n) ___server farm___ is a collection of computers that share the work of an application or data
layer.
Level: Moderate
Section: 13-1
Page: 346
64.
The protocol for creating web pages is ___stateless___ because new pages are created without
information about the previous web pages.
Level: Hard
Section: 13-2
Page: 346
65.
The technique of ___state management___ is the process of storing information over multiple
web page requests.
Level: Moderate
Section: 13-2
Page: 346
13 - 9
Chapter 13 – Advanced Web Forms with Databases
66.
Storing information about previous web pages on the ___client___ side is best done with secure,
intranet applications.
Level: Moderate
Section: 13-2
Page: 346
67.
Cookies are an example of ___client side___ state management.
Level: Easy
Section: 13-3
Page: 346
68.
ASP.NET can save the state of a page as a part of the ___view state___ facility.
Level: Moderate
Section: 13-3
Page: 347
69.
The information in a(n) ___query string___ is visible in the web page’s URL.
Level: Moderate
Section: 13-3
Page: 347
70.
Information about a web page that is stored in a text file is called a(n) ___cookie___.
Level: Moderate
Section: 13-3
Page: 347
71.
The ___application___ state holds information for the life of a web application.
Level: Moderate
Section: 13-4
Page: 348
72.
The first request for a URL resource generates the ___application state___.
Level: Moderate
Section: 13-4
Page: 348
73.
The key term for creating an application variable is ___Application___.
Level: Easy
Section: 13-4
Page: 348
74.
Each ___browser___ that requests a web application gets its own session state.
Level: Moderate
Section: 13-4
Page: 349
75.
The key term for creating a session variable is ___Session___.
Level: Easy
Section: 13-4
Page: 349
76.
Session variables will be lost after ___20 minutes___ inactivity.
Level: Moderate
Section: 13-4
Page: 349
13 - 10
Chapter 13 – Advanced Web Forms with Databases
77.
Increase security is an advantage of the ___database___ server-side state management technique.
Level: Moderate
Section: 13-4
Page: 350
78.
Application layers are ___worse__ than data layers at storing large volumes of state information.
Level: Moderate
Section: 13-4
Page: 350
79.
State information store in a database is considered ___persistent___ because it is less prone to
server crashes than web servers.
Level: Hard
Section: 13-4
Page: 350
Essay Questions
80.
Identify and describe the layers of a three-tier architecture.
The three-tier architecture breaks the logic of an application into three modules, called layers.
These layers are Presentation, Application, and Data. Physically these three layers can reside on
the same computer or three separate computers. The design of the architecture is a conceptual
division of functionality.
The Presentation layer is the part of the application that the end user sees and interacts with. It
hides the details of the other layers and makes the application easy to use. This layer can be a
Windows form processing data locally on a client’s computer (fat client) or an internet browser
with displaying an ASP.NET Web form (thin client).
The Application layer has two main functions: to process business rules and interact with the
data layer. This layer typically is a web server that delivers web pages to a browser, but it can
also be an application server on an intranet that communicates to with the Windows form
presentation layer. The advantage of the application layer is that changes in business rules (a
new state tax rate) require changes on a few application servers, rather than the thousands of
computers that hold the presentation layer.
The Data layer is where all of the information vital to the business is stored. Typically this is
done is a database, but flat files (text files) can be used as well. It is best to use databases because
they are designed to accurately modify (add, delete, edit) and retrieve (query) data. The fact that
only the application layer interacts with the database increases the security of the information
stored in the data layer.
81.
What is State Management? Describe and give examples of the two types of State Management
techniques.
State management is the storage of information about web pages each time a user accesses a web
server. This is important because one web server is designed to serve many clients and the HTTP
protocol does not require that the state of each web page be remembered. When a server farm of
web servers is used, it is possible that each request to the web site will go to a different computer
13 - 11
Chapter 13 – Advanced Web Forms with Databases
making it impossible for one web server to know what web page the other web server just sent
out.
One method to store the state of a web page is to embed the information on the Client (end
user’s) machine in the form of a View State, Query String, or Cookie. The View State is a feature
provided by ASP.NET which will store information about the state of the web page in the HTML
source. The Query String is information stored in the URL address (identified with a ?). A
Cookie is a text file stored on the client’s computer. Because the information store with these
techniques is accessible by the end user, client-side techniques should not be used to store vital or
sensitive information.
The other method to store the state of a web page is to store the information on a server. This
can be either a web server in the form of Application or Session variables, or on a database
server. Both methods are better at keeping data secure.
13 - 12
Download