Java Programming Questions and Answers Set 9

Java Programming OOPs

Questions 81 to 90

What is the fundamental unit of information of writer streams?
(a)   Characters                                      (b) Bytes
(c)   Files                                               (d) Records             (e) Information.
File class is included in which package?
(a) package                               (b) java.lang package
(c)   java.awt package                            (d)
(e)   java.util.package.
Given the code
              String s1 = “ yes” ;
              String s2 = “ yes “ ;
              String s3 = new String ( s1);
Which of the following would equate to true?

(a)   s1 == s2           (b) s1 = s2              (c) s3 == s1             (d) s3=s1                (e) s1!=s2.
URL stands for
(a)   Universal reader locator                   (b) Universal reform loader
(c)   Uniform resource loader                  (d) Uniform resource locator
(e)   Uniform reader locator.
What is the sequence of major events in the life of an applet?
(a)                           init, start, stop, destroy                          (b) start, init , stop , destroy
(c)   init, start , destroy, stop                  (d) init, start, destroy
(e)   destroy, start, init, stop.
Which of the following is true in regard to applet execution?
(a)   Applets loaded from the same computer where they are executing have the same restrictions as applets loaded from the network. 
(b)   Applets loaded and executing locally have none of the restrictions faced by applets that get loaded from the network.
(c)   Applets loaded and executing locally have some restrictions faced by applets that get loaded from the network.
(d)   Applets cant react  to user input and change dynamically
(e)   Applets can be run independently.
What is the return type of the method getID() defined in AWTEvent class
(a)   Int                    (b) long                   (c) Object                (d) Component        (e) float.
Which of the following events will cause a thread to die?
(a)   The method sleep( ) is called
(b)   The method wait( ) is called
(c)   Execution of the start( ) method ends
(d)   Execution of the run( ) method ends
(e)   Execution of the run() method is called.
What will be the result of the expression 13 & 25?
(a)   38                    (b) 25                      (c) 9                        (d) 12                      (e) 21.
Which of the following statements are true regarding the finalize( ) method?
(a)   The finalize ( ) method must be declared with protected accessibility
(b)   The compiler will fail to compile the code that explicitly tries to call the finalize( ) method
(c)   The body of the finalize ( ) method can only access other objects that are eligible for garbage collection
(d)   The finalize ( ) method can be overloaded
(e)   The finalize() method cant be overloaded.      


Answer : (a)
Reason : Writer streams uses characters as their fundamental unit of information.
Answer : (a)Reason :File class is included in inputoutput
Answer : (a)
Reason : == is a comparision operator whereas = is an assignment operator.
Answer : (d)
Reason : The abbreviation of URL uniform resource locator.
Answer : (a)
Reason : The remaining all are incorrect because the sequence of major events are wrong.
Answer : (b)
Reason : The remaining Choices are contradicting the properties of applets.
Answer : (a)
Reason : Int is the return type of the method getID() in AWTEvent Class.
Answer : (d)
Reason : A thread dies when the execution of the run( ) method ends. The call to the start method is asynchronous, that is, it returns immediately, and it enables the thread for running. Calling the sleep( ) or wait( ) methods will only block the thread temporarily.
Answer : (c)
Reason : 11001&1101==9;
Answer : (d)
Reason : The finalize( ) method like any method can be called explicitly if it is accessible. Intended purpose of the method is to be called by the garbage collector in order to clean up before an object is destroyed. Overloading the finalize ( ) method is allowed, but only the method with the original signature will be called by the garbage collector.

<< Prev   1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   16   17   18   19   20   21   22  

 23   24   25   26   27   28   29   30  Next >>

1 comment :

  1. The Q.83 is wrong, the answer must be (e) s1!=s2. Because s1 = " yes" and s2 = " yes ". There are more blanks in s2 than s1.