Java Programming Questions and Answers Set 8

Java Programming OOPs

Questions 71 to 80



71.
What is garbage collection in the context of Java?
(a)   The operating system periodically deletes all of the java files available on the system.
(b)   Any package imported in a program and not used is automatically deleted.
(c)   When all references to an object are gone, the memory used by the object is automatically reclaimed.
(d)   The JVM checks the output of any Java program and deletes anything that doesn't make sense.
(e)   When all references to an object are gone the memory used by the object is not reclaimed.
72.
The concept of multiple inheritance is implemented in Java by
I.     Extending two or more classes.
II.     Extending one class and implementing one or more interfaces.
III.    Implementing two or more interfaces.

(a)   Only (II)                                           (b) (I) and (II)                       (c) (II) and (III)
(d)   Only (I)                                            (e)  Only (III).
73.
In Java, declaring a class abstract is useful
(a)   To prevent developers from further extending the class
(b)   When it doesn't make sense to have objects of that class
(c)   When default implementations of some methods are not desirable
(d)   To force developers to extend the class not to use its capabilities
(e)   When it makes sense to have objects of that class.
74.
What is the error in the following class definitions?
          Abstract class xy
           { 
              abstract sum (int x, int y) {       }
           }
(a)   Class header is not defined properly.
(b)   Constructor is not defined.
(c)   Method is not defined properly
(d)   Method is defined properly
(e)   No error.
75.
Which of these field declarations are legal within the body of an interface?
(a)   Private final static int answer = 42    (b) public static int answer=42
(c)   final static answer =42                     (d) int answer
(e)   No error.
76.
A package is a collection of
(a)   Classes                                          (b) Interfaces           (c) Editing tools
(d)   Classes and interfaces                    (e) Editing tools and interfaces.
77.
A method within a class is only accessible by classes that are defined within the same package as the class of the method. Which one of the following is used to enforce such restriction?
(a)   Declare the method with the keyword public
(b)   Declare the method with the keyword private
(c)   Declare the method with the keyword protected
(d)   Do not declare the method with any accessibility modifiers
(e)   Declare the method with the keyword public and private.
78.
Basic Java language functions are stored in which of the following java package?
(a)   java.lang           (b) java.io                (c) java.net              (d) java.util              (e) java.awt.
79.
Which of the following is a member of the java.lang package?
(a)   List                   (b) Queue                (c) Math                  (d) Stack                 (e) Process.
80.
Which of the following has a method names flush( )?
(a)   Input stream                                    (b) Output Stream
(c)   Reader stream                                 (d) Input reader stream
(e)   Input output stream.




Answers



71.
Answer : (c)
Reason : As the remaining all contradict the functionality of JVM.
72.
Answer : (c)
Reason : The remaning are not opt solutions for the concept of multiple inheritance.
73.
Answer : (b)
Reason : As other Choices are contradicting the meaning of Abstract Class .
74.
Answer : (c)
Reason : method is not defined properly.
75.
Answer : (b)
Reason : The remaining are all illegal.
76.
Answer : (d)
Reason : Editing tools are not the part of packages.So d is the correct Answer.
77.
Answer : (d)
Reason : The desired accessibility is package accessibility, which is the default accessibility for members that have no accessibility modifier. Package is not an accessibility modifier.
78.
Answer : (a)
Reason : The basic language functions are stored in a package inside of the java package called java.lang.
79.
Answer : (b)
Reason : Math is  a member of the java.lang package whereas the remaining are not.
80.
Answer : (b)
Reason : Output stream has the method flush ( ) that flushes the output stream.



<< 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 >>


32 comments :

  1. Q.79, Answer : (b)
    Reason : Math is a member of the java.lang package whereas the remaining are not.
    But in the question. The "Math" is "c", so why the answer is "b" then?

    ReplyDelete
  2. This Java information explains about from framework.We posted this concept for Java implementation framework developing code.I will really inspire this java framework information tools.Thank you so much.
    Java Training in Chennai
    Best Java Training Institute in Chennai

    ReplyDelete
  3. Informative blog and it was up to the point describing the information very effectively. Thanks to blog author for wonderful and informative post... java training in Chennai|| j2ee training in Chennai

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. I’m glad that you shared this helpful info with us. Please keep us informed like be mini projects in chennai . Thank you for sharing.

    ReplyDelete
  7. Great articles , i just wish to bookmark your site . Let me refer this to our students who are doing the wpf training in chennai | wcf training in chennai. Thanks for the Great information's .

    ReplyDelete
  8. Nice Post.
    Thanks for sharing useful information.you can learn best Robotics training in chennai | Silver light training in chennai.

    ReplyDelete
  9. Great one,You have done a great job by sharing this content,Thank you a lot for providing this is very helpful and informative blog!!!
    web design training in chennai | web development training in chennai

    ReplyDelete
  10. Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
    industrial course in chennai

    ReplyDelete
  11. Nice post. Thanks for sharing! I want people to know just how good this information is in your article. It’s interesting content and Great work.


    Thanks & Regards,
    VRIT Professionals,
    No.1 Leading Web Designing Training Institute In Chennai.

    ReplyDelete
  12. Nice Post.Thanks for sharing this post.
    I would like to share my blog in this blog.
    Selenium Testing Training in Chennai

    ReplyDelete
  13. And indeed, Iam just always astounded concerning the remarkable things served by you. Some four facts on this page are undeniably the most effective I have had.
    Matlab Training | matlab courses in chennai |
    matlab training in chennai | best matlab training institute in chennai | matlab coaching centres in chennai

    ReplyDelete
  14. Good post....Thanks for sharing useful information...
    Angular JS Training in Hyderabad

    ReplyDelete