Full Big Java Early Objects 5Th Edition Horstmann Test Bank Online PDF All Chapter
Full Big Java Early Objects 5Th Edition Horstmann Test Bank Online PDF All Chapter
Full Big Java Early Objects 5Th Edition Horstmann Test Bank Online PDF All Chapter
https://testbankdeal.com/product/big-java-early-objects-5th-
edition-horstmann-solutions-manual/
https://testbankdeal.com/product/big-java-late-objects-1st-
edition-horstmann-solutions-manual/
https://testbankdeal.com/product/java-how-to-program-early-
objects-11th-edition-deitel-test-bank/
https://testbankdeal.com/product/starting-out-with-java-early-
objects-6th-edition-gaddis-test-bank/
Java How to Program Early Objects 10th Edition Deitel
Test Bank
https://testbankdeal.com/product/java-how-to-program-early-
objects-10th-edition-deitel-test-bank/
https://testbankdeal.com/product/starting-out-with-java-early-
objects-6th-edition-gaddis-solutions-manual/
https://testbankdeal.com/product/java-how-to-program-early-
objects-11th-edition-deitel-solutions-manual/
https://testbankdeal.com/product/java-how-to-program-early-
objects-10th-edition-deitel-solutions-manual/
https://testbankdeal.com/product/starting-out-with-java-from-
control-structures-through-objects-5th-edition-tony-gaddis-test-
bank/
Chapter 10: Interfaces
Test Bank
Multiple Choice
Answer: b
Answer: d
Answer: b
Answer: a
Answer: b
Answer: d
Answer: d
Answer: c
Answer: a
Answer: c
Answer: a
12. Suppose you are writing an interface called Resizable, which includes one void
method called resize.
Which of the following can be used to complete the interface declaration correctly?
Answer: c
_____________________________
{
// code to encrypt the text using encryption key goes here
}
}
Which of the following method headers should be used to complete the SecretText
class?
Answer: b
void changeSize();
}
Answer: a
The compiler complains that the getMeasure method has a weaker access level than the
Measurable interface. Why?
a) All of the methods in a class have a default access level of package access, while the
methods of an interface have a default access level of private.
b) All of the methods in a class have a default access level of package access, while the
methods of an interface have a default access level of public.
c) The variable onHandCount was not declared with public access.
d) The getMeasure method was declared as private in the Measurable interface.
Answer: b
17. Which of the following is true regarding a class and interface types?
a) You can convert from a class type to any interface type that is in the same package as
the class.
b) You can convert from a class type to any interface type that the class implements.
c) You can convert from a class type to any interface type that the class defines.
d) You cannot convert from a class type to any interface type.
Answer: b
a)
Coin dime = new Coin(0.1, "dime");
Measurable x = dime;
b)
Coin dime = new Coin(0.1, "dime");
Dataset x = dime;
c)
Coin dime = new Coin(0.1, "dime");
DataSet x == (Measureable)dime;
d)
Coin dime = new Coin(0.1, "dime");
BankAccount x = dime;
Answer: a
19. Which of the following statements about converting between types is true?
a) When you cast number types, you take a risk that an exception will occur.
b) When you cast number types, you will not lose information.
c) When you cast object types, you take a risk of losing information.
d) When you cast object types, you take a risk that an exception will occur.
Answer: d
a) You can define an interface variable that refers to an object of any class in the same
package.
b) You cannot define a variable whose type is an interface.
c) You can instantiate an object from an interface class.
d) You can define an interface variable that refers to an object only if the object belongs
to a class that implements the interface.
Answer: d
21. You have created a class named Motor that implements an interface named
Measurable. You have declared a variable of type Measureable named
motorTemperature. Which of the following statements is true?
Answer: b
22. ____ occurs when a single class has several methods with the same name but
different parameter types.
a) Casting
b) Polymorphism
c) Overloading
d) Instantiation
Answer: c
a) overloading
b) callback
c) early binding
d) polymorphism
Answer: d
24. If you have multiple classes in your program that have implemented the same
interface in different ways, how is the correct method executed?
a) The Java virtual machine must locate the correct method by looking at the class of the
actual object.
b) The compiler must determine which method implementation to use.
c) The method must be qualified with the class name to determine the correct method.
d) You cannot have multiple classes in the same program with different implementations
of the same interface.
Answer: a
What method invocation can be used to complete the code segment below?
a) increaseSize()
b) decreaseSize()
c) display()
d) display(5)
Answer: c
26. Which of the following can potentially be changed when implementing an interface?
Answer: c
28. The method below is designed to print the smaller of two values received as
arguments. Select the correct expression to complete the method.
Answer: d
a) A callback can allow you to implement a new method for a class that is not under your
control.
b) A callback can be implemented using an interface.
c) A callback is a mechanism for specifying code to be executed later.
d) A callback method declared in an interface must specify the class of objects that it will
manipulate.
Answer: d
Answer: b
31. You wish to implement a callback method for an object created from a system class
that you cannot change. What approach does the textbook recommend to accomplish
this?
Answer: d
Answer: c
What parameter declaration can be used to complete the callback measure method?
a) Object anObject
b) String anObject
c) Object aString
d) String aString
Answer: a
Title: Identify correct parameter declaration to complete callback method
Difficulty: Easy
Section Reference 1: 10.4 Using Interfaces for Callbacks
34. Assuming that interface Resizable is declared elsewhere, consider the following
class declaration:
Which of the following declarations can be used to complete the main method?
Answer: b
Title: Identify correct declaration using inner class to complete main method
Difficulty: Medium
Section Reference 1: 10.5 Inner Classes
a) An inner class can only be defined within a specific method of its enclosing class.
b) An inner class can only be defined outside of any method within its enclosing class.
c) An inner class must implement an interface.
d) An inner class may be anonymous.
Answer: d
Answer: d
Answer: b
Answer: d
a) An anonymous class.
b) An anonymous object.
c) An abstract object.
d) An abstract class.
Answer: b
a) A mock class does not provide an implementation of the services of the actual class.
b) A mock class provides a complete implementation of the services of the actual class.
c) A mock class provides a simplified implementation of the services of the actual class.
d) A mock class must be an interface.
Answer: c
41. What role does an interface play when using a mock class?
a) The mock class should be an interface that will be implemented by the real class.
b) The real class should be an interface that will be implemented by the mock class.
c) Interfaces are not involved when using mock classes.
d) An interface should be implemented by both the real class and the mock class to
guarantee that the mock class accurately simulates the real class when used in a program.
Answer: d
a) Your program must instruct the Java window manager to send it notifications about
specific types of events to which the program wishes to respond.
b) The Java window manager will automatically send your program notifications about
all events that have occurred.
c) Your program must respond to notifications of all types of events that are sent to it by
the Java window manager.
D) Your program must override the default methods to handle events.
Answer: a
Which of the following method headers should be used to complete the ClickListener
class?
Answer: a
44. ____ are generated when the user presses a key, clicks a button, or selects a menu
item.
a) Listeners
b) Interfaces.
c) Events.
d) Errors.
Answer: c
45. A/an ____ belongs to a class whose methods describe the actions to be taken when a
user clicks a user-interface graphical object.
a) Event listener
b) Event source
c) Action listener
d) Action method
Answer: a
a) A JButton object.
b) An event listener.
c) An inner class.
d) An event adapter.
Answer: a
47. To respond to a button event, a listener must supply instructions for the ____ method
of the ActionListener interface.
a) actionEvent.
b) actionPerformed
c) eventAction
d) eventResponse
Answer: b
48. To associate an event listener with a JButton component, you must use the ___
method of the JButton class.
a) addEventListener.
b) addActionListener.
c) addButtonListener.
d) addListener
Answer: b
49. The methods of a/an ____ describe the actions to be taken when an event occurs.
a) event source
b) event listener
c) event interface
d) action source
Answer: b
50. When an event occurs, the event source notifies all ____.
a) components
b) panels
c) interfaces
d) event listeners
Answer: d
Section 10.7 Event Handling
Title: When an event occurs, the event source notifies all ____.
Difficulty: Easy
a) text area
b) table
c) panel
d) rectangle
Answer: c
a)
public interface AccountListener()
{
void actionPerformed(AccountEvent event);
}
b)
public interface AccountListener()
{
void actionPerformed(AccountEvent);
}
c)
public interface AccountListener
{
void actionPerformed(AccountEvent event);
}
d)
public abstract AccountListener
{
void actionPerformed(AccountEvent event);
}
Answer: c
Answer: a
a) frame.add(panel);
b) frame.add(JPanel panel);
c) frame.addComponent(panel);
d) frame.addComponent(JPanel panel);
Answer: a
Section 10.8 Building Applications with Buttons Title: How to add a panel to a frame.
Difficulty: Easy
/**
An action listener that prints.
*/
public class ClickListener implements ActionListener
{
public void actionPerformed(ActionEvent event)
{
System.out.println("I was clicked.");
}
}
Which of the following statements will complete this code?
a) java.swing.event.ActionEvent;.
b) javax.swing.event.ActionEvent;
c) javax.awt.event.ActionEvent;
d) java.awt.event.ActionEvent;
Answer: d
56. Event listeners are often installed as ____ classes so that they can have access to the
surrounding fields, methods, and final variables.
a) Inner
b) Interface
c) Abstract
d) Helper
Answer: a
a) An inner class may not be declared within a method of the enclosing scope.
b) An inner class may only be declared within a method of the enclosing scope.
c) An inner class can access variables from the enclosing scope only if they are passed as
constructor or method parameters.
d) The methods of an inner class can access variables declared in the enclosing scope.
Answer: d
Answer: b
59. An inner class can access local variables from the enclosing scope only if they are
declared as ____.
a) private
b) public
c) static
d) final
Answer: b
Answer: d
Section 10.8 Building Applications with ButtonsTitle: Which statement creates a button?
Difficulty: Easy
61. To build a user interface that contains graphical components, the components ____.
a) Must be added directly to a frame component.
b) Must each be added to a separate panel.
c) Must be added to a panel that is contained within a frame.
d) Must be added to a frame that is contained within a panel.
Answer: c
Section 10.8 Building Applications with ButtonsTitle: To build a user interface, the
graphical components ____.
Difficulty: Easy
62. How do you specify what the program should do when the user clicks a button?
a) Specify the actions to take in a class that implements the ButtonListener interface.
b) Specify the actions to take in a class that implements the ButtonEvent interface .
c) Specify the actions to take in a class that implements the ActionListener interface.
d) Specify the actions to take in a class that implements the EventListener interface.
Answer: c
Section 10.8 Building Applications with ButtonsTitle: How to specify action for a
button?
Difficulty: Medium
63. A(n) ____ has an instance method addActionListener() for specifying which
object is responsible for implementing the action associated with the object.
a) JFrame
b) JSlider
c) JButton
d) JLabel
Answer: c
Section 10.8 Building Applications with ButtonsTitle: How to specify action for a button.
Difficulty: Medium
Answer: c
Section 10.8 Building Applications with ButtonsTitle: What is wrong with this listener
code?
Difficulty: Medium
Which of the local variables can be accessed within the actionPerformed method?
Answer: c
Section 10.8 Building Applications with ButtonsTitle: Which local variables can be
accessed?
Difficulty: Medium
66. Consider the following code snippet which is supposed to show the total order
amount when the button is clicked:
public static void main(String[] args)
{
final Order myOrder = new Order();
JButton button = new JButton("Calculate");
final JLabel label = new JLabel("Total amount due");
. . .
class MyListener implements ActionListener
{
public void actionPerformed(ActionEvent event)
{
label.setText("Total amount due " + myOrder.getAmountDue());
}
}
ActionListener listener = new MyListener();
}
Answer: b
a) setPreferredDimensions.
b) setInitialDimensions.
c) setPreferredSize.
d) setInitialSize.
Answer: c
68) Assuming that the ClickListener class implements the ActionListener interface,
what statement should be used to complete the following code segment?
a) myPanel.addActionListener(listener);
b) myButton.addActionListener(listener);
c) myPanel.addActionListener(myButton);
d) myButton.addActionListener(ClickListener);
Answer: b
Title: Identify correct statement to add event listener object to a graphical object
Difficulty: Medium
Section Reference 1: 10.8 Building Applications with Buttons
69) Assume that the TimerListener class implements the ActionListener interface. If
the actionPerformed method in TimerListener needs to be executed every second,
what statement should be used to complete the following code segment?
Answer: d
a) java.awt.
b) javax.awt.
c) java.swing.
d) javax.swing.
Answer: d
71. When you use a timer, you need to define a class that implements the ____ interface.
a) TimerListener
b) TimerActionListener
c) ActionListener
d) StartTimerListener
Answer: c
72. The ____ class in the javax.swing package generates a sequence of events, spaced
apart at even time intervals.
a) TimeClock
b) Timer
c) Clock
d) StopWatch
Answer: b
Section 10.9 Processing Timer Events
Title: Which class generates events at even time intervals?
Difficulty: Easy
frame.setSize(FRAME_WIDTH, FRAME_HEIGHT);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
Answer: d
public RectangleComponent()
{
// The rectangle that the paint method draws
box = new Rectangle(BOX_X, BOX_Y,
BOX_WIDTH, BOX_HEIGHT);
}
g2.draw(box);
}
a) repaint();
b) g2.draw(box);
c) box.setLocation(x, y);
d) private Rectangle box;
Answer: a
Answer: b
76. You have a class which extends the JComponent class. In this class you have created
a painted graphical object. Your code will change the data in the graphical object. What
additional code is needed to ensure that the graphical object will be updated with the
changed data?
Answer: b
77. The ____ method should be called whenever you modify the shapes that the
paintComponent method draws.
a) draw
b) paint
c) paintComponent
d) repaint
Answer: d
78. If the user presses and releases a mouse button in quick succession, which methods
of the MouseListener interface are called?
Answer: b
Section 10.10 Mouse Events
Title: Which MouseListener interface methods are called?
Difficulty: Medium
a) 0
b) 1
c) 3
d) at least 5
Answer: d
a) addListener
b) addMouseListener
c) addActionListener
d) addMouseActionListener
Answer: b
a) action listener
b) event listener
c) mouse listener
d) component listener
Answer: c
82. You wish to detect when the mouse is moved into a graphical component. Which
methods of the MouseListener interface will provide this information?
a) mouseMoved
b) mouseEntered
c) mouseOver
d) mouseIncoming
Answer: b
a) The mouseClicked method cannot access the x and y coordinates of the mouse.
b) repaint() method was not called.
c) The class has implemented the wrong interface.
d) There is nothing wrong with this code.
Answer: c
Which of the following statements should be in the indicated position to print out where
the mouse was pressed?
a) x = event.getXposition(); y = event.getYposition();
b) x = (MouseEvent) getX(); y = (MouseEvent) getY();
c) x = event.printX(); y = event.printY();
d) x = event.getX(); y = event.getY();
Answer: d
Answer: a
Language: English
Volume I
First edition
All rights reserved
Index 383
List of Illustrations
FRONTISPIECE
The Grand Duchess Anastasia (portrait)
FIRST GROUP
The Grand Duchess Anastasia
Announcement of Birth of the Grand Duchess Anastasia
The Empress Alexandra
The Grand Duchess Anastasia, the Tsesarevich Alexei
and the Emperor Nicholas II
The Tsesarevich Alexei, the Empress Alexandra and the
Emperor Nicholas II
The Russian Imperial Family on visit to the British Royal
Family
The Grand Duke Alexander and the Grand Duchess Xenia
and Their Children
Alexander Palace, Tsarskoe Selo
The New Palace, Livadia
Nicholas II
The Empress Alexandra
The Tsesarevich Alexei
Nicholas II and the Empress Alexandra
The Grand Duchess Anastasia
The Grand Duchesses Marie, Tatiana, Anastasia and Olga
The Empress Alexandra with Her Daughters
Nicholas II and the Empress Alexandra and Their Children
The Grand Duchesses Olga and Tatiana
The Grand Duchesses Marie and Anastasia
The Grand Duchesses Anastasia, Olga, Tatiana and Marie
Nicholas II
The Grand Duchess Anastasia, the Empress Alexandra
and President Raymond Poincaré
SECOND GROUP
The Dowager Empress Marie
The Emperor Nicholas II
The Empress Alexandra
The Tsesarevich Alexei
The Grand Duke Michael
The Grand Duchess Elizabeth
The Grand Duchesses Anastasia, Marie and Tatiana
Nicholas II and His Children
The Tsesarevich Alexei and the Grand Duchesses Olga,
Anastasia and Tatiana
The Grand Duchesses Marie, Olga, Anastasia and Tatiana
Views of Tobolsk
Ipatiev House, Ekaterinburg
The Death Chamber, Ipatiev House, Ekaterinburg
The Handkerchief
The Piece of Glass
Map of Ekaterinburg and Vicinity
The Grand Duchesses Marie and Anastasia
The Grand Duchess Anastasia
Nicholas II with His Children and His Nephew, Prince
Vasili
The Grand Duchess Anastasia
The Grand Duchesses Olga, Tatiana, Anastasia and Marie
The Grand Duchess Anastasia
The Grand Duchess Anastasia and Marjorie Hanson
The Grand Duchess Anastasia
THIRD GROUP
Cameos of the Grand Duchess Anastasia Through the
Years
Author’s Preface
A few weeks after my arrival in Bukovina—after I had had time to
recover from the emotional and nervous shock and body wounds
which I had suffered at the time of the tragedy on the night of July
16-17, 1918—I decided to write about my home life with my beloved
family, about our arrest, about our exile in Tobolsk and Ekaterinburg,
about the assassination of the family in Ekaterinburg, and about my
rescue and subsequent escape across the frontier.
I made many, many notes, totaling over three hundred pages. I spent
hours and hours in the writing, days and nights of introspective
experiences, of grief and horror. I wrote in a peasant cottage in a
lonely village dotted with thatched-roof houses. I wrote at night in the
candlelight, agonizing over my story. At times the only relief I had
from my misery was the howling or barking of a dog. I remembered
my beloved Father’s words, “Dearest children, are you awake?” Tear
after tear dropped as I labored.
I remembered also my Father’s desire that a history of Russia should
be written by a member of our family. My Father had had in mind that
such a history might be written by my two oldest sisters and, to that
end, he gave them much valuable information. As it has turned out, it
is the youngest sister, the one least prepared to do so, upon whom
devolves the task of writing such a book, if it is to be written. That is
something for the future.
In 1918, after my escape, I thought that the book I had decided to
write about my family and myself might include historical data and
interpretation which would be of interest to the world and would be of
benefit to the Russian people and to their, and my, native land. I
particularly wanted to let the world know the facts about the arrest,
exile and murder of my parents, sisters and brother, and about the
nature of the Bolshevik regime in my country. It was the notes for this
book that I produced so painfully and painstakingly.