Java MCQ ā 100 Multiple Choice Questions
A complete set of 100 Java MCQ with correct answers and detailed explanations for Fresher, Mid-Level, and Senior developers ā covering Java basics, OOP, Strings, Arrays, Collections, Exception Handling, Java 8+ features, Multithreading, and JVM internals.
Last Updated
March 2026
Questions
100 MCQ
Level
Fresher + Mid + Senior
How to Use This MCQ Guide
This guide contains 100 Java MCQ questions with detailed explanations organized by topic and difficulty. Each question is designed to test not just recall but real conceptual understanding ā exactly what is tested in placement exams, coding rounds, and technical interviews.
Strategy: Attempt the answer before reading the explanation. Active recall doubles retention compared to passive reading. Time yourself ā aim for under 45 seconds per question in a real exam.
Java Basics MCQ (Q1āQ20)
These 20 questions test core Java fundamentals ā data types, operators, keywords, control flow, and basic syntax. These appear in all campus placement tests, online assessments, and fresher-level technical rounds.
Q1. Which of the following is NOT a primitive data type in Java?
Must KnowQ2. What is the output of: System.out.println(10 + 20 + "Java");
Must KnowQ3. What is the default value of a boolean instance variable in Java?
Must KnowQ4. Which keyword is used to prevent a class from being subclassed in Java?
Must KnowQ5. What is the size of an int in Java regardless of the platform?
Must KnowQ6. Which of the following correctly declares a multi-dimensional array in Java?
Frequently AskedQ7. What is the output of: System.out.println(5 / 2);
Must KnowQ8. Which of the following is used to find the length of an array named 'arr' in Java?
Must KnowQ9. What does the 'static' keyword mean when applied to a method?
Must KnowQ10. What is the output of: int x = 5; System.out.println(x++);
Must KnowQ11. Which access modifier makes a member accessible only within the same class?
Must KnowQ12. What is the output of: System.out.println(2 + 3 * 4);
Frequently AskedQ13. Which of the following is a valid way to create an object of class 'Car' in Java?
Must KnowQ14. What is the purpose of the 'this' keyword in Java?
Must KnowQ15. Which loop in Java is guaranteed to execute its body at least once?
Must KnowQ16. What is the result of: System.out.println("Java".charAt(2));
Frequently AskedQ17. Which of the following is NOT a Java keyword?
Frequently AskedQ18. What happens when you try to divide an integer by zero in Java?
Must KnowQ19. Which keyword is used to jump to the next iteration of a loop in Java?
Must KnowQ20. What is the output of: System.out.println(true && false || true);
Must KnowOOP Concepts MCQ (Q21āQ35)
OOP is the most heavily tested topic in Java interviews at all levels. These 15 questions cover the four pillars, inheritance, polymorphism, interfaces, and encapsulation.
Q21. Which OOP concept allows one class to inherit the properties of another?
Must KnowQ22. What is the output when a child class overrides a parent method and calls super.method()?
Must KnowQ23. Which of the following cannot be overridden in Java?
Must KnowQ24. What is method overloading?
Must KnowQ25. What is an abstract class in Java?
Must KnowQ26. Which interface method modifier was introduced in Java 8 to provide a default implementation?
Must KnowQ27. What is the correct way to implement an interface in Java?
Must KnowQ28. What is encapsulation in Java?
Must KnowQ29. Can a constructor be declared as static in Java?
Frequently AskedQ30. What is the output? class A { void show() { System.out.print('A'); } } class B extends A { void show() { System.out.print('B'); } } A obj = new B(); obj.show();
Must KnowQ31. Which of the following statements about interfaces in Java is TRUE?
Must KnowQ32. What does the 'super' keyword refer to in Java?
Must KnowQ33. What is the difference between IS-A and HAS-A relationships in Java?
Frequently AskedQ34. In Java, which of the following access modifiers provides the broadest visibility?
Must KnowQ35. What is a marker interface in Java?
Frequently AskedStrings & Arrays MCQ (Q36āQ48)
String and array questions are among the most common in placement tests. These 13 questions test immutability, string pool, key methods, and array operations.
Q36. Which of the following correctly compares two String values in Java?
Must KnowQ37. What is the output of: String s1 = "Java"; String s2 = "Java"; System.out.println(s1 == s2);
Must KnowQ38. Which class should you use for efficient string concatenation in a loop?
Must KnowQ39. What does String.substring(2, 5) return for the string "JavaProgramming"?
Frequently AskedQ40. What is the output of: System.out.println("Hello".replace('l', 'r'));
Frequently AskedQ41. Which method splits a String "a,b,c" into an array ["a","b","c"]?
Frequently AskedQ42. What is the output of: System.out.println(" Java ".trim());
Must KnowQ43. What does Arrays.sort(arr) use internally for primitive arrays in Java?
Frequently AskedQ44. What is the output of: int[] arr = {1,2,3}; System.out.println(arr);
Must KnowQ45. What is the output of: String s = "Java"; s.concat(" World"); System.out.println(s);
Must KnowQ46. How do you copy an array in Java to create an independent duplicate?
Frequently AskedQ47. What will String.valueOf(null) return in Java?
Frequently AskedQ48. What is the time complexity of searching an element in an unsorted array?
Frequently AskedCollections Framework MCQ (Q49āQ63)
Collections are asked in virtually every Java interview. These 15 questions cover List, Map, Set, Queue internals, thread safety, and iteration patterns.
Q49. Which Collection allows duplicate elements and maintains insertion order?
Must KnowQ50. What does HashMap.get(key) return when the key does not exist?
Must KnowQ51. Which Map implementation maintains keys in sorted order?
Must KnowQ52. What happens when you try to add a duplicate element to a HashSet?
Must KnowQ53. Which interface does LinkedList implement that ArrayList does NOT?
Must KnowQ54. What is the default initial capacity of ArrayList in Java?
Frequently AskedQ55. Which of the following is thread-safe?
Must KnowQ56. What does the PriorityQueue in Java use to determine element ordering?
Frequently AskedQ57. Which method would you use to iterate over a Map's key-value pairs?
Must KnowQ58. What exception does Collections.unmodifiableList() throw when you try to modify it?
Frequently AskedQ59. Which data structure does HashSet use internally?
Frequently AskedQ60. What is the output? List<String> list = Arrays.asList("A","B","C"); list.add("D");
Must KnowQ61. What is the difference between Iterator.remove() and Collection.remove()?
Must KnowQ62. Which implementation of BlockingQueue should be used for a bounded producer-consumer queue?
Frequently AskedQ63. What is the correct way to sort a List of Strings in reverse alphabetical order in Java 8?
Must KnowException Handling MCQ (Q64āQ73)
Exception handling questions test your understanding of Java's compile-time safety, runtime behavior, and resource management. These 10 questions cover all key concepts.
Q64. Which of the following is a checked exception in Java?
Must KnowQ65. What is the output? try { System.out.print("A"); } finally { System.out.print("B"); } System.out.print("C");
Must KnowQ66. Which keyword is used to manually throw an exception in Java?
Must KnowQ67. In which order are multiple catch blocks evaluated?
Must KnowQ68. What does the finally block execute in the following? try { return 1; } finally { return 2; }
Must KnowQ69. What is try-with-resources in Java?
Must KnowQ70. Which of the following exceptions is thrown when you access an invalid array index?
Frequently AskedQ71. What is the relationship between Exception and Error in Java?
Must KnowQ72. What happens when a checked exception is not handled or declared with throws?
Must KnowQ73. What is multi-catch in Java 7+?
Frequently AskedJava 8+ Features MCQ (Q74āQ84)
Java 8 features are asked in almost every mid-level Java interview. These 11 questions cover Lambda, Streams, Optional, functional interfaces, method references, and Records.
Q74. What is a functional interface in Java?
Must KnowQ75. What is the output? List.of(1,2,3,4,5).stream().filter(n -> n % 2 == 0).map(n -> n * n).collect(Collectors.toList());
Must KnowQ76. Which method of Optional returns the value if present, or throws NoSuchElementException if empty?
Must KnowQ77. What is the difference between map() and flatMap() in Java Streams?
Must KnowQ78. What is the output? Optional.of("Java").map(String::toUpperCase).orElse("Empty");
Frequently AskedQ79. Which collector is used to group Stream elements by a key in Java 8?
Must KnowQ80. What does 'effectively final' mean in the context of lambda expressions?
Must KnowQ81. What is a Record in Java 16+?
Must KnowQ82. What is the output of: Stream.of(1,2,3).reduce(0, (a,b) -> a + b);
Frequently AskedQ83. Which statement about method references is TRUE?
Must KnowQ84. What is Collectors.joining() used for in Java Streams?
Frequently AskedMultithreading MCQ (Q85āQ93)
Multithreading questions separate mid-level from senior candidates. These 9 questions cover thread lifecycle, synchronization, volatile, deadlock, and modern concurrency.
Q85. Which method is used to start a thread in Java?
Must KnowQ86. What is the difference between synchronized method and synchronized block?
Must KnowQ87. What does volatile guarantee in Java?
Must KnowQ88. Which class provides atomic operations on integers without using synchronized?
Must KnowQ89. What is a deadlock in Java?
Must KnowQ90. What is the purpose of the wait() and notify() methods?
Must KnowQ91. Which of the following is TRUE about ConcurrentHashMap?
Must KnowQ92. What is ThreadLocal in Java?
Frequently AskedQ93. What are Virtual Threads in Java 21?
Must KnowJVM & Advanced Java MCQ (Q94āQ100)
These 7 questions cover JVM internals, Garbage Collection, ClassLoader, JIT, and modern Java features ā expected from senior candidates.
Q94. Where are Java objects stored in memory?
Must KnowQ95. What does the Garbage Collector do in Java?
Must KnowQ96. What is the difference between PermGen and Metaspace?
Must KnowQ97. Which ClassLoader loads the core Java classes (java.lang, java.util)?
Frequently AskedQ98. What is the JIT compiler in Java?
Frequently AskedQ99. What is a sealed class in Java 17?
Must KnowQ100. What is the output of: var list = new ArrayList<>(); list.add("Java"); list.add(21); System.out.println(list);
Must KnowScore Interpretation Guide
Use this guide to evaluate your MCQ performance and plan your next steps accordingly.
- ā¶
š Track your weak sections ā Note which sections had the most mistakes. Collections and Multithreading are the most commonly weak areas for mid-level candidates.
- ā¶
š Retake after 3 days ā Spaced repetition is proven to improve retention. Retake the MCQ set after 3 days without looking at answers first.
- ā¶
š Explain answers aloud ā If you can explain WHY an answer is correct to someone else, you truly understand it. This is the most effective preparation technique for technical interviews.
- ā¶
š Pair with Interview Questions ā After each MCQ section, read the corresponding section in the Java Interview Questions guide for deeper explanations and related open-ended Q&A.
Conclusion ā From MCQ Confidence to Interview Success
You have now practiced 100 Java MCQ questions covering every major topic from basic syntax to JVM internals. MCQ practice builds the pattern recognition needed to answer quickly and confidently in timed assessments ā but the real goal is deep understanding, not just memorizing correct options.
- ā¶
ā Next step for Freshers ā Build 3 small Java projects using OOP, Collections, and Exception Handling. Portfolio > certificates.
- ā¶
ā Next step for Mid-level ā Study the Java Interview Questions guide for open-ended answers. Practice explaining concepts verbally.
- ā¶
ā Next step for Senior ā Practice system design (design a URL shortener, a cache, a rate limiter using Java data structures). Study Effective Java by Josh Bloch.
- ā¶
š” Final tip ā The best Java developers don't just know APIs ā they understand the WHY behind every design decision. When you understand WHY HashMap uses power-of-two capacity, WHY Strings are immutable, and WHY volatile doesn't guarantee atomicity, you stop memorizing and start thinking like a Java architect. ā