Java Aptitude MCQ Questions with Answers for Freshers

16. Which of these classes are not part of Java’s collection framework?
  • A) HashMap
  • B) HashSet
  • C) TreeMap
  • D) Hashtable

Answer: D) Hashtable

17. Which of the following is not a valid keyword in Java?
  • A) static
  • B) volatile
  • C) interface
  • D) overload

Answer: D) overload

18. In which of the following scenarios would you use the transient keyword in Java?
  • A) To prevent serialization of a field
  • B) To prevent a method from being overridden
  • C) To create a constant variable
  • D) To define a global variable

Answer: A) To prevent serialization of a field

19. Which of the following exceptions is a checked exception in Java?
  • A) NullPointerException
  • B) ArrayIndexOutOfBoundsException
  • C) FileNotFoundException
  • D) ArithmeticException

Answer: C) FileNotFoundException

20. Which of the following methods belongs to the Thread class?
  • A) sleep()
  • B) notify()
  • C) wait()
  • D) exit()

Answer: A) sleep()

21. Which of the following is the correct way to declare a constant in Java?
  • A) final int MAX_VALUE = 100;
  • B) const int MAX_VALUE = 100;
  • C) static int MAX_VALUE = 100;
  • D) constant int MAX_VALUE = 100;

Answer: A) final int MAX_VALUE = 100;

22. Which method is used to terminate a thread in Java?
  • A) terminate()
  • B) stop()
  • C) abort()
  • D) exit()

Answer: B) stop()

23. What is the default value of a boolean variable in Java?
  • A) true
  • B) false
  • C) 1
  • D) null

Answer: B) false

24. Which keyword is used to refer to the current object in Java?
  • A) self
  • B) this
  • C) super
  • D) object

Answer: B) this

25. Which of these classes can be used for reading input from a user in Java?
  • A) Scanner
  • B) FileReader
  • C) BufferedReader
  • D) InputStream

Answer: A) Scanner

2 thoughts on “Java Aptitude MCQ Questions with Answers for Freshers”

Leave a Comment