100 Important Java MCQ (MCQs Online Test)

100 Important Java MCQ (MCQs Online Test)

Java MCQ – Java MCQ with Answers -All these are very important Java MCQ (Multiple choice) questions and answers for the students and professionals to get success in any written exam as well as interview exam which want to check the knowledge of Java.

 

Java MCQ set 1

java mcq

 

Q 1. Which of the following is a run time entity?

  1. Program
  2. Object
  3. Both 1 and 2
  4. None of these

Answer 3

 

Q 2. Which of the following is a real time entity?

  1. Class
  2. Object
  3. Method
  4. None

Answer 2 

 

Q 3. Which of the following makes inheritance compulsory?

  1. Final
  2. Abstract
  3. Protected
  4. None

Answer 2

 

Q 4. Combining data and method together is called

  1. Encapsulation
  2. Classification
  3. Data hiding
  4. None

Answer 1

 

Q 5. Which of the following allows fixed length of strings?

  1. Final
  2. String
  3. StringBuffer
  4. None

Answer 2

Q 6. Which of the following group classes and interfaces together in java?

  1. Package
  2. Library
  3. Inheritance
  4. Directories

Answer 1

 

Q 7. Which of the following keyword is used to initialize an object?

  1. new
  2. main
  3. init
  4. None

Answer 1

 

Q 8. Which of the following type of inheritance is not allowed in java?

  1. Multilevel
  2. Multiple
  3. Hierarchical
  4. None

Answer 2

 

Q 9. Which of the following works differently despite of same name?

  1. Method overloading
  2. Method overriding
  3. Dynamic binding
  4. None

Answer 1

 

Q 10. Which of the following modifier is used in inheritance?

  1. Super
  2. Protected
  3. Method overriding
  4. None

Answer 2

 

java mcq

 

Q 1. Which of the following method blocks a thread for a specific time?

  1. sleep()
  2. wait()
  3. suspend()
  4. stop()

Answer 1

 

Q 2. Which of the following prevents inheritance?

  1. Abstract
  2. Public
  3. Final
  4. Protected

Answer 3

 

Q 3. Hiding low level details is called

  1. Abstraction
  2. Polymorphsim
  3. Encapsulation
  4. Data hiding

Answer 1

 

Q 4. Which of the following allows variable length of strings?

  1. String
  2. StringBuffer
  3. Array
  4. None

Answer 2

 

Q 5. Which of the following allows re-usability in java?

  1. Inheritance
  2. Package
  3. Both 1 and 2
  4. None

Answer 3

 

Q 6. Which of the following allows selecting from multiple choices?

  1. Switch
  2. If else
  3. Conditional operator
  4. None

Answer 1

 

Q 7. Which of the following type of inheritance is replaced by interface in java?

  1. Single
  2. Multiple
  3. Multilevel
  4. Hierarchical

Answer 2

 

Q 8. Which of the following works in Inheritance?

  1. Dynamic binding
  2. Method overloading
  3. Method overriding
  4. Data hiding

Answer 3

 

Q 9. Method and data are combined into —–

  1. Classification
  2. Polymorphsim
  3. Encapsulation
  4. None

Answer 1

 

Q 10. Which of the following is not used in inheritance?

  1. Method overriding
  2. Private
  3. Protected
  4. None

Answer 2

Java MCQ set 3

 

java mcq

 

Q 11. Which of the following generate an exceptional?

  1. Try
  2. Catch
  3. Throw
  4. Throws

Answer 1

 

Q 12. Which one of the following package supports system.println?

  1. java.io
  2. java.util
  3. java.lang
  4. None

Answer 1

 

Q 13. Which of the following method blocks a thread until a condition satisfy?

  1. wait()
  2. sleep()
  3. stop()
  4. suspend()

Answer 1

 

Q 14. Which of the following start a thread?

  1. start
  2. new
  3. Thread class
  4. None

Answer 3

 

Q 15. Which of the following catch an exception?

  1. try
  2. catch
  3. throw
  4. finally

Answer 2

 

Q 16. Which of the following is an optional block?

  1. final
  2. finally
  3. finalize
  4. None

Answer 2

 

Q 17. Which of the following de-initialize an object in java?

  1. destructor
  2. finalize
  3. new
  4. flush

Answer 2

 

Q 18. Which of the following kind of error are not handled by exception handling routine?

  1. Syntax
  2. Compile time
  3. Both 1 and 2
  4. None

Answer 3

 

Q 19. Which of the following is a light weight process?

  1. Applet
  2. Thread
  3. Process
  4. Servlet

Answer 2

 

 

Q 20. Which of the following package support Exception handling?

  1. java.io
  2. java.lang
  3. java.util
  4. None

Answer 1

Java MCQ set 4

java mcq

 

Q 21. Which of the following support layout in GUI?

  1. java.gui
  2. java.io
  3. java.lang
  4. java.awt

Answer 4

 

Q 22. Which of the following is used to inherit a class?

  1. import
  2. inherits
  3. extends
  4. None

Answer 3

 

Q 23. Which of the following keyword is used to create a file?

  1. write
  2. read
  3. open
  4. None

Answer 1

 

Q 24. Which of the following method is used to open a file?

  1. read
  2. open
  3. write
  4. None

Answer 2

 

Q 25. Character stream classes are used to read and write —-

  1. 8 bit of data
  2. 16 bit of data
  3. 32 bit of data
  4. None

Answer 2

 

Q 26. Which of the following are unidirectional?

  1. bit stream
  2. byte stream
  3. character stream
  4. None

Answer 2

 

Q 27. Which of the following are supported by Java?

  1. TCP
  2. UDP
  3. Both 1 and 2
  4. None

Answer 3

 

Q 28. All the computers in the internet using TCP/IP communicate through the —-

  1. Port
  2. Socket
  3. IP protocol
  4. None

Answer 2

 

Q 29. Which of the following connection less protocol?

  1. TCP
  2. UDP
  3. IP Protocol
  4. None

Answer 2

 

Q 30. Ports are represented by —- bit numbers.

  1. 16
  2. 32
  3. 8
  4. None

Answer 1

Java MCQ set 5

java mcq

 

Q 31. Which of the following package supports Layouts?

  1. java.net
  2. java.awt
  3. java.graphics
  4. None

Answer 2

 

Q 32. IP address consists of series of four —- bits numbers

  1. 8
  2. 16
  3. 32
  4. None

Answer 1

 

Q 33. Which of the following create a dynamic array in the java applications?

  1. ArrayList
  2. Array
  3. String
  4. None

Answer 1

 

Q 34. Which of the following class in java is used to break a string into tokens?

  1. String
  2. StringBuffer
  3. StringTokenizer
  4. None

Answer 3

 

Q 35. Date class is available in ———-

  1. java.lang
  2. java.util
  3. java.io
  4. java.awt

Answer 2

 

Q 36. Which of the following interface is used to sort the elements of a collection in the ascending order?

  1. Array
  2. List
  3. SortedSet
  4. None

Answer 3

 

Q 37. Which of the following returns the first element from the SortedSet?

  1. top()
  2. first()
  3. one()
  4. None

Answer 2

 

Q 38. Which of the following returns the last element from the SortedSet?          

  1. last()
  2. end()
  3. isLast()
  4. None

Answer 1

 

Q 39. Which of the following interface allows accessing and traversing the elements of the collection in a sequential order.?

  1. Iterator
  2. Array
  3. List
  4. None

Answer 1

 

Q 40. Which of the following removes current element from the collection?

  1. delete()
  2. remove()
  3. erase()
  4. None

Answer 2

Java MCQ set 6

java mcq

 

Q 41. Which of the following package support collections?

  1. java.util
  2. java.lang
  3. java.io
  4. java.awt

Answer 1

 

Q. 42. Which of the following allows storing, access and updating set of objects?

  1. Collection
  2. Array
  3. String
  4. None

Answer 1

 

Q 43. Which of the following returns true if the object is added to the specified collection?

  1. add(object o)
  2. append(object o)
  3. insert(object o)
  4. adds(object o)

Answer 1

 

Q. 44. Which of the following removes all the objects from a given collection?

  1. delete()           
  2. clear()
  3. clears()
  4. None

Answer 2

 

Q. 45. Which of the following returns true if entire objects of a collection are added in the specified collection?

  1. addAll(collection c)
  2. add(collection c)
  3. append(collection c)
  4. None

Answer 1

 

Q. 46. Which of the following return true if the collection contains the specified element?

  1. contains(object o)
  2. contains(object)
  3. contain(object o)
  4. None

Answer 1

 

Q. 46. Which of the following returns true if the collection is empty?

  1. Empty()
  2. isEmpty()
  3. isVacant()
  4. None

Answer 2

 

Q. 47. Which of the following returns the number of objects present in the collection?

  1. length()
  2. len()
  3. size()
  4. None

Answer 3

 

Q. 48. Which of the following returns an array containing all the elements in a collection?

  1. toArray()
  2. allArray()
  3. array()
  4. None

Answer 1

 

Q. 49. Which of the following package support network programming?

  1. java.util
  2. java.net
  3. java.awt
  4. None

Answer 2

 

Q. 50. Resource name is the component of —-

  1. Uniform resource locator
  2. Port
  3. IP Protocol
  4. None

Answer 1

 

Java mcq are selected from question papers of various exams to support the students. These java mcq covers all the important questions of core java.

 

Suggestion for improvement are always welcome. Kindly write in the comment box for your valuable suggestions

Thanks for reading, Welcome to your comments on this Post

This site uses Akismet to reduce spam. Learn how your comment data is processed.