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
Which of the following statements about a callback is NOT true?
(Multiple Choice)
4.9/5
(37)
Which of the following statements about a mock class is true?
(Multiple Choice)
4.9/5
(32)
Consider the following code snippet: public class MyMouseListener
{
Public void mousePressed(MouseEvent event)
{
Double x;
Double y;
_______
System.out.println("x: " + x + ", y: " + y);
}
}
Which of the following statements should be in the indicated position to print out where the mouse was pressed?
(Multiple Choice)
4.8/5
(34)
Consider the following declarations: public interface Encryptable
{
Void encrypt(String key);
}
Public class SecretText implements Encryptable
{
Private String text;
_____________________________
{
// code to encrypt the text using encryption key goes here
}
}
Which of the following method headers should be used to complete the SecretText class?
(Multiple Choice)
4.9/5
(42)
Which of the following statements about an interface is true?
(Multiple Choice)
4.9/5
(33)
Consider the following code snippet: public class ClickListener implements ActionListener
{
Public void actionPerformed(ActionEvent event)
{
System.out.println("I was clicked.");
}
}
Public class ButtonTester
{
Public static void main(String[] args)
{
JFrame frame = new JFrame();
JButton button = new JButton("Click me!");
Frame.add(button);
ActionListener listener = new ClickListener();
Button.addActionListener(listener);
)..
}
}
Which of the following statements is correct?
(Multiple Choice)
4.9/5
(38)
A method that has no implementation is called a/an ____ method.
(Multiple Choice)
4.9/5
(37)
Which of the following is a good use for an anonymous class?
(Multiple Choice)
4.9/5
(36)
Suppose you are writing an interface called Resizable, which includes one void method called resize. public interface Resizable
{
_________________________
}
Which of the following can be used to complete the interface declaration correctly?
(Multiple Choice)
4.8/5
(39)
The methods of a/an ____ describe the actions to be taken when an event occurs.
(Multiple Choice)
4.9/5
(36)
Consider the following code snippet: class MouseClickedListener implements ActionListener
{
Public void mouseClicked(MouseEvent event)
{
Int x = event.getX();
Int y = event.getY();
Component.moveTo(x,y);
}
}
What is wrong with this code?
(Multiple Choice)
4.9/5
(39)
Which of the following statements about converting between types is true?
(Multiple Choice)
4.8/5
(30)
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? ActionListener listener = new TimerListener();
_________________________________ // missing statement
Timer.start();
(Multiple Choice)
4.7/5
(33)
____ are generated when the user presses a key, clicks a button, or selects a menu item.
(Multiple Choice)
4.8/5
(44)
Consider the following class: public class ClickListener implements ActionListener
{
__________________________________________
{
System.out.println("mouse event ...");
}
}
Which of the following method headers should be used to complete the ClickListener class?
(Multiple Choice)
4.8/5
(37)
Which container is used to group multiple user-interface components together?
(Multiple Choice)
4.8/5
(39)
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();
}
What is wrong with this code?
(Multiple Choice)
4.9/5
(42)
Showing 41 - 60 of 85
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)