- •11. Which of the following statements imports the entire package java.Util into a Java program? (a) import util; (b) import util.*; (c) import java.Util.*; (d) import java.Util;
- •13. After a breakpoint is hit, a debugger is typically used for which of the following tasks?
- •I. Stepping through method calls, line by line II. Examining a stack trace
- •III. Examining values of variables in the current method
- •Which of the following may be substituted for X in the above diagram to represent a multiplicity between a and b?
- •36. Consider the following Java program segment.
- •37. If a class contains a constructor, that constructor will be invoked
- •39. Consider the following uml class diagram.
- •Which of the following kinds of associations is not indicated by the class diagram?
- •47. Consider the following uml class diagram.
- •61. Consider the following Java program segment.
- •83. In object-oriented design, types of multiplicity for associations among classes include which of the following?
- •(A) I and II only (b) I, II, and III (c) I and III only (d) II and III only
- •96. In Java, which of the following is (are) true regarding interfaces?
- •I. An interface can extend a class. II. An interface can extend multiple interfaces. (a) I only (b) None (c) I and II (d) II only
- •99. Which of the following is (are) true regarding the strategy design pattern?
- •I. A family of algorithms are combined into a large single method. II. Polymorphism is used.
- •106. Which of the following Java program segments will compile and execute without error?
- •System.Out.Println(numbers[I]);
- •System.Out.Println(numbers[I]);
- •107. Consider the following uml class diagram.
- •109. Consider the following uml class diagram.
- •111. Consider the following uml class diagram.
- •115. Which of the following Java method declarations does not require that the method return a value? (a) private int myMethod(); (b) private static int myMethod();
36. Consider the following Java program segment.
PrintWriter fileOut = new PrintWriter(
new FileWriter("output.txt"));
If the file output.txt already exists, which of the following events will occur when the program segment is executed?
(a) The existing contents of output.txt will be preserved.
(b) The existing contents of output.txt will be erased.
(c) A FileAlreadyExists exception will be raised.
(d) A run-time error will be generated.
37. If a class contains a constructor, that constructor will be invoked
(a) once at the beginning of any program that uses that class
(b) once the first time an object of that class is instantiated
(c) each time an object of that class is instantiated
(d) each time an object of that class goes out of scope
38. When a subclass defines an instance method with the same return type and signature as a method in its parent, the parent's method is said to be
(a) overloaded (b) hidden (c) overridden (d) private
39. Consider the following uml class diagram.
Which of the following kinds of associations is not indicated by the class diagram?
(a) One-to-one (b) One-way (c) Binary (d) Specialization/generalization
40. Regarding the following declaration, what is the index of the element containing 45?
int[] numbers = {-1, 45, 6, 132};
(a) 45 (b) 0 (c) 1 (d) 2
41. Which of the following statements is not true of the class java.util.Vector?
(a) An instance of Vector can store any object whose class descends from java.lang.Object.
(b) Once an object is inserted into an instance of Vector, it can never be removed.
(c) The constructor of the Vector class, when called with no arguments, causes an empty vector to be constructed.
(d) Items stored by an instance of Vector can be accessed using integer indexes.
42. Which of the following statements is (are) true about any abstract method in Java?
I .It contains no definition.
II .It cannot be declared public.
(a) II only (b) None (c) I only (d) I and II
43. Which is the Java keyword that denotes the use of an interface?
(a) implements (b) extends (c) interface (d) import
44. A design pattern is typically used to
(a) reduce the number of classes in the design of a program
(b) describe a practical solution to a common design problem
(c) allow the use of object-orientated concepts in a language that is not object-oriented
(d) ensure that code executes at optimal speed during runtime
45. Which of the following is true of the Singleton design pattern?
(a) It ensures that the methods of a class are called by only one other class.
(b) It ensures that only one instance of a class is created.
(c) It describes classes that have only one method.
(d) It describes classes that have only one instance variable.
46. In which of the following design patterns is a family of algorithms encapsulated into individual but interchangeable classes?
(a) Decorator (b) Singleton (c) Strategy (d) Proxy
47. Consider the following uml class diagram.
Which of the following may be substituted for X in the above diagram to represent a multiplicity between a and b?
I. 1 II. 0..* III. 1..*
(a) I, II, and III (b) III only (c) II and III only (d) I and II only
48. Which of the following is true regarding the controller part in the Model-View-Controller (MVC) paradigm?
(a) The controller is the abstract domain knowledge of an application.
(b) The controller is the way in which the abstract domain knowledge of an application is presented to the user.
(c) The controller is the list of abstract classes in an application.
(d) The controller is the automatic mechanism by which the user interface is displayed and by which events are communicated between the model and the view.
49. In Java, the default layout manager for a JPanel component is
(a) FlowLayout (b) GridBagLayout (c) BorderLayout (d) GridLayout
50. In Java, the default layout manager for a JFrame component is
(a) GridLayout (b) BorderLayout (c) FlowLayout (d) GridBagLayout
51. Which of the following is (are) true regarding containers and components in the context of java GUI?
I .A container can be added to a component.
II .A component can be added to a container.
III .A container can be added to another container.
(a) II and III only (b) I and III only (c) I and II only (d) I, II, and III
52. Which of the following streams typically correspond(s) to screen output?
I. System.in II. System.out III. System.err
(a) III only (b) I, II, and III (c) II and III only (d) II only
53. Which of the following lines follow(s) Sun's guidelines for documenting input parameters in a Javadoc comment?
I. * @param foo the value to be tested II. * @param int foo III. * @param the value to be tested
(a) I only (b) None (c) III only (d) II only
54. Which of the following is a Java event that is generated when the close button on a JFrame component is pressed?
(a) DisposeEvent (b) WindowEvent (c) ExitEvent (d) CloseEvent
55. Which of the following is (are) true regarding event handling in Java?
I .When a GUI component is created, the component automatically has the ability to generate events during user interaction.
II .Each Listener object must be registered with the specific component object or objects for which the Listener object is to respond.
(a) II only (b) I and II (c) I only (d) None
56. Which of the following is a Java event that is generated when a JButton component is pressed?
(a) ButtonEvent
(b) ActionEvent
(c) WindowEvent
(d) ClickEvent
57. Which of the following follow(s) Sun's naming conventions for Java methods?
I. getValue(); II. GetValue(); III. GET_VALUE();
(a) I and II only (b) I only (c) II only (d) I, II, and III
58. In Java, what is the signature of the method in the WindowListener interface where code is to be added to end a program when the close button is pressed?
(a) void windowClosed (WindowEvent we) (b) void windowAdapter (WindowEvent we)
(c) void windowClosing (WindowEvent we) (d) void windowDeactivated (WindowEvent we)
59. Which of the following identifiers follow(s) Sun's naming conventions for Java constants?
I. START_DATE II. Serving_Size III. AnnualFee
(a) I, II, and III (b) I only (c) I and II only (d) I and III only
60. The ActionEvent class and ActionListener interface are available in the _____ package of Java.
(a) java.awt.event (b) javax.event (c) java.event (d) javax.swing.event
