Java-Programming (Set 4)
Java-Programming (Set 4)
Java-Programming (Set 4)
4 of 7 sets
302. Swing is not a part of JFC (Java Foundation Classes) that is used to create
GUI application?
o m
A. True
. c
B. False
te
C. none
a
D. all
q M
Answer:B
c
Mto create a Frame By creating the object of Frame
303. These two ways are used
class (association) By extending Frame class (inheritance)
A. True
B. False
C. none
D. all
Answer:B
304. Which package provides many event classes and Listener interfaces for event
handling?
A. java.awt
B. java.awt.Graphics
C. java.awt.event
D. None of the above
Answer:C
305. The ActionListener interface is used for handling action events,For
example,it's used by a
A. JButton
B. JCheckbox
C. JMenuItem
D. All of these
Answer:D
306. Which is the container that doesn't contain title bar and MenuBars. It can
have other components like button, textfield etc?
A. Window
B. Frame
C. Panel
D. Container
Answer:C
307. Which of these package is used for all the text related modifications?
A. java.text
B. java.awt
C. java.lang.text
D. java.text.mofify
Answer:C
309. In RMI which layer defines and supports the invocation semantics of the RMI
connection, this layer maintains the session during the method call?
A. The Stub & Skeleton Layer
B. The Application Layer
C. The Remote Reference Layer
D. The Transport Layer
310. Which method of the Naming class (found in java.rmi) is used to update the
RMI registry on the server machine?
A. rebind ()
B. lookup()
C. Both A & B
D. None of the above
Answer:A
311. In RMI program the following two steps are used to, Either extend the
UnicastRemoteObject class, the exportObject() method of the
UnicastRemoteObject class,
A. Provide the Implementation of the remote interface
B. Create the remote interface
C. Create and start the remote application
D. Compile the implementation class and create the stub and skeleton objects using the rmic tool
Answer:A
313. In RMI program the following example shows the, import java.rmi.*; public
interface Adder extends Remote{ public int add(int x,int y)throws
RemoteException; }
A. Create and start the remote application
B. Create and start the client application
C. Create the remote interface
D. Provide the implementation of the remote interface
Answer:C
315. Which is a one-way communication only between the client and the server and
it is not a reliable and there is no confirmation regarding reaching the message to
the destination?
A. TCP/IP
B. UDP
C. Both A & B
D. None of the above
Answer:B
316. In a RMI Client Program, what are the exceptions which might have to
handled?
A. RemoteException
B. NotBoundException
C. MalFormedURLException
D. All mentioned above
Answer:D
320. Which concept of Java is a way of converting real world objects in terms of
class?
A. Polymorphism
B. Encapsulation
C. Abstraction
D. Inheritance
Answer:C
322. How can we identify whether a compilation unit is class or interface from a
.class file?
A. Java source file header
B. Extension of compilation unit
C. We cannot differentiate between class and interface
D. The class or interface name should be postfixed with unit type
Answer:A
324. Which of these class is used to create an object whose character sequence is
mutable?
A. String()
B. StringBuffer()
C. String() & StringBuffer()
D. None of the mentioned
Answer:B
325. Which of these method of class StringBuffer is used to find the length of
current character sequence?
A. length()
B. Length()
C. capacity()
D. Capacity()
Answer:A
326. What is the string contained in s after following lines of code? StringBuffer s
new StringBuffer("Hello"); s.deleteCharAt(0);
A. Hell
B. ello
C. Hel
D. llo
Answer:B
327. Which of these method(s) is/are used for writing bytes to an outputstream?
A. put()
B. print() and write()
C. printf()
D. write() and read()
Answer:B
328. Which keyword is used by the method to refer to the object that invoked it?
A. import
B. catch
329. What is the return type of a method that does not return any value?
A. int
B. float
C. void
D. double
Answer:C
331. Which of these jump statements can skip processing the remainder of the code
in its body for a particular iteration?
A. break
B. return
C. exit
D. continue
Answer:D
332. Which of these is the method which is executed first before execution of any
other thing takes place in a program?
A. main method
B. finalize method
C. static method
D. private method
Answer:C
333. Which of these data type can be used for a method having a return statement
in it?
334. If an expression contains double, int, float, long, then the whole expression will
be promoted into which of these data types?
A. long
B. int
C. double
D. float
Answer:C
335. Which of the below is invalid identifier with the main method?
A. public
B. static
C. private
D. final
Answer:C
336. Which of these can not be used for a variable name in Java?
A. identifier
B. keyword
C. identifier & keyword
D. none of the mentioned
Answer:B
341. Which of these packages contains the exception Stack Overflow in Java?
A. java.lang
B. java.util
C. java.io
D. java.system
Answer:A
342. Which of this method of class String is used to obtain a length of String
object?
A. get()
B. Sizeof()
C. lengthof()
D. length()
Answer:D
344. Which of these exceptions will be thrown if we use null reference for an
arithmetic operation?
A. ArithmeticException
B. NullPointerException
C. IllegalAccessException
D. IllegalOperationException
Answer:B
345. Which of the interface contains all the methods used for handling thread
related operations in Java?
A. Runnable interface
B. Math interface
C. System interface
D. ThreadHandling interface
Answer:A
346. Which of these class is used to read and write bytes in a file?
A. FileReader
B. FileWriter
C. FileInputStream
D. InputStreamReader
Answer:C
347. Which of these classes is used for input and output operation when working
with bytes?
A. InputStream
B. Reader
C. Writer
350. Which of these class is not related to input and output stream in terms of
functioning?
A. File
B. Writer
C. InputStream
D. Reader
Answer:A
352. Which of these packages contains all the event handling interfaces?
A. java.lang
B. java.awt
C. java.awt.event
355. Which of these exceptions will occur if we try to access the index of an array
beyond its length?
A. ArithmeticException
B. ArrayException
C. ArrayIndexException
D. ArrayIndexOutOfBoundsException
Answer:D
357. Which of the following will ensure the thread will be in running state?
A. yield()
B. notify()
C. wait()
358. Which of these is used to read a string from the input stream?
A. get()
B. getLine()
C. read()
D. readLine()
Answer:C
361. Which of these operators can be used to get run time information about an
object?
A. getInfo
B. Info
C. instanceof
D. getinfoof
Answer:C
365. Which of these methods can be used to obtain the command name for
invoking ActionEvent object?
A. getCommand()
B. getActionCommand()
C. getActionEvent()
D. getActionEventCommand()
Answer:B
373. ______ must be the first non comment statement in the file.
A. package.
B. class.
C. object.
D. declaration.
Answer:A
381. If an expression contains double, int, float, long, then whole expression will
promoted into which of these data types?.
A. .long
B. int.
C. double.
D. float.
Answer:C
386. Which of these operators can skip evaluating right hand operand?.
A. !.
B. |.
C. &.
D. &&.
Answer:D
387. Which exception is thrown by the read () method of Input Stream class?
A. Exception.
B. ClassNotFoundException.
C. read Exception.
389. Using the keyword interface you can fully abstract a _________.
A. method.
B. keyword
C. class.
D. variables.
Answer:C
390. One interface can inherit another by use of the keyword _____.
A. public.
B. extends.
C. method name.
D. class name.
Answer:B
400. ________ is the mechanism that binds together the code and the data.
A. polymorphism.
B. encapsulation.
C. inheritance.
D. together.
Answer:B