Name:_______________________
Name:_______________________
Covers Chs 32-35 |Sample Exam | |
Multiple Choice Questions Only for This Test
Part I: Questions: (1 pts each)
1 An event adapter can be implemented using ___________.
A. standard adapter
B. inner class adapter
C. anonymous inner class adapter
2 The signature for the accessor method of a Date property birthDate should be __________.
A. public java.util.Date birthDate()
B. public java.util.Date getBirthDate()
C. private java.util.Date birthDate()
D. private java.util.Date getBirthDate()
E. public java.util.Date getbirthDate()
3 The signature for the mutator method of a Date property birthDate should be __________.
A. public void birthDate(java.util.Date date)
B. public void setBirthDate(java.util.Date date)
C. public void setbirthDate()
D. public void birthDate()
4 An event and its corresponding listener is referred to as ____________.
A. an event set
B. an event class
C. an event pair
D. an event object
5
Which of the following is true?
A. A bean must implement the java.io.Serializable interface to ensure a persistent state.
B. A bean must be a public class.
C. A bean must have a public no-arg constructor.
D. A bean cannot have any constructors with parameters.
6 The signature for the accessor method of a Boolean property visible should be __________.
A. public boolean visible()
B. public boolean getVisible()
C. public static boolean isVisible()
D. public boolean isVisible()
E. private boolean isVisible()
7 Any event is an instance of _________.
A. java.awt.ActionEvent
B. javax.swing.JComponent
C. java.ponent
D. java.util.EventObject
8 5 Creating Custom Event Sets
10. Which of the followings are true?
A. By convention, an event class should be named with suffix Event.
B. An event class does not have a no-arg constructor, because you must always specify a source for the event when creating an event.
C. A custom event class must extend java.util.EventObject or a subclass of java.util.EventObject.
D. A custom event listener interface must extend java.util.EventListener or a subinterface of java.util.EventListener, and define the signature of the handlers.
E. A listener interface for a custom event BeatEvent should be named BeanListener by convention.
9 Which of the following is true?
A. Events can be unicasted (only one listener object is notified of the event).
B. Events can be multicasted (each object in a list of listeners is notified of the event).
C. The naming pattern for adding a multicast listener is "public void addListener(Listener l)"
D. The naming pattern for adding a unicast listener is "public void addListener(Listener l) throws TooManyListenersException"
E. A source component must have the appropriate registration and deregistration methods for adding and removing listeners.
10 The signature for the mutator method of a Date property birthDate should be __________.
A. public void birthDate(java.util.Date date)
B. public void setbirthDate()
C. public void birthDate()
D. public void setBirthDate(java.util.Date date)
E. public void setBirthDate(java.util.Date date)
11 Any listener is an instance of _________.
A. java.util.EventListener
B. javax.swing.JComponent
C. java.util.EventObject
D. java.awt.ActionListener
12 The signature for the registration method for an ActionEvent should be __________.
A. public void addActionListener(ActionEvent l)
B. public void setAction(ActionListener l)
C. public void setActionListener(ActionListener l)
D. public void addActionListener(ActionListener l)
13 The size of a component in a container is determined by __________
A. the type of layout manager used by the container.
B. certain properties common to all components (such as preferredSize, minimumSize, maximumSize, alignmentX, and alignmentY).
C. the size of the container.
D. the layout constraints associated with each component.
14 Which of the following properties are in JApplet?
A. title
B. contentPane
C. resizable
D. jMenuBar
E. iconImage
15 ___________ is a Swing layout manager that arranges components on top of each other.
A. BorderLayout
B. BoxLayout
C. CardLayout
D. OverlayLayout
E. GridLayout
16 Which of the following properties are in BorderLayout?
A. alignment
B. hgap
C. layout
D. vgap
E. visible
17 Which of the following methods create an EtchedBorder?
A. BorderFactory.createEtchedBorder(Color.YELLOW, Color.RED)
B. new EtchedBorder()
C. new EtchedBorder(Color.YELLOW, Color.RED)
D. BorderFactory.createEtchedBorder()
18
Which of the following properties are in JFrame?
A. jMenuBar
B. title
C. iconImage
D. resizable
E. contentPane
19 Which of the following properties are in CardLayout?
A. visible
B. alignment
C. vgap
D. layout
E. hgap
20 The preferredSize property is ignored in ______________.
A. FlowLayout
B. BorderLayout
C. GridLayout
D. Null layout
21 Which of the following are the valid methods in JTabbedPane?
A. getToolTipTextAt(index)
B. getTabCount()
C. getTabPlacement()
D. getTitleAt(index)
22 To use no layout manager in a container c, use _________.
A. c.setLayout(NullLayout)
B. c.setLayout(null)
C. c.setLayout()
D. c.setLayout(new NullLayout())
23 Every layout manager is an instace of __________.
A. the LayoutManager interface
B. the LayoutManager class
C. the Layout class
D. the Layout interface
24 Which of the following methods create a LineBorder?
A. new LineBorder()
B. BorderFactory.createLineBorder(Color.YELLOW)
C. new LineBorder(Color.YELLOW, 3)
D. new LineBorder(Color.YELLOW, 3, true)
E. BorderFactory.createLineBorder(Color.YELLOW, 4)
25 Which of the following properties in java.ponent may effect layout?
A. font
B. background
C. minimumSize
D. maximumSize
E. preferredSize
26 You can construct a JScrollPane using ____________.
A. new JScrollPane(Component[])
B. new JScrollPane(Component)
C. new JScrollPane()
D. new JScrollPane(Component, Component)
27 __________ is a Swing layout manager that arranges components in a row or a column.
A. GridLayout
B. FlowLayout
C. BorderLayout
D. BoxLayout
E. CardLayout
28 Which of the following properties are in CardLayout?
A. hgap
B. alignment
C. visible
D. layout
E. vhap
29 How do you display a JPopupMenu?
A. Add the JPopupMenu to a container.
B. Invoke the setVisible(true) from a JPopupMenu.
C. Invoke the show() from a JPopupMenu.
D. Invoke the show(Component, x, y) from a JPopupMenu.
30 _____________ is the action that causes a popup menu to be displayed.
A. Popup trigger
B. Popup action
C. Popup reaction
D. Popup event
31 A JRadioButtonMenuItem is a subclass of ________.
A. JMenuItem
B. AbstractButton
C. JMenu
D. JComponent
32 A JCheckBoxMenuItem is a subclass of ________.
A. AbstractButton
B. JComponent
C. JMenuItem
D. JMenu
33 The method __________ places a menu item mi into a menu mu.
A. mu.addMenuItem(mi)
B. mu.add(mi)
C. None of the above.
D. mu.addItem(mi)
34 ___________ allows you to create custom buttons.
A. A confirmation dialog
B. An input dialog
C. A message dialog
D. An option dialog
35 ______________ displays a message that alerts the user and waits for the user to click the OK button to close the dialog.
A. A message dialog
B. An input dialog
C. An option dialog
D. A confirmation dialog
36 You can add a menu item into set an imageIcon property on ___________.
A. a JMenuItem
B. a JRadioButtonMenuItem
C. a JMenu
D. a JCheckBoxMenuItem
37 A MenuItem object can generate __________ events.
A. ComponentEvent
B. ActionEvent
C. ItemEvent
D. ContainerEvent
38 __________ is used to receive input from the user.
A. An option dialog
B. A confirmation dialog
C. A message dialog
D. An input dialog
39 Which of the following statements are true?
A. You can add a JMenu to a JPopupMenu.
B. You can add a JMenuItem to a JPopupMenu.
C. You can add a JPopupMenu to a JMenu.
D. You can add a JCheckBoxMenuItem to a JPopupMenu.
E. You can add a JRadioButtonMenuItem to a JPopupMenu.
40 How do you display a JPopupMenu?
A. Invoke the show(Component, x, y) from a JPopupMenu.
B. Add the JPopupMenu to a container.
C. Invoke the setVisible(true) from a JPopupMenu.
D. Invoke the show() from a JPopupMenu.
41 You can set an imageIcon property on ___________.
A. a JRadioButtonMenuItem
B. a JCheckBoxMenuItem
C. a JMenuItem
D. a JMenu
42 The method __________ places a menu mu into a menu bar mb.
A. mb.addMenuItem(mu)
B. mb.addItem(mu)
C. mb.add(mu)
D. None of the above.
43 The method __________ separates menu items in a menu mu.
A. mu.add('-')
B. None of the above.
C. mu.addSeparator()
D. Either a or b
44 A JRadioButtonMenuItem is a subclass of ________.
A. AbstractButton
B. JMenu
C. JComponent
D. JMenuItem
45 ____________ asks a question and requires the user to respond with an appropriate button.
A. An input dialog
B. A confirmation dialog
C. An option dialog
D. A message dialog
46 Which of the following statements are true?
A. JButton has an add method that enables you to add an instance of Action to the menu.
B. JToolBar has an add method that enables you to add an instance of ActionListener to the menu.
C. JButton has a constructor new JButton(Action) that enables you to add an instance of Action to the menu.
D. JButton has an add method that enables you to add an instance of ActionListener to the menu.
E. JToolBar has an add method that enables you to add an instance of Action to the menu.
47 A JMenu is a subclass of ________.
A. JComponent
B. AbstractButton
C. JButton
D. JMenuItem
48 ______________ displays a message that alerts the user and waits for the user to click the OK button to close the dialog.
A. An input dialog
B. A message dialog
C. A confirmation dialog
D. An option dialog
Keys:
1. ABC
2. B
3. B
4. AC
5. ABC
6. D
7. D
8. ABCDE
9. ABCDE
10. E
11. A
12. D
13. ABCD
14. BD
15. D
16. BD
17. ABCD
18. ABCDE
19. CE
20. CD
21. ABCD
22. B
23. A
24. BCDE
25. CDE
26. BC
27. D
28. AE
29. D
30. A
31. ABD
32. ABC
33. B
34. D
35. A
36. ABCD
37. B
38. D
39. BDE
40. A
41. ABCD
42. C
43. D
44. ACD
45. B
46. CE
47. ABD
48. B
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- company name and stock symbol
- why your name is important
- native american name generator
- why is my name important
- why is god s name important
- last name that means hope
- name for significant other
- name synonym list
- me and name or name and i
- name and i vs name and me
- name and i or name and myself
- name and i or name and me