Correct : B. Its a process in which two or more parts of same process run simultaneously.
2. Which of these are types of multitasking?
Correct : D. None of the mentioned
3. Which of these packages contain all the Java’s built in exceptions?
Correct : C. java.lang
4. Thread priority in Java is?
Correct : A. Integer
5. What will happen if two thread of same priority are called to be processed simultaneously?
Correct : D. It is dependent on the operating system.
6. Which of these statements is incorrect?
Correct : D. A thread can exist only in two states, running and blocked.
7. Which method executes only once
Correct : B. init() method
8. Thread class is available in
Correct : B. java.lang package
9. Minimum threads in a program are
Correct : A. 1
10. Interfaces helps in which type of inheritance
Correct : A. Multiple inheritance
11. Which of these values is returned by read () method is end of file (EOF) is encountered?
Correct : C. -1
12. Which of these exception is thrown by close () and read () methods?
Correct : A. IOException
13. Which exception is thrown by the read ( ) method of input stream class?
Correct : D. IOException
14. What garbage collection in the context of java?
Correct : C. When all references to an object are gone, the memory used by the object is automatically reclaim
15. In order for a source code file, containing the public class test, to successfully compile,
which of the following must be true?
Correct : B. It must be named test.java
16. Which of the following are true about the Error and Exception classes?
Correct : A. Both classes extend throwable
17. Which of the following are true?
Correct : D. The integer class extends the number class
18. How do you create a Reader object from an InputStream object?
Correct : C. Create an InputStreamReader object passing the InputStream object and an argument to the InputStreamReader constructor.
19. Which of the following is true?
Correct : C. The event delegation model uses event listeners to define the methods of event handling classes.
20. Which of the following is the highest class in the event delegation model?
Correct : B. java.util.EventObject
21. When two or more objects are added as listeners for the same event, which listener is first
invoked to handle the event?
Correct : C. There is no way to determine which listener will be invoked first.
22. Suppose that you want to have an object eh handle the TextEvent of TextArea object t. How should you add eh as the event handler for?
Correct : D. addTextListner(t,eh);
23. Which is true about an anonymous inner class?
Correct : C. It can extend exactly one class or implement exactly one interface.
24. Which is true about a method-local inner class?
Correct : B. It can be marked abstract.
25. Which statement is true about a static nested class?
Correct : B. It does not have access to nonstatic members of the enclosing class.
26. Which of these is correct way of inheriting class A by class B?
Correct : C. class B extends A {}
27. Which of the following are true about interfaces.
Correct : B. Variables declared in interfaces are implicitly public, static, and final.
28. Which of the following is correct way of implementing an interface salary by class manager?
Correct : B. class Manager implements salary {}
29. Which of the following is incorrect statement about packages?
Correct : D. A package can be renamed without renaming the directory in which the classes are stored.
30. Which exception is thrown by read() method?
Correct : A. IOException
31. Which method in Thread class is used to check weather a thread is still running?
Correct : A. isAlive()
32. Which of these class contains the methods print() & println()?
Correct : D. PrintStream
33. To design a general-purpose search method, searchList, to search a list, which of the
following must be parameters of the method searchList? (i) The array containing the list. (ii) The length of the list. (iii) The search item. (iv) A boolean variable indicating whether the search is successful.
Correct : B. (i), (ii), and (iii)
34. Consider the following list.list = {24, 20, 10, 75, 70, 18, 60, 35} Suppose that list is sorted using the selection sort algorithm as discussed in the book. What is the resulting list after two passes of the sorting phase, that is, after two iteration of the outer for loop?
Correct : C. list = {10, 18, 24, 75, 70, 20, 60, 35}
35. Which method would you most likely use to add an element to an end of a vector?
Correct : B. addElement
36. In which package is the class Vector located?
Correct : C. java.util
37. An abstract method ____.
Correct : C. has no body
38. The classes Reader and Writer are derived from the class _________.
Correct : D. Object
39. The method toString() is a public member of the class _____________.
Correct : A. Object
40. For the interface WindowListener that contains more than one method, Java provides the
class ____.
Correct : B. WindowAdapter
41. If a negative value is used for an array index, ____.
Correct : D. an IndexOutOfBoundsException is thrown
42. Consider the following list. int[] intList = {35, 12, 27, 18, 45, 16, 38}; What is the minimum number of comparisons that have to be made to find 18 using a sequential search on intList?
Correct : D. 4
43. Which of these packages contains all the classes and methods required for even handling
in Java?
Correct : D. java.awt.event
44. What is an event in delegation event model used by Java programming language?
Correct : A. An event is an object that describes a state change in a source.
45. Which of these methods are used to register a keyboard event listener?
Correct : C. addKeyListener()
46. Which of these methods are used to register a mouse motion listener?
Correct : C. addMouseMotionListner()
47. What is a listener in context to event handling?
Correct : B. A listener is a object that is notified when an event occurs.
48. Which command disassembles a class file
Correct : D. javap
49. JDBC stands for:
Correct : A. Java Database Connectivity
50. Which of the following statements is false as far as different type of statements is concern in JDBC?
Correct : D. Interim Statement
51. Which statement is static and synchronized in JDBC API?
Correct : C. getConnection()
52. Which driver is efficient and always preferable for using JDBC applications?
Correct : A. Type – 4
53. Which one of the following does not extends java.awt.Component
Correct : C. CheckbocGroup
54. What is default layout manager for panels and applets?
Correct : A. Flowlayout
55. java.awt.Component class method getLocation() returns Point (containg x and y cordinate).What does this x and y specify
Correct : B. Specify the postion of components upper-left component in the coordinate space of the component's parent.
56. Which of the following methods finds the maximum number of connections that a specific driver can obtain?
Correct : C. DatabaseMetaData.getMaxConnections
57. What is the disadvantage of Type-4 Native-Protocol Driver?
Correct : A. At client side, a separate driver is needed for each database.
58. What is the preferred way to handle an object's events in Java 2?
Correct : B. Add one or more event listeners to handle the events
59. Which component method is used to access a component's immediate container?
Correct : C. getParent()
60. Which of the following creates a List with 5 visible items and multiple selections enabled?
Correct : A. new List(5, true)
61. An Applet has its Layout Manager set to the default of FlowLayout. What code would be
the correct to change to another Layout Manager?
Correct : B. setLayout(new GridLayout(2,2));
62. How do you change the current layout manager for a container?
Correct : A. Use the setLayout method.
63. Which of the following methods can be used to draw the outline of a square within a JAVA.awt.Component object?
Correct : A. drawLine()
64. State true or false
(i) JPanel is a class included in awt package (ii) Anonymous classes are mostly used for event handling (iii) Names of anonymous classes must be unique (iv) JOptionPane is an inner class
Correct : C. i-false, ii-true, iii-false, iv-false
65. State true or false
(i) Java RMI supports distributed objects written entirely in java (ii) Java RMI makes use of stubs and skeleton (iii) In Java RMI an object registers itself with a media server (iv) IDL is interface declaration language
Correct : A. True, True, False, False
66. Match the following
(a) Datagram Socket (i) UDP connection
(b) URL (ii) provides a necessary framework of debugging java programs
(c) java.net (iii) makes it possible to communicate over a network with java programs
(d) sun.tools.debug (iv) is a java object that represents WWW address
Correct : A. a-i, b-iv, c-iii, d-ii
67. State true or false (i) public can only be assigned to class (ii) protected protects a statement (iii) protected method is never accessible outside the package (iv) friendly variable may be accessible outside class
Correct : A. True, True, False, True
68. Which refers to a channel through which data flow from the source to the destination:
Correct : C. Stream
69. The ________ method help in clearing the contents of the buffer:
Correct : C. rub()
70. Which of these methods can be used to output a string in an applet?
Correct : C. drawString()
71. Which of these methods are used to register a MouseMotionListener?
Correct : C. addMouseMotionListner()
72. What is a listener in context to event handling?
Correct : B. A listener is an interface that is notified when an event occurs.
73. Which of these events will be generated if scroll bar is manipulated?
Correct : D. WindowEvent
74. Which of these events will be generated if we close a Frame window?
Correct : D. WindowEvent
75. Which of these methods in KeyEvent class can be used to know which key is pressed?
Correct : A. getKeyCode()
76. The default layout manager of an Applet is
Correct : A. Flowlayout
77. The processes that participate in supporting remote method invocation are
Correct : D. All of the above
78. Through the design mode of a builder tool, we use ___ or ____ to customize the bean.
Correct : C. Either (a) or (c)
79. Swing is a ___________ framework
Correct : B. component-based
80. How many kinds of classes can be used in Java RMI?
Correct : B. Two
81. Which method is used to enable an event for a particular object?
Correct : D. enableEvents()
82. How would you detect a keypress in a JComboBox?
Correct : B. Add a KeyListener to the JComboBox’s editor component
83. Which Swing methods are thread-safe?
Correct : D. all of the above
84. Which of the following is not true?
Correct : D. None of the above
85. What is the correct way to write a JavaScript array?
Correct : D. var txt = new Array("tim","kim","jim")
86. What is the correct JavaScript syntax to insert a comment that has more than one line?
Correct : B. /*This comment has more than one line*/
87. What is Remote method invocation (RMI)?
Correct : A. RMI allows us to invoke a method of java object that executes on another machine.
88. Which of this package is used for remote method invocation?
Correct : B. java.rmi
89. Which of these methods are member of Remote class?
Correct : D. None of the mentioned
90. Which of these Exceptions is thrown by remote method?
Correct : A. RemoteException
91. Which of this class is used for creating a client for server-client operations?
Correct : C. AddClient.java
92. Which of this package is used for all the text related modifications?
Correct : A. java.text
93. Which of this package contains classes and interfaces for networking?
Correct : C. java.net
94. Which of these is superclass of ContainerEvent class?
Correct : B. ComponentEvent
95. Which of these events is generated when the size os an event is changed?
Correct : A. ComponentEvent
96. Which of these methods can be used to obtain the reference to the container that generated a ContainerEvent?
Correct : D. getContainerEvent()
97. To locate a remote object with a name t at port 7000 on host panda.armstrong.edu, use
Correct : D. Remote remoteObj = Naming.lookup("rmi://panda.armstrong.edu:7000/t");
98. ____________ is a subinterface of java.rmi.Remote that defines the methods for the server object.
Correct : C. Server object interface
99. Each remote object has a unique name identified by an URL with the protocol rmi as follows:
Correct : B. //host:port/name
100. __________ provides the naming services for the server to register the object and for the
client to locate the object.