Exam 10: Interfaces
Exam 1: Introduction98 Questions
Exam 2: Using Objects76 Questions
Exam 3: Implementing Classes103 Questions
Exam 4: Fundamental Data Types125 Questions
Exam 5: Decisions120 Questions
Exam 6: Loops128 Questions
Exam 7: Arrays and Array Lists118 Questions
Exam 8: Designing Classes95 Questions
Exam 9: Inheritance101 Questions
Exam 10: Interfaces85 Questions
Exam 11: Inputoutput and Exception Handling109 Questions
Exam 12: Object-Oriented Design104 Questions
Exam 13: Recursion110 Questions
Exam 14: Sorting and Searching109 Questions
Exam 15: The Java Collections Framework110 Questions
Exam 16: Basic Data Structures104 Questions
Exam 17: Tree Structures110 Questions
Exam 18: Generic Classes75 Questions
Exam 19: Graphical User Interfaces76 Questions
Exam 20: Streams and Binary Inputoutput82 Questions
Exam 21: Multithreading82 Questions
Exam 22: Internet Networking74 Questions
Exam 23: Relational Databases75 Questions
Exam 24: XML74 Questions
Exam 25: Web Applications75 Questions
Select questions type
Consider the following declarations: public interface Measurer
{
Int measure(Object anObject);
}
Public class StringLengthMeasurer implements Measurer
{
Public int measure(_________________)
{
String str = (String) anObject;
Return str.length();
}
}
What parameter declaration can be used to complete the callback measure method?
(Multiple Choice)
4.9/5
(40)
A/an ____ belongs to a class whose methods describe the actions to be taken when a user clicks a user-interface graphical object.
(Multiple Choice)
4.9/5
(37)
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?
(Multiple Choice)
4.8/5
(29)
Consider the following code snippet: final RectangleComponent component = new RectangleComponent();
MouseListener listener = new MousePressListener();
Component.addMouseListener(listener);
______________
Frame.add(component);
Frame.setSize(FRAME_WIDTH, FRAME_HEIGHT);
Frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Frame.setVisible(true);
Which of the following statements completes this code?
(Multiple Choice)
4.9/5
(30)
Which of the following statements about an inner class is true?
(Multiple Choice)
4.8/5
(41)
An inner class can access local variables from the enclosing scope only if they are declared as ____.
(Multiple Choice)
4.8/5
(34)
A/an ____ class defined in a method signals to the reader of your program that the class is not interesting beyond the scope of the method.
(Multiple Choice)
4.8/5
(42)
When you use a timer, you need to define a class that implements the ____ interface.
(Multiple Choice)
4.9/5
(35)
Suppose listener is an instance of a class that implements the MouseListener interface. How many methods does listener have?
(Multiple Choice)
4.8/5
(41)
Which of the following statements about abstract methods is true?
(Multiple Choice)
4.7/5
(42)
A(n) ____ has an instance method addActionListener() for specifying which object is responsible for implementing the action associated with the object.
(Multiple Choice)
4.8/5
(31)
Consider the following code snippet: class MyListener implements ActionListener
{
Public void actionPerformed(ActionEvent event)
{
System.out.println(event);
}
}
Timer t = new Timer(interval, listener);
t.start();
What is wrong with this code?
(Multiple Choice)
4.8/5
(32)
Which of the following statements about an inner class is true?
(Multiple Choice)
4.8/5
(38)
Assuming that interface Resizable is declared elsewhere, consider the following class declaration: public class InnerClassExample
{
Public static void main(String[] args)
{
Class SizeModifier implements Resizable
{
// class methods
}
__________________________ // missing statement
}
}
Which of the following declarations can be used to complete the main method?
(Multiple Choice)
4.8/5
(36)
Consider the following code snippet: public interface Sizable
{
Int LARGE_CHANGE = 100;
Int SMALL_CHANGE = 20;
Void changeSize();
}
Which of the following statements is true?
(Multiple Choice)
4.7/5
(36)
Event listeners are often installed as ____ classes so that they can have access to the surrounding fields, methods, and final variables.
(Multiple Choice)
4.8/5
(34)
The method below is designed to print the smaller of two values received as arguments. Select the correct expression to complete the method. public void showSmaller(Comparable value1, Comparable value2)
{
If ( _________________________ )
System.out.println(value1 + " is smaller.");
Else
System.out.println(value2 + " is smaller.");
}
(Multiple Choice)
4.9/5
(35)
Showing 21 - 40 of 85
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)