Preview (3 of 10 pages)

Preview Extract

Chapter 12: Event-Driven GUI Programming, Multithreading, and Animation
TRUE/FALSE
1. Computer users can expect to see a standard interface in the GUI programs they use.
Answer: True
2. GUI programs are frequently called action-controlled because actions occur in response to
user-initiated events such as clicking a mouse button.
Answer: False
3. In object-oriented languages, the procedural modules that depend on user-initiated events
are often called applets.
Answer: False
4. When you program in a language that uses GUI components, you need to create them from
scratch.
Answer: False
5. An important advantage of using GUI data-entry objects is that you often can control what
users enter by limiting their options.
Answer: True
6. A GUI picture album represents “snapshot” views of the screens the user will encounter
during the run of a program.
Answer: False
7. In an event-driven program, you design the screens, define the objects, and define how the
screens will connect.
Answer: True
8. With a single CPU, multiple threads execute simultaneously.
Answer: False
9. Multithreaded programs often run faster and they are more user-friendly.
Answer: True
10. Many object-oriented languages offer built-in classes that contain methods you can use to
draw geometric figures.
Answer: True
MULTIPLE CHOICE
1. From the 1950s, when businesses began to use computers to help them perform many jobs,
through the 1980s, almost all interactive dialogues between people and computers took place
at the ____.
a. command prompt

b. graphical window
c. menu
d. system interface
Answer: A
2. The ____ is the location on your computer screen at which you type entries to
communicate with the computer’s operating system.
a. GUI
b. IDE
c. system terminal
d. command line
Answer: D
3. Operating system software allows you to use a mouse or other pointing device to select
pictures, or ____, on the screen.
a. targets
b. icons
c. windows
d. menus
Answer: B
4. Performing an operation on an icon causes a(n) ____.
a. instance
b. message
c. event
d. interface
Answer: C
5. Within an event-driven program, a component from which an event is generated is the
____.
a. target of the event
b. source of the event
c. interface of the event
d. message handler
Answer: B

6. In object-oriented languages, the procedural modules that depend on user-initiated events
are often called ____.
a. scripts
b. blocks
c. handlers
d. windows
Answer: A
7. A ____ is a rectangular area into which the user can type text.
a. label
b. button
c. check box
d. text box
Answer: D
8. A(n) ____ consists of a label placed beside a small square.
a. option button
b. button
c. check box
d. text box
Answer: C
9. A ____ is a rectangular object you can click; when you do, its appearance usually changes
to look pressed.
a. label
b. button
c. check box
d. text box
Answer: B
10. GUI components are excellent examples of the best principles of object-oriented
programming; they represent objects with attributes and methods that operate like ____.
a. trap doors
b. black boxes
c. a procedural function

d. a while loop
Answer: B
11. A ____ is one of the tiny dots of light that form a grid on your screen.
a. point
b. texel
c. textile
d. pixel
Answer: D
12. When you use a menu bar, it is at the top of the screen in most GUI programs, and the
first menu item is almost always ____.
a. Edit
b. File
c. Home
d. Help
Answer: B
13. Dimming a component is also called ____ the component.
a. graying
b. hiding
c. wiping
d. highlighting
Answer: A
14. GUI programmers sometimes refer to screen space as ____.
a. canvas
b. interface
c. real estate
d. territory
Answer: C
15. The screen design issues that make programs easier to use for people with physical
limitations are known as ____ issues.
a. usability
b. accessibility

c. interface
d. compliance
Answer: B
16. When you develop an event-driven application, you need to expand on the ____ step in
the program development cycle.
a. understanding the problem
b. planning the logic
c. coding the program
d. testing the program
Answer: B
17. A ____ represents a picture or sketch of a screen the user will see when running a
program.
a. story book
b. run book
c. storyboard
d. skeleton
Answer: C
18. Cartoonists create animated films by drawing a sequence of ____ or cells.
a. frames
b. blocks
c. references
d. targets
Answer: A
19. A(n) ____ is a list of the objects used in a program, including which screens they are used
on and whether any code is associated with them.
a. object dictionary
b. object index
c. GUI dictionary
d. interface dictionary
Answer: A
20. A(n) ____ shows the relationship between screens in an interactive GUI program.

a. entity diagram
b. data flow diagram
c. use case diagram
d. interactivity diagram
Answer: D
21. With most OOP languages, you must ____ components, or sign them up so that they can
react to events initiated by other components.
a. register
b. activate
c. instantiate
d. create
Answer: A
22. The ____ contains methods that allow you to set physical properties such as height and
width, as well as methods that allow you to add the appropriate components to a container.
a. attributes class
b. container dictionary
c. containment class
d. container class
Answer: D
23. Using multiple threads of execution is known as ____.
a. binding
b. racing
c. multithreading
d. multipathing
Answer: C
24. With a(n) ____ program, a user can continue to click buttons while your program is
reading a data file.
a. single threaded
b. parallel threaded
c. independently threaded
d. multithreaded

Answer: D
25. ____ is the rapid sequence of still images, each slightly different from the previous one,
that produces the illusion of movement.
a. Screening
b. Animation
c. Filmation
d. Stop motion
Answer: B
COMPLETION
1. People who use the Disk Operating System (DOS) also call the command line the
____________________.
Answer: DOS prompt
prompt
2. An object that is “interested in” an event to which you want it to respond is a(n)
____________________.
Answer: listener
3. The most important principle of GUI design is to remember always that any GUI is only
a(n) ____________________.
Answer: interface
4. A(n) ____________________ is a list of the objects used in a program, including which
screens they are used on and whether any code, or script, is associated with them.
Answer: object dictionary
dictionary
5. In most object-oriented languages, a method named ____________________ executes
automatically when a class object is created.
Answer: main()
main
MATCHING
Match each term with a statement below.
1. An occurrence that generates a message sent to an object a. event
2. Shows the relationship between screens in an interactive GUI program b. y-axis
3. A class of objects whose main purpose is to hold other elements c. y-coordinate

4. The flow of execution of one set of program statements d. thread
5. Where two or more threads wait for each other to execute e. deadlock
6. Where a thread is abandoned because other threads occupy all of the computer’s resources
f. x-axis
7. A horizontal position g. x-coordinate
8. A vertical position h. starvation
9. Its value increases as you travel from left to right across the window i. interactivity
diagram
10. Its value increases as you travel from top to bottom j. container
1. Answer: A
2. Answer: I
3. Answer: J
4. Answer: D
5. Answer: E
6. Answer: H
7. Answer: F
8. Answer: B
9. Answer: G
10. Answer: C
SHORT ANSWER
1. Describe how to locate the command prompt in a Windows PC.
Answer: If you use the Windows operating system on a PC, you can locate the command
prompt by clicking Start and pointing to the command prompt window shortcut on the Start
menu. Alternatively, you can point to All Programs (or Programs in some earlier operating
systems), then Accessories, and then click Command Prompt.
2. List the two types of statements that you must write when an object should listen for
events.
Answer: If you want an object such as a button to be a listener for an event such as a mouse
click, you must write two types of appropriate program statements. You write the statements
that define the object as a listener and the statements that constitute the event.
3. List the general design principles used when creating a program that will use a GUI.
Answer: You should consider several general design principles when creating a program that
will use a GUI:
The interface should be natural and predictable.

The interface should be attractive, easy to read, and nondistracting.
To some extent, it’s helpful if the user can customize your applications.
The program should be forgiving.
The GUI is only a means to an end.
4. Explain why your program should be forgiving.
Answer: Perhaps you have had the inconvenience of accessing a voice mail system in which
you selected several sequential options, only to find yourself at a dead end with no recourse
but to hang up and redial the number. Good program design avoids similar problems. You
should always provide an escape route to accommodate users who make bad choices or
change their minds. By providing a Back button or functional Escape key, you provide more
functionality to your users.
5. List the events in developing an event-driven program.
Answer: The steps in developing a computer program are:
1. Understanding the problem.
2. Planning the logic.
3. Coding the program.
4. Translating the program into machine language.
5. Testing the program.
6. Putting the program into production.
7. Maintaining the program.
When you develop an event-driven application, you expand on Step 2, planning the logic, and
include three new substeps as follows:
2a. Creating storyboards.
2b. Defining the objects.
2c. Defining the connections between the screens the user will see.
6. Discuss the purpose of a storyboard.
Answer: A storyboard represents a picture or sketch of a screen the user will see when
running a program. Filmmakers have long used storyboards to illustrate key moments in the
plots they are developing; similarly, GUI storyboards represent “snapshot” views of the
screens the user will encounter during the run of a program. If the user could view up to four
screens during the insurance premium program, then you would draw four storyboard cells,
or frames.
7. Describe the container class.

Answer: In a GUI program, you need to create the component that holds all the GUI
elements. epending on the programming language, you might use a class with a name such as
Screen, Form, or Window.
Each of these generically is a container, or a class of objects whose main purpose is to hold
other elements. The container class contains methods that allow you to set physical properties
such as height and width, as well as methods that allow you to add the appropriate
components to a container.
8. Discuss using the integrated development environment to create applications.
Answer: When you use an integrated development environment to create applications, you
can drag components onto a screen without explicitly writing all the statements shown in the
pseudocode. In that case, the coding statements will be generated for you. It’s beneficial to
understand these statements so that you can more easily modify and debug your programs.
9. Describe a thread.
Answer: A thread is the flow of execution of one set of program statements. When you
execute a program statement by statement, from beginning to end, you are following a thread.
Many applications follow a single thread; this means that at any one time, the application
executes only a single program statement.
10. Discuss multithreading.
Answer: You use multithreading to improve the performance of your programs.
Multithreaded programs often run faster; but more importantly, they are more user-friendly.
With a multithreaded program, a user can continue to click buttons while your program is
reading a data file. With multithreading, an animated figure can appear on one part of the
screen while the user makes menu selections on another part of the screen. When you use the
Internet, the benefits of multithreading increase. For example, you can begin to read a long
text file, watch a video, or listen to an audio file while the rest of the file is still downloading.
Web users are likely to abandon a site if downloading a file takes too long. When you use
multithreading to perform concurrent tasks, you are more likely to retain visitors to your Web
site—this is particularly important if your site sells a product or service.

Test Bank for Programming Logic and Design
Joyce Farrell
9781111969752, 9788131525906, 9781111825959

Document Details

Related Documents

Close

Send listing report

highlight_off

You already reported this listing

The report is private and won't be shared with the owner

rotate_right
Close
rotate_right
Close

Send Message

image
Close

My favorites

image
Close

Application Form

image
Notifications visibility rotate_right Clear all Close close
image
image
arrow_left
arrow_right