Java-Programming (Set 3)
Java-Programming (Set 3)
3 of 7 sets
205. What will happen if two thread of same priority are called to be processed
simultaneously?
A. Any one will be executed first lexographically
B. Both of them will be executed simultaneously
C. None of them will be executed
D. It is dependent on the operating system.
Answer:D
211. Which of these values is returned by read () method is end of file (EOF) is
encountered?
A. 0
B. 1
C. -1
D. Null
Answer:C
213. Which exception is thrown by the read ( ) method of input stream class?
A. Exception
B. ClassNotFoundException
C. read Exception
D. IOException
Answer:D
215. In order for a source code file, containing the public class test, to successfully
compile, which of the following must be true?
216. Which of the following are true about the Error and Exception classes?
A. Both classes extend throwable
B. The error class is final and exception class is not.
C. The Exception class is final and the Error is not.
D. Both classes implement Throwable
Answer:A
220. Which of the following is the highest class in the event delegation model?
A. java.util.EventListner
B. java.util.EventObject
C. java.util.AWTEvent
D. java.util.event.AWTEvent
Answer:B
221. When two or more objects are added as listeners for the same event, which
listener is first invoked to handle the event?
A. The first object that was added as listner.
B. The last object that was added as listner
C. There is no way to determine which listener will be invoked first.
D. It is impossible to have more than one listener for a given event.
Answer:C
222. 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?
A. t.addTextListener(eh);
B. eh.addTextListner(t);
C. addTextListner(eh.t);
D. addTextListner(t,eh);
Answer:D
231. Which method in Thread class is used to check weather a thread is still
running?
A. isAlive()
B. Join()
C. isRunning()
D. Alive()
Answer:A
232. Which of these class contains the methods print() & println()?
A. System
B. System.out
C. BufferedOutputStream
D. PrintStream
Answer:D
235. Which method would you most likely use to add an element to an end of a
vector?
A. insertElementAt
B. addElement
C. copyInto
D. lastElement
Answer:B
238. The classes Reader and Writer are derived from the class _________.
A. Streams
B. Inputs
240. For the interface WindowListener that contains more than one method, Java
provides the class ____.
A. MouseAdapter
B. WindowAdapter
C. KeyListener
D. KeyAdapter
Answer:B
242. 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?
A. 1
B. 2
C. 3
D. 4
Answer:D
245. Which of these methods are used to register a keyboard event listener?
A. KeyListener()
B. addKistener()
C. addKeyListener()
D. eventKeyboardListener()
Answer:C
246. Which of these methods are used to register a mouse motion listener?
A. addMouse()
B. addMouseListener()
C. addMouseMotionListner()
D. eventMouseMotionListener()
Answer:C
250. Which of the following statements is false as far as different type of statements
is concern in JDBC?
A. Regular Statement
B. Prepared Statement
C. Callable Statement
D. Interim Statement
Answer:D
252. Which driver is efficient and always preferable for using JDBC applications?
A. Type – 4
B. Type – 1
C. Type – 3
D. Type – 2
256. Which of the following methods finds the maximum number of connections
that a specific driver can obtain?
A. Database.getMaxConnections
B. Connection.getMaxConnection
C. DatabaseMetaData.getMaxConnections
D. ResultSetMetaData.getMaxConnections
Answer:C
260. Which of the following creates a List with 5 visible items and multiple
selections enabled?
A. new List(5, true)
B. new List(true, 5)
C. new List(5, false)
D. new List(false, 5)
Answer:A
261. An Applet has its Layout Manager set to the default of FlowLayout. What
code would be the correct to change to another Layout Manager?
A. setLayoutManager(new GridLayout());
B. setLayout(new GridLayout(2,2));
C. setGridLayout(2,2);
D. setBorderLayout();
Answer:B
263. Which of the following methods can be used to draw the outline of a square
within a JAVA.awt.Component object?
A. drawLine()
B. fillRect()
C. drawPolygon()
D. drawPolygon()
Answer:A
264. 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
A. i-false, ii-false, iii-true, iv-true
B. i-true, ii-false, iii-true, iv-false
C. i-false, ii-true, iii-false, iv-false
D. i-true, ii-true, iii-false, iv-true
Answer:C
265. 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
A. True, True, False, False
B. False, True, True, True
C. True, False, True, False
D. True, True, True, True
Answer:A
267. 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
A. True, True, False, True
B. False, False, False, True
C. False, True, False, False
D. True, False, False, False
Answer:A
268. Which refers to a channel through which data flow from the source to the
destination:
A. String
B. Character
C. Stream
D. Buffer
Answer:C
269. The ________ method help in clearing the contents of the buffer:
A. flush()
B. clear()
C. rub()
D. vanish()
Answer:C
275. Which of these methods in KeyEvent class can be used to know which key is
pressed?
A. getKeyCode()
B. getModifier()
C. getActionKey()
D. getActionEvent()
277. The processes that participate in supporting remote method invocation are
A. Client
B. Server
C. Object Registry
D. All of the above
Answer:D
278. Through the design mode of a builder tool, we use ___ or ____ to customize
the bean.
A. Property sheet
B. Bean customizer
C. Either (a) or (c)
D. None of the above
Answer:C
286. What is the correct JavaScript syntax to insert a comment that has more than
one line?
A. <!--This comment has more than one line-->
B. /*This comment has more than one line*/
C. //This comment has more than one line//
D. <//This comment has more than one line//>
Answer:B
291. Which of this class is used for creating a client for server-client operations?
A. serverClientjava
B. Client.java
C. AddClient.java
D. ServerClient.java
Answer:C
292. Which of this package is used for all the text related modifications?
A. java.text
B. java.awt
C. java.lang.text
D. java.text.mofify
Answer:A
293. Which of this package contains classes and interfaces for networking?
A. java.io
B. java.util
C. java.net
D. java.network
Answer:C
295. Which of these events is generated when the size os an event is changed?
A. ComponentEvent
B. ContainerEvent
C. FocusEvent
296. Which of these methods can be used to obtain the reference to the container
that generated a ContainerEvent?
A. getContainer()
B. getContainerCommand()
C. getActionEvent()
D. getContainerEvent()
Answer:D
299. Each remote object has a unique name identified by an URL with the protocol
rmi as follows:
A. http://host:port/name
B. //host:port/name
C. http://host/name
D. rmi://host:port/name
Answer:B
300. __________ provides the naming services for the server to register the object
and for the client to locate the object.