How to use the Java MCQ Quiz
- 1. Pick the lengthChoose 10 Java questions or all 20, with shuffle on or off.
- 2. Answer each questionTap an option to see at once if it is right, plus a short Java explanation.
- 3. See your scoreFinish to get your Java score and a review of all your answers.
What this quiz covers
This quiz covers core Java, the part every Java interview starts with:
- Language basics: sizes of int and char, default values, integer division and String joining order.
- Strings: immutability, and equals() vs ==.
- OOP keywords: final, static, super, overloading vs overriding.
- Collections: Set vs List, HashMap and null keys, ArrayList vs LinkedList.
- Exceptions: checked vs unchecked, and when finally runs.
- Platform: JDK vs JRE vs JVM, the main method and garbage collection.
Worked example and how to use it
Example: What does System.out.println(1 + 2 + "3") print? Java works left to right. First 1 + 2 = 3 (number addition), then 3 + "3" joins as text, so the output is 33. If you write "1" + 2 + 3 instead, it prints 123, because the very first + is already joining text.
Another classic: two Strings with the same text can be different objects, so a == b may be false even when a.equals(b) is true. Always use equals() to compare text.
The output answers were checked with the javac compiler. Tips for Java interviews:
- Explain why, not just what: for example, why String is immutable (security, caching and thread safety).
- Know one example of each: a checked exception (IOException) and an unchecked one (NullPointerException).
- Follow up with the OOPs quiz, since Java questions often lead into OOP design.
Frequently asked questions
Does it include Java 8+ features?
This set focuses on core Java fundamentals. Streams and lambdas are not covered yet.
How hard is it?
Easy to medium, the level of campus placement tests and first-round interviews.
Are answers explained?
Yes, every question has a short explanation, shown right after you answer.
Is it free?
Yes, free. Only your final score asks for your name and WhatsApp number, once for all Uncodemy tools.