CST 8284 Exam Questions and Correct Answers 100% Verified Graded A+
c- 1. What pattern does the Java event model resemble.
a) Model-View-Controller
b) Simple Factory
c) Observer
d) None of the above
b- 1. Which of the following statements about adapters is
false.
a) An adapter class implements an interface.
b) An adapter class provides a default (empty) implementation of every method in
the interface.
c) Programmers override selected adapter methods.
d) A ComponentListener is a ComponentAdaptor.
c- 1. class Q6 {
2. public static void main(String args[]) {
3. Holder h = new Holder();
4. h.held = 100;
5. h.bump(h);
6. System.out.println(h.held);
7. }
,8. }
9.
10. class Holder {
11. public int held;
12. public void bump(Holder theHolder) { theHolder.held++; }
13. }
What value is printed out at line 6?
a) 0
b) 1
c) 101
d) 100
c- Which of the following does not generate GUI events.
a) Typing in a text field.
b) Selecting an item from a menu.
c) Viewing the text in a label.
d) Moving the mouse.
e- Assume that the class AcLis implements the ActionListener interface. The code
fragment below constructs a button and gives it four action listeners. When the button is pressed,
which action listener is the first to get its actionPerformed() method invoked?
Button btn = new Button("Hello");
2. AcLis a1 = new AcLis();
,3. AcLis a2 = new AcLis();
4. AcLis a3 = new AcLis();
5. AcLis a4 = new AcLis();
6. btn.addActionListener(a1);
7. btn.addActionListener(a2);
8. btn.addActionListener(a3);
9. btn.addActionListener(a4);
10. btn.removeActionListener(a2);
11. btn.removeActionListener(a3);
12. btn.addActionListener(a3);
13. btn.addActionListener(a2);
a) a1 gets its actionPerformed() method invoked first.
b) a2 gets its actionPerformed() method invoked first.
c) a3 gets its actionPerformed() method invoked first.
d ) a4 gets its actionPerformed() method invoked first.
e) It is impossible to know which listener will be first.
b- 1. You cannot access a database using a servlet.
a) True
b) False
, c- A typical servlet would output ____.
a) XML.
b) XSL.
c) HTML.
d) none of these. 1
b- When you want to listen for an event, you can implement an appropriate __________
for your class.
a) handler.
b) listener.
c) abstract class.
d) superclass.
c- The catch block that begins catch (Exception ex) can catch Exceptions of type.
a) IOException
b) ArithmeticException
c) both of these
d) neither of these
d- Which of the following statements about JPanels is false.
a) A JPanel is a JComponent.
c- 1. What pattern does the Java event model resemble.
a) Model-View-Controller
b) Simple Factory
c) Observer
d) None of the above
b- 1. Which of the following statements about adapters is
false.
a) An adapter class implements an interface.
b) An adapter class provides a default (empty) implementation of every method in
the interface.
c) Programmers override selected adapter methods.
d) A ComponentListener is a ComponentAdaptor.
c- 1. class Q6 {
2. public static void main(String args[]) {
3. Holder h = new Holder();
4. h.held = 100;
5. h.bump(h);
6. System.out.println(h.held);
7. }
,8. }
9.
10. class Holder {
11. public int held;
12. public void bump(Holder theHolder) { theHolder.held++; }
13. }
What value is printed out at line 6?
a) 0
b) 1
c) 101
d) 100
c- Which of the following does not generate GUI events.
a) Typing in a text field.
b) Selecting an item from a menu.
c) Viewing the text in a label.
d) Moving the mouse.
e- Assume that the class AcLis implements the ActionListener interface. The code
fragment below constructs a button and gives it four action listeners. When the button is pressed,
which action listener is the first to get its actionPerformed() method invoked?
Button btn = new Button("Hello");
2. AcLis a1 = new AcLis();
,3. AcLis a2 = new AcLis();
4. AcLis a3 = new AcLis();
5. AcLis a4 = new AcLis();
6. btn.addActionListener(a1);
7. btn.addActionListener(a2);
8. btn.addActionListener(a3);
9. btn.addActionListener(a4);
10. btn.removeActionListener(a2);
11. btn.removeActionListener(a3);
12. btn.addActionListener(a3);
13. btn.addActionListener(a2);
a) a1 gets its actionPerformed() method invoked first.
b) a2 gets its actionPerformed() method invoked first.
c) a3 gets its actionPerformed() method invoked first.
d ) a4 gets its actionPerformed() method invoked first.
e) It is impossible to know which listener will be first.
b- 1. You cannot access a database using a servlet.
a) True
b) False
, c- A typical servlet would output ____.
a) XML.
b) XSL.
c) HTML.
d) none of these. 1
b- When you want to listen for an event, you can implement an appropriate __________
for your class.
a) handler.
b) listener.
c) abstract class.
d) superclass.
c- The catch block that begins catch (Exception ex) can catch Exceptions of type.
a) IOException
b) ArithmeticException
c) both of these
d) neither of these
d- Which of the following statements about JPanels is false.
a) A JPanel is a JComponent.