Interview Questions on Core Java Language set-3


1) The CODE value in an ......... tag must name a class file that is in the same directory as the calling HTML page.

A. (applet)

B. >applet<

C. <applet>

D. <applet tag>


2) A class can be converted to a thread by implementing the interface ..........

A. Thread

B. Runnable

C. Start

D. Yield


3) Which of the following classes are not available in the java.lang package?

A. Stack

B. Object

C. Math

D. String


4) State True or False for the following statements.

i) Reader class has a method that can read and return floats and doubles

ii) It is possible to use the File class to list the contents of the current of the working directory

A. i-True, ii-False

B. i-False, ii-True

C. i-True, ii-True

D. i-False, ii-False


5) The setBackground() method is part of the following class in JAVA.awt package.

A. Component

B. Graphics

C. Applet

D. Container


6) Which method is used to set the text of a Label object?

A. setText()

B. setLabel()

C. setTextLabel()

D. setLabelText()


7) Which of the following statement is/are True?

i) A Java monitor must either extend Thread class or implement Runnable interface

ii) The CheckboxGroup class is a subclass of the component class

A. i- only

B. ii- only

C. Both i and ii

D. None of the above


8) When we invoke repaint() for JAVA.awt.Component object, the AWT invokes the method .......

A. update()

B. draw()

C. show()

D. paint()


9) Which of the following methods are invoked by the AWT to support paint and repaint operations?

A. paint()

B. repaint()

C. draw()

D. redraw()


10) A thread can make a second thread ineligible for execution by calling the ......... method on the second thread.

A. second()

B. suspend()

C. append()

D. yield()

11) When we implement the Runnable interface, we must define the method

A. run()

B. start()

C. init()

D. main()


12) Which of the following are passed as an argument to the paint() method?

A. A Canvas object

B. A Graphics object

C. An image object

D. A paint object


13) State whether the following statements are True or False.

i) A class may be both abstract and final

ii) A final class may not have any abstract methods

iii) Frames and applets cannot be used together in the same program.

A. i-True, ii-True, iii-False

B. i-True, ii-False, iii-True

C. i-False, ii-True, iii-False

D. i-False, ii-True, iii-True


14) The methods wait() and notify() are defined in?

A. java.lang.String

B. java.lang.Object

C. java.lang.Runnable

D. java.lang.Thread


15) Which of the following components generate action events?

A. Buttons

B. Labels

C. Check boxes

D. Windows


16) Which javadoc tag is used to denote a comment for a method parameter?

A. @method

B. @parameter

C. @arjument

D. @param


17) Which of the following are not the wrapper classes?

A. Byte

B. Vector

C. Integer

D. Short


18) Which of the following classes is used to perform basic console I/O?

A. system

B. security Manager

C. math

D. runtime


19) Which of the following command lines options generates documentation for all classes and methods?

A. -protected

B. -public

C. -private

D. -verbose


20) What is java_g used for?

A. Using the jdb tool

B. Executing a class with optimization turned off

C. To provide information about deprecated methods

D. None of the above

Answers:

1) C. <applet>
2) B. Runnable
3) A. Stack
4) A. i-True, ii-False
5) A. Component
6) A. setText()
7) D. None of the above
8) A. update()
9) A. paint()
10) C. append()
11) A. run()
12) B. A Graphics object
13) C. i-False, ii-True, iii-False
14) B. java.lang.Object
15) A. Buttons
16) D. @param
17) B. Vector
18) A. system
19) C. -private
20) B. Executing a class with optimization turned off


Related Posts:

Share this

Related Posts

Previous
Next Post »