Ads Here

Friday, January 23, 2015

Objective Questions on Core Java Language set-2


1) The methods wait() and notify() are defined in

A. java.lang.String

B. java.lang.Runnable

C. java.lang.Object

D. java.lang.Thread


2) The data or variables, defined within a class are called ..... variables.

A. object

B. class

C. instance

D. schema


3) When we implement the Runnable interface, we must define the method.

A. start()

B. init()

C. run()

D. resume()


4) ........ class must give a concrete method.

A. abstract

B. constructor

C. least

D. program


5) Which exception is thrown by the read() method of input stream class?

A. Exception

B. FileNotFoundException

C. ReadException

D. IOException


6) When a method calls itself, it is called ......

A. recursion

B. distance

C. display

D. problem


7) Which of the following statements are true?

i) An abstract class may not have any final methods.

ii) A final class may not have any abstract methods

iii) An inner class may be declared with any accessibility keyword

iv) Transient variable must be static

A. i and ii

B. ii and iii

C. iii and iv

D. All i, ii, iii and iv


8) Which of the following statements is/are false?

A. A java monitor must either extend thread or implement runnable

B. The sleep() method should be enclosed in try .... catch block.

C. A thread can be temporarily suspended from running by using the wait() method.

D. A suspended thread using suspend() method can be received using the resume() method.


9) What does J2SE mean?

A. Java 2 Platform Standard Edition

B. Java 2 Internet Standard Edition

C. Java 2 System Edition

D. Java 2 Platform Independent Standard Edition


10) An ........ is a special kind of Java program that is designed to be transmitted over the Internet.

A. viewlet

B. applet

C. servlet

D. object

11) Which are the valid ways to create DataInptStream streams?

A. new DataInputStream();

B. new DataInputStream("in.dat', "r");

C. new DataInputStream(new File("in.dat"));

D. new DataInputStream(new FileInputStream("in.dat");


12) finalize() is only called just prior to .....

A. initialization

B. runtime

C. garbage collection

D. destruction


13) When we invoke repaint() for a component, the AWT invokes the method

A. draw()

B. show()

C. update()

D. paint()


14) What is the use of valueOf() method?

A. It converts data from its internal format into a human-readable form.

B. It converts integer value to string

C. It converts string to int value

D. It converts string to float value


15) What is the default thread at the time of starting the program?

A. Main thread

B. Thread Group

C. Child Thread

D. Thread Pool


16) What does the following line of code do?

       TextField text= new TextField(10);

A. Creates text object that can hold 10 rows of text

B. Creates text object that can hold 10 columns of text

C. Creates the object text and initialize it with the value 10

D. The code is illegal


17) .......... is an applet tag.

A. (applet)

B. >applet<

C. <applet>

D. <applet tag>


18) In Java thread to thread communication is called ......

A. Passing

B. sending

C. Messaging

D. Calling


19) AWT stands for

A. abstract window toolkit

B. abstract window toolbar

C. access window toolbar

D. access window toolbar


20) The setBackground() method is part of the class

A. Graphics

B. Applet

C. Component

D. Container

Answers:

1) C. java.lang.Object
2) C. instance
3) D. resume()
4) A. abstract
5) D. IOException
6) A. recursion
7) B. ii and iii
8) A. A java monitor must either extend thread or implement runnable
9) A. Java 2 Plateform Standard Edition
10) B. applet
11) D. new DataInputStream(new FileInputStream("in.dat");
12) C. garbage collection
13) C. update()
14) D. It converts string to float value
15) A. Main thread
16) B. Creates text object that can hold 10 columns of text
17) C. <applet>
18) C. Messaging
19) A. abstract window toolkit
20) C. Component

Related Posts:

No comments:

Post a Comment