Java MCQ Set-3

Java MCQ Questions with Answers

Very Important Questions for Diploma Students


1. The process that focuses on only important characteristics is known as:





Answer : B
Explanation : The insulation of data from direct access by the program is called as the data abstraction.Data abstraction also called as data hiding, is the mechanism where by the code and the data it manipulates are wrapped into a single unit.


2. Which statement is true regarding an object: –





Answer : B
Explanation : An object is an instance of class.


3. An object-oriented programming composition relates to





Answer : B
Explanation : Composition is about an object that is made up of other objects, referred as “containment. Composition implies that the life cycles are more strongly linked, that means Whole is responsible for the life time of Part.


4. In object-oriented programming a new classes can be defined by extending existing classes





Answer : D
Explanation : Inheritance is a mechanism that enables one class to inherit all of the behaviour (methods ) and attributes (instance variables) of another class.


5. Give a class name Book, which one of these is a valid constructor declaration for the class:





Answer : D
Explanation : A constructor cannot specify any return type, not even void. A constructor cannot be final, static or abstract.


Java MCQ

6. The wrapping of data and functions into a sigh unit is called





Answer : A


7. Polymorphism is a characteristic of:





Answer : A
Explanation : Java is object-oriented programming and Polymorphism is a features fo OOPs.


8. The numerical range of a char data type in Java:





Answer : A


9. Which of the following events will cause a thread to die? i.e. called





Answer : D
Explanation : A thread dies when the execution of the run( ) method ends.


10. Which of the following method is true regarding finalize ()





Answer : B


Java MCQ

11. Which of the following is valid method for declaration in Java:





Answer : D
Explanation : Methods must specify a return type or are declared void.


12. The concept of multiple interface implementations in Java by:





Answer : B


13. File class is included in which package.





Answer : B
Explanation : Java File class is a part of java.io package.


14. What is the sequence of major events in the life cycle of an applet:





Answer : A
Explanation : Applet life cycle has 5 methods init(), start(), stop(), aint() and destroy().


15. Threading provides execution of:





Answer : C
Explanation : The process of executing multiple threads simultaneously is known as multithreading.


Java MCQ

16. Which of these operators is used to allocate memory to array variable in Java?





Answer : C
Explanation : Operator new allocates a block of memory specified by the size of an array.


17. Which one of the following class definition is a valid definition that can not be extended.





Answer : A
Explanation : A class can be extended unless it is declared final.


18. Which statement is true about accessibility of members:





Answer : B
Explanation : A private member is accessible only to the class in which it is defined.


19. The default value of a static integer variable of a class in Java is





Answer : A
Explanation : The default value of a static integer variable of a class in Java is 0.


20. The field in an Interface are implicitly specified as





Answer : D
Explanation : Fields in an interface are by default, static and final.





Related Links

Leave a Comment

Your email address will not be published.