Chapter 25 Web Applications Test Bank Docx Horstmann - Big Java Early Objects 5e Complete Test Bank by Cay S. Horstmann. DOCX document preview.
Course Title: Big Java, Early Objects
Chapter Number: 25 Web Applications
Question type: Multiple Choice
1) In a web application, the web server sends pages formatted in ____.
a) XML
b) HTML
c) Text
d) JavaBeans
Title: The web server sends pages formatted in ____.
Difficulty: Easy
Section Reference 1: 25.1 The Architecture of a Web Application
2) The purpose of a JSF page is to generate a ____ page.
a) Hyper Text Markup Language
b) Server
c) Java Formatted
d) Browser
Title: The purpose of a JSF page is to generate a(n) ___ page.
Difficulty: Easy
Section Reference 1: 25.2 The Architecture of a JSF Application
3) ____ link JSF pages with Java objects.
a) JavaBeans
b) Browsers
c) Value expressions
d) Session bindings
Title: ____ link JSF pages with Java objects.
Difficulty: Easy
Section Reference 1: 25.2 The Architecture of a JSF Application
4) ____ support the separation of presentation and business logic.
a) Session expressions
b) Application expressions
c) Value expressions
d) Method expressions
Title: ____ support the separation of presentation and business logic.
Difficulty: Easy
Section Reference 1: 25.2 The Architecture of a JSF Application
5) JSF page syntax is a mixture of ______ and JSF-specific tags.
a) XML
b) Beans
c) HTML
d) JSP
Title: JSF page syntax is a mixture of ___ and JSF-specific tags.
Difficulty: Easy
Section Reference 1: 25.2 The Architecture of a JSF Application
6) Which of the following is an example of a server with a JSF container?
a) JSF
b) GlassFish
c) JDBC
d) JSP
Title: Which of the following is an example of a server with a JSF container?
Difficulty: Medium
Section Reference 1: 25.2 The Architecture of a JSF Application
7) Which of the following contains a method expression?
a) <h:outputText value="#{zone.time}" />
b) <h:commandButton value="Submit" action="#{timeZoneBean.checkCity}"/>
c) <h:inputText value="#{zone.city}" />
d) <h:body> ... </h:body>
Title: Which of the following contains a method expression?
Difficulty: Easy
Section Reference 1: 25.4 Navigation Between Pages
8) ______ of a bean component can be accessed by tools without having to write Java code.
a) Options
b) Elements
c) Types
d) Properties
Title: ____ of a bean component can be accessed by tools.
Difficulty: Medium
Section Reference 1: 25.3 JavaBeans Components
9) Every bean must have a ____ with no arguments.
a) read method
b) set method
c) constructor
d) get method
Title: Every bean must have a __ with no arguments.
Difficulty: Easy
Section Reference 1: 25.3 JavaBeans Components
10) If the scope of a managed bean has been set to _______, then the bean stays alive during multiple requests from the same browser.
a) session
b) global
c) private
d) public
Title: If the scope of a managed bean is ___, it stays alive during multiple requests.
Difficulty: Easy
Section Reference 1: 25.2 The Architecture of a JSF Application
11) What does the value expression timeBean.time do?
a) Sets the timeBean.time instance variable.
b) Calls the timeBean.setTime method
c) Calls the timeBean.getTime method
d) Creates an input field called time.
Title: What does the value expression timeBean.time do?
Difficulty: Medium
Section Reference 1: 25.3 JavaBeans Components
11) What does the value expression timeZoneBean.city do when it is part of the JSF tag <h:inputText value="#{timeZoneBean.city}"/>?
a) Sets the timeBean.city instance variable.
b) Calls the timeBean.setTime method
c) Calls the timeBean.setTime method method
d) Calls either the timeBean.setTime or timeBean.setTime method
Title: What does the value expression timeZoneBean.city do when in an input tag?
Difficulty: Medium
Section Reference 1: 25.3 JavaBeans Components
13) The Java library contains a _______ class that provides information about time zones around the world.
a) Time
b) Zone
c) TimeDate
d) TimeZone
Title: The ___ class provides information about time zones around the world.
Difficulty: Easy
Section Reference 1: 25.4 Navigation between pages
14) Suppose a DictionaryBean class has a method String getLanguage(). Which JSF page statement would display the language properly?
a) The language of the dictionary is value="dictionaryBean.getLanguage".
b) The language of the dictionary is #{dictionaryBean.getLanguage}.
c) The language of the dictionary is value="#{dictionaryBean.language}".
d) The language of the dictionary is #{dictionaryBean.language}.
Title: One characteristic of a JavaBean is that ____.
Difficulty: Easy
Section Reference 1: 25.4 Navigation between pages
15) One of the required steps in designing a JavaBean is:
a) Implement the get and set methods for all properties.
b) Implement a constructor with one argument.
c) Implement the helper methods.
d) Add the JSF components needed.
Title: One of the required steps in designing a JavaBean is:
Difficulty: Medium
Section Reference 1: 25.4 Navigation between pages
16) Name one of the requirements for a Java class to become a JavaBean?
a) A JavaBean must have get, set, and command action methods.
b) A JavaBean must have only get and set methods.
c) A JavaBean must have a public constructor with one or more arguments.
d) A JavaBean must have a public constructor with no arguments.
Title: What is required for a Java class to become a JavaBean?
Difficulty: Easy
Section Reference 1: 25.4 Navigation between pages
17) In JSF, button groups and ____ require that you specify two properties: the collection of possible choices and the actual choice.
a) menus
b) cookies
c) images
d) text areas
Title: Button groups and ____ require that you specify two properties...
Difficulty: Easy
Section Reference 1: 25.5 JSF Components
18) The keys of the map specified in f:selectItems are the ____ that are displayed next to each choice.
a) attributes
b) text
c) labels
d) values
Title: The keys of a map specified in f:selectItems are...
Difficulty: Easy
Section Reference 1: 25.5 JSF Components
19) The ____ tag is used to specify all choices for a component that allows selection from a list of choices.
a) h:commandButton
b) f:selectItems
c) h:selectManyRadio
d) h:inputText
Title: The ____ tag is used to specify all choices for a component with a list of choices.
Difficulty: Easy
Section Reference 1: 25.5 JSF Components
20) The collection of choices for a radio button tag can be specified with a ___ tag.
a) f:selectItems
b) f:Items
c) f:selectRadioItems
d) f:selectChoiceItems
Title: A collection of choices can be specified with a ___ tag.
Difficulty: Easy
Section Reference 1: 25.5 JSF Components
21) A method _________ specifies a bean and a method that should be invoked on the bean.
a) property
b) name
c) expression
d) value
Title: A method ___ specifies a bean and a method to be invoked.
Difficulty: Easy
Section Reference 1: 25.4 Navigation Between Pages
22) Which of the following statements is correct?
a) A server with a JSF container such as GlassFish manages a pool of database connections.
b) JSF tags use XML syntax but the / before the closing angle bracket is not required.
c) JSF tags are case insensitive.
d) A JSF page cannot contain XML tags.
Title: Which statement about JSF applications is correct?
Difficulty: Easy
Section Reference 1: 25.2 The Architecture of a JSF Application
23) Which of the following represents part of the business logic of a three-tier application?
a) Web browser
b) The database
c) JSF container
d) The network
Title: Which represents the business logic of a three-tier application?
Difficulty: Easy
Section Reference 1: 25.6 A Three-Tier Application
24) To query a database, a JavaBean needs a(n) ____________ object.
a) Table
b) Connection
c) Bean
d) HTML
Title: To query a database, a JavaBean needs a ___ object.
Difficulty: Medium
Section Reference 1: 25.6 A Three-Tier Application
25. What is the difference between the client-server architecture and the three-tier architecture?
a) In the three-tier architecture, each tier is a database server.
b) In the client-server architecture, each client program has a presentation layer.
c) The three-tier application must be distributed over all desktops, but client-server does not.
d) The client-server application must reside on a server, but three-tier does not.
Title: Contrast client-server architecture and three-tier architecture
Difficulty: Medium
Section Reference 1: 25.6 A Three-Tier Application
26) A _______ is an application whose user interface is displayed in a web browser.
a) server application
b) web application
c) client application
d) internet application
Title: A(n) ____________ is an application whose user interface is displayed in a web browser.
Difficulty: Easy
Section Reference 1: 25.1 The Architecture of a Web Application.
27) Where does the application program of a web application reside?
a) On the client server.
b) On the web server.
c) On the client side.
d) On the browser client.
Title: Where does the application program reside?
Difficulty: Easy
Section Reference 1: 25.1 The Architecture of a Web Application.
28) The user interface of a web application is displayed in a ______.
a) protocol
b) server browser
c) web browser
d) web server
Title: The user interface of a web application is displayed in a ______.
Difficulty: Easy
Section Reference 1: 25.1 The Architecture of a Web Application.
29) When a form from a web application is submitted by a user, where are the form elements sent?
a) to a database pool
b) to a server browser
c) to a web browser
d) to a web server
Title: When a form is submitted, where are the form elements sent?
Difficulty: Easy
Section Reference 1: 25.1 The Architecture of a Web Application.
30) An HTML page contains ____ that describe the structure of the page.
a) heading
b) links
c) tags
d) input elements
Title: An HTML page contains ____ that describe the structure of the page.
Difficulty: Medium
Section Reference 1: 25.1 The Architecture of a Web Application.
31) When a submit button is pressed in a simple JSF application, what does the outcome string represent?
a) the next page to be displayed
b) the error message to be displayed
c) the data submitted by the user
d) the data to be displayed
Title: When a submit button is pressed, what does the outcome string represent?
Difficulty: Medium
Section Reference 1: 25.4 Navigation Between Pages
32) One of the web application frameworks that has been developed is ________.
a) JavaServer Framework
b) JavaServer Faces
c) HTTP
d) JEEF
Title: One of the web application frameworks that have been developed is:
Difficulty: Medium
Section Reference 1: 25.1 The Architecture of a Web Application.
33) Both Swing and JSF handle the tedious details of capturing user input, but JSF ________.
a) is a client application.
b) hides high-level details.
c) handles form-posting events.
d) paints pixels in a frame.
Title: JSF handles:
Difficulty: Medium
Section Reference 1: 25.1 The Architecture of a Web Application.
34) Swing differs from JSF in that it ________.
a) handles form-posting events.
b) paints pixels in a frame.
c) paints by emitting HTML code.
d) hides high-level details.
Title: Swing differs from JSF in that it ________.
Difficulty: Medium
Section Reference 1: 25.1 The Architecture of a Web Application.
35) The user interface of a JSF application is described by ________.
a) a set of HTML-only pages.
b) a set of JSF servers.
c) a set of JSF events.
d) a set of JSF pages.
Title: The user interface of a JSF application is described by:
Difficulty: Easy
Section Reference 1: 25.2 The Architecture of a JSF Application.
36) A set of JSF pages makes ________.
a) the user interface of a web application.
b) the user interface of a database application.
c) the user interface of a server application.
d) the user interface of a client application.
Title: A set of JSF pages makes:
Difficulty: Easy
Section Reference 1: 25.2 The Architecture of a JSF Application.
37) A JSF page contains ________.
a) HTML tags.
b) HTML tags and JSF tags.
c) JSF tags only.
d) no tags at all.
Title: A JSF page contains:
Difficulty: Easy
Section Reference 1: 25.2 The Architecture of a JSF Application.
38) Several elements of a JSF page are tags with a(n) ________.
a) h: prefix.
b) a: prefix.
c) <? prefix.
d) </ prefix.
Title: Several elements of a JSF page are tags with a(n) ________.
Difficulty: Easy
Section Reference 1: 25.2 The Architecture of a JSF Application.
39) The _______ converts a JSF page to an HTML page.
a) JSF translator
b) JSF compiler
c) JSF container
d) HTML converter
Title: The ___________ converts a JSF page to an HTML page.
Difficulty: Easy
Section Reference 1: 25.2 The Architecture of a JSF Application.
a) the translation uses polymorphism.
b) the translation depends on the current state of Java objects.
c) the translation is done by the web browser.
d) the translation changes the state of the Java objects.
Difficulty: Medium
Section Reference 1: 25.2 The Architecture of a JSF Application.
41) A _____ is an object that is controlled by the JSF container.
a) TimeBean
b) HTML page
c) JSF page
d) managed bean
Title: A _________ is an object that is controlled by the JSF container.
Difficulty: Medium
Section Reference 1: 25.2 The Architecture of a JSF Application.
42) The expression #{timeBean.time} is called a ____________.
a) bean expression
b) time expression
c) value expression
d) managed bean
Title: The expression #{timeBean.time} is called a ____________.
Difficulty: Medium
Section Reference 1: 25.2 The Architecture of a JSF Application.
43) The expression #{timeBean.time} calls the ____________ method.
a) time
b) setTime
c) getTime
d) displayTime
Title: The expression #{timeBean.time} calls the ____________ method.
Difficulty: Medium
Section Reference 1: 25.2 The Architecture of a JSF Application.
44) The name of the bean in the expression #{timeBean.time} is:
a) time
b) timeBean
c) Bean
d) timeBean.time
Title: The name of the bean in the expression #{timeBean.time} is:
Difficulty: Easy
Section Reference 1: 25.2 The Architecture of a JSF Application.
45) When deploying a JSF application, all class files must be placed in the _______ directory:
a) WEB-BEAN/classes/
b) BEAN-INF/classes/
c) WEB/INF/classes/
d) WEB-INF/classes/
Title: When deploying a JFS application, all class files must be placed in the _______ directory:.
Difficulty: Medium
Section Reference 1: 25.2 The Architecture of a JSF Application.
46) The JSF technology enables the separation of :
a) HTML and Swing.
b) presentation and application.
c) business logic and presentation.
d) JSF and HTML.
Title: The JSF technology enables the separation of:
Difficulty: Easy
Section Reference 1: 25.2 The Architecture of a JSF Application.
47) The part of the web application that is independent of the graphical user interface is called:
a) Swing.
b) presentation logic.
c) business logic.
d) HTML.
Title: The part of the application that is independent of the GUI is called:
Difficulty: Medium
Section Reference 1: 25.2 The Architecture of a JSF Application.
48) The user interface of a web application is called:
a) Swings
b) presentation logic
c) business logic
d) XML
Title: The user interface of a web application is called:
Difficulty: Medium
Section Reference 1: 25.2 The Architecture of a JSF Application.
49) JSF pages define the ___________ of a web application.
a) swings
b) presentation logic
c) business logic
d) value expressions
Title: JSF pages define the ___________.
Difficulty: Medium
Section Reference 1: 25.2 The Architecture of a JSF Application.
50) Managed beans define the ___________ of a web application.
a) swing
b) presentation logic
c) business logic
d) value expressions
Title: Managed beans define the ___________.
Difficulty: Medium
Section Reference 1: 25.2 The Architecture of a JSF Application.
51) Value expressions tie the ___________ together to make a web application.
a) GUI and the database server
b) managed beans and JSF pages
c) JSF and Swing components
d) JSF and HTML
Title: Value expressions tie the ___________.
Difficulty: Medium
Section Reference 1: 25.2 The Architecture of a JSF Application.
52) What do you need to run a JSF application?
a) A server and a client.
b) A server with swing.
c) Presentation and business logic.
d) A server with a JSF container.
Title: What do you need to run a JSF application?
Difficulty: Medium
Section Reference 1: 25.2 The Architecture of a JSF Application.
53) One of the steps in deploying a JSF application is to _______ of the web application:
a) Place JSF pages (such as index.xhtml) in the WEB-INF directory
b) Place JSF pages (such as index.xhtml) in the root directory
c) Place JSF pages (such as index.xhtml) in the WEB-INF/classes directory
d) Place the file web.xml in the root directory
Title: One of the steps in deploying a JSF application is ___
Difficulty: Medium
Section Reference 1: 25.2 The Architecture of a JSF Application.
54) One of the steps in deploying a JSF application is to _______ of the web application:
a) Place the file web.xml in the WEB-INF directory
b) Place the file web.xml in the root directory
c) Place the file web.xml in the WEB-INF/classes directory
d) Place the file web.xml in the modules directory
Title: One of the steps in deploying a JSF application is ___
Difficulty: Medium
Section Reference 1: 25.2 The Architecture of a JSF Application.
55) One of the steps in deploying a JSF application is to _______ of the web application:
a) Create a WEB-INF subdirectory in the root directory of the application directory
b) Create an INF-WEB subdirectory in the root directory of the application directory
c) Create a WEB-INF subdirectory in the application directory
d) Create a WEB-INF/classes subdirectory in the root directory of the application directory
Title: One of the steps in deploying a JSF application is ___
Difficulty: Medium
Section Reference 1: 25.2 The Architecture of a JSF Application.
56) The application server listens to web requests, typically on which port?
a) 80
b) 8000
c) 8080
d) 1560
Title: The application server listens to web requests, typically on which port?
Difficulty: Easy
Section Reference 1: 25.2 The Architecture of a JSF Application.
57) With GlassFish, the default deployment directory is called:
a) domains/deploy
b) domains/domain1/deploy
c) domains/autodeploy
d) domains/domain1/autodeploy
Title: With GlassFish, the default deployment directory is called:
Difficulty: Medium
Section Reference 1: 25.2 The Architecture of a JSF Application.
58) All application files in a web application should be zipped up into a file with extension:
a) .zip
b) .jar
c) .web
d) .war
Title: All application files should be zipped up into a file with extension:
Difficulty: Medium
Section Reference 1: 25.2 The Architecture of a JSF Application.
59) All application files in a web application should be zipped up by running the _____ command.
a) zip
b) jar
c) unzip
d) war
Title: All application files should be zipped up by running the _____ command.
Difficulty: Easy
Section Reference 1: 25.2 The Architecture of a JSF Application.
60) What does the second period in the following command denote?
jar cvf time.war .
a) The root directory.
b) The parent directory
c) The current directory
d) The jar command directory
Title: The second period in the following command denotes:
Difficulty: Easy
Section Reference 1: 25.2 The Architecture of a JSF Application.
61) A _______ consists of a small string that the web server sends to a browser and that is later sent back to the same server.
a) stateless protocol
b) tasteless protocol
c) cookie
d) jar
Title: A _______ consists of a small string that the web server sends to a browser.
Difficulty: Medium
Section Reference 1: 25.2 The Architecture of a JSF Application.
62) _______ were invented to overcome the stateless protocol restrictions of HTTP.
a) Protocols
b) POP protocols
c) Servers
d) Cookies
Title: _______ were invented to overcome stateless protocol restrictions of HTTP.
Difficulty: difficult
Section Reference 1: 25.2 The Architecture of a JSF Application.
63) Which method(s) will this line from a JSF page call?
<h:inputText value="#{timeZoneBean.city}"/>
a) TimeZoneBean.getCity()
b) TimeZoneBean.setCity()
c) TimeZoneBean.getCity() and TimeZoneBean.setCity()
d) TimeZoneBean.checkCity() and TimeZoneBean.setCity()
Title: Which method(s) will this line from a JSF page call?
Difficulty: Medium
Section Reference 1: 25.4 Navigation Between Pages
64) Consider the following code fragment:
public String checkCity()
{
zone = getTimeZone(city);
if (zone == null) { return "error"; }
return "next";
}
Which JSF statement will call this method?
a) <h:inputText value="#{timeZoneBean.city}"/>
b) <h:commandButton value="Submit" action="#{timeZoneBean.checkCity}"/>
c) <h:inputText value="#{timeZoneBean.City}"/>
d) <h:commandButton value="Submit" action="#{timeZoneBean.city}"/>
Title: Which JSF statement will call this method?
Difficulty: Medium
Section Reference 1: 25.4 Navigation Between Pages
65) Consider the following code fragment:
public String checkCity()
{
zone = getTimeZone(city);
if (zone == null) { return "error"; }
return "next";
}
What is the result of executing the following JSF statement if zone is null?
<h:commandButton value="Submit" action="#{timeZoneBean.checkCity}"/>
a) An error message is printed.
b) The error.html page is displayed.
c) The next.html page is displayed.
d) The same page is displayed again.
Title: What is the result of executing the following JSF statement if zone is null?
Difficulty: Medium
Section Reference 1: 25.4 Navigation Between Pages
66) Which method(s) will this line from a JSF page call when the user submits the page?
<h:inputText value="#{timeZoneBean.city}"/>
a) TimeZoneBean.getCity()
b) TimeZoneBean.setCity()
c) TimeZoneBean.getCity() and TimeZoneBean.setCity()
d) TimeZoneBean.checkCity() and TimeZoneBean.setCity()
Title: Which method(s) will this line from a JSF page call?
Difficulty: Medium
Section Reference 1: 25.4 Navigation Between Pages
67) One of the corresponding methods for a JavaBean property called city is:
a) getcity()
b) getCity()
c) GetCity()
d) Getcity()
Title: One of the corresponding methods for a property called city is:
Difficulty: Easy
Section Reference 1: 25.3 JavaBeans Components.
68) One of the corresponding methods for a JavaBean property called ID is:
a) getid()
b) getID()
c) getId()
d) GetId()
Title: One of the corresponding methods for a property called ID is:
Difficulty: Easy
Section Reference 1: 25.3 JavaBeans Components.
69) Which method(s) will this line from a JSF page call?
The current time is #{timeBean.time}
a) TimeBean.getCity()
b) TimeBean.setCity()
c) TimeBean.getCity() and TimeBean.setCity()
d) TimeBean.checkCity() and TimeBean.setCity()
Title: Which method(s) will this line from a JSF page call?
Difficulty: Medium
Section Reference 1: 25.4 Navigation Between Pages
70) If a JavaBean property has only a get method, then it is __________________.
a) a write-only property.
b) a read-write property.
c) a read-only property.
d) a hidden only property.
Title: If the property has only a get method, then it is:
Difficulty: Easy
Section Reference 1: 25.3 JavaBeans Components.
71) If a JavaBean property has only a set method, then it is __________________.
a) a write-only property.
b) a read-write property.
c) a read-only property.
d) a hidden only property.
Title: If the property has only a set method, then it is:
Difficulty: Easy
Section Reference 1: 25.3 JavaBeans Components.
72) When the string The current time is #{timeBean.time} is rendered, the JSF container calls the __________________.
a) time method.
b) setTime method.
c) getTime method.
d) both the setTime and the getTime methods.
Title: When this string is rendered, the JSF container calls the:
Difficulty: Medium
Section Reference 1: 25.3 JavaBeans Components.
73) When <h:inputText value="#{timeBean.time}" /> is displayed, the JSF container calls the __________________.
a) time method.
b) setTime method.
c) getTime method.
d) both the setTime and the getTime methods.
Title: When <h:inputText value="#{timeBean.time}" /> is displayed, the JSF container calls the:
Difficulty: Medium
Section Reference 1: 25.3 JavaBeans Components.
74) The string that determines the next page that the JSF container sends to the browser is called the __________________.
a) bean navigator
b) outcome string
c) JavaBean result
d) HTML string
Title: The string that determines the next page sent to the browser is called:
Difficulty: Medium
Section Reference 1: 25.4 Navigation between Pages.
75) What does a method expression consist of?
a) The name of a bean only.
b) An outcome.
c) The name of a method only.
d) The name of a bean and the name of a method.
Title: What does a method expression consist of?
Difficulty: Medium
Section Reference 1: 25.4 Navigation between Pages