Search Your Question...!

JAVA MCQ's

1. how will a class protect  the code inside it? 

   View Answer   

   Using Access specifiers



2. the set interface model the ____ set abstractionand is used to represent sets,such as the deck of cards.

   View Answer   

   Duplicate (doubted)



3. inheritance represent the  ___ relationship,also known as parent-child relationship.

   View Answer   

   IS-A



4. What is ‘Basis of Encapsulation’?

   View Answer   

   all of the mentioned



5. which of these is an correct way of defining generic class?

   View Answer   

   class name{/*....*/}



6. Which of these events will be notified if scroll bar is manipulated?

   View Answer   

   AdjustmentEvent



7. which of these class is not a member class of java.io package?

   View Answer   

   string



8. Which of these methods deletes all the elements from invoking collection?

   View Answer   

   clear()



9.  Which of these is method is used for writing bytes to an outputstream?

   View Answer   

   write() print()



10. .the conditional operator has it has three operands -- and it comes in two pieces, ? and :, that have to be used together.

   View Answer   

   It takes the form



11. is the super class of all unchecked exceptions? 

   View Answer   

   exception



12. What is Collection in Java?

   View Answer   

   A group of objects



13. inheritance is used for getting the properties from one class object to another class object level wise with different priorities

   View Answer   

   Multilevel



14. Which of these methods can be used to determine the type of event?

   View Answer   

   getID()



15. Which of these methods are used to register a keyboard event listener?

   View Answer   

   addKeyListener()



16. .Which of these is correct way of calling a constructor having no parameters, of superclass A by subclass B?

   View Answer   

    super();



17. Which of these access specifiers can be used for an interface? 

   View Answer   

   public



18. list access any element from its

   View Answer   

   Index



19. what is the most important feature of java

   View Answer   

   oop



20. the concept of overloading contains the same name with?

   View Answer   

   static parameter



21. ______is a java way to convey both system and programming errors 

   View Answer   

   Exception



22. Which of the following reference types cannot be generic?

   View Answer   

   Anonymous inner class



23. Which of these type parameters is used for a generic class to return and accept any type of object?

   View Answer   

   True



24. java doesn't support ____inheritence  

   View Answer   

   Multiple



25. if a class defined by the code does not have any constructor ____ will automatically provide one no-parameter-constructor

   View Answer   

   compiler



26. what is true about a method local inner class 

   View Answer   

   Must Mark as abstract



27. Which of these keywords can be used to prevent Method overriding?

   View Answer   

   final



28. java source code is complied into 

   View Answer   

   byte code



29. The File class contains a method that changes the current working directory. 

   View Answer   

   False



30. Which of these keywords is used by a class to use an interface defined previously?

   View Answer   

   implements



31. runnable interface is used in java for implementing applications

   View Answer   

   single threads



32. the keyword says to the jvm warning this variable may be modified in another

   View Answer   

   thread volatile



33. Which of these events will be generated if we close an applet’s window?

   View Answer   

   window event



34. Which of these classes is not part of Java’s collection framework?

   View Answer   

   map



35. Which of these packages contain all the collection classes?

   View Answer   

   util



36. Which of these class relies upon its subclasses for complete implementation of its methods?

   View Answer   

   abstract class



37. main method doesn't return anything and hence they declared as 

   View Answer   

   void



38. ava uses data types and hence is not a pure oop

   View Answer   

   Primitive



39. the ordering maintained by a set must be with equals if it is to correctly implement the self interface

   View Answer   

   tree set



40. set is a collection that cannot contain which elements

   View Answer   

   list



41. Event class is defined in which of these libraries? 

   View Answer   

   java.util



42. jvm is an abstract machine it is a specification that provides runtime environment in which java

   View Answer   

   byte



43.  the conditional operator are called as

   View Answer   

   ternanry



44. list access any element from its

   View Answer   

   get



45. java allows you to control access to classes methods and fields via

   View Answer   

   access



46. which of these keywords is used to refer to member of base class from a sub class?

   View Answer   

   super



47. A class member declared protected becomes member of superclass of which type ?

   View Answer   

   private



48. which of these keyword can be used in subclass to callthe constructor of superclass?

   View Answer   

   super



49. the modifier keyword makes that the programmer cannot change the value anymore ?

   View Answer   

   final



50. jar stand for

   View Answer   

    java archive



51. which of these is the functionality of encapsulation?

   View Answer   

   Binds together code and data



52. which of these are selection statement in java?

   View Answer   

   if()



53. which of these operators is used to allocate memory for an object?

   View Answer   

   new



54. which of the following tool used to execute java code ?

   View Answer   

   java



55.  the wrapping up of data and functions into a single unit is called 

   View Answer   

   encapsulation



56. in java the inheritance can not extend more than one classes , this can be done by using ?

   View Answer   

   interface



57.  jvm jre and jdk are because configurationof each os differs?

   View Answer   

   platform dependent



58. which statement is true regarding an object? 

   View Answer   

   An object is an instance of a class



59. correct way of inheriting class A by class b? 

   View Answer   

   class b extends A{}



60. literally means taking more then one from. ? 

   View Answer   

   polymorphism



61. runtime polymorphism is also knowm as

   View Answer   

   method overriding



62. which of the following is not a keyword in java?

   View Answer   

   enum



63. is a collection of related class and interfaces?

   View Answer   

   package



64. what is the base class of all class in java?

   View Answer   

   java.lang.object



65. Which of the following concept is often expressed by the phrase, ‘One interface, multiple methods’?

   View Answer   

   polymorphism



66. whenever you write java cammand on the cammand prompt to run the _____?

   View Answer   

    java class 



No comments:

Post a Comment