Java Intermediate Quiz
Explore collections, exception handling, generics, and design patterns
Start the quizSample questions from this quiz
A preview of the style and depth. Try each one, then reveal the answer — or skip straight to the timed quiz.
1. Which collection interface does not allow duplicate elements?
- List
- Set
- Queue
- Map
Show answer
Answer: Set. Set interface does not allow duplicate elements. HashSet, LinkedHashSet, and TreeSet implement Set.
2. What is the difference between ArrayList and LinkedList?
- ArrayList uses array, LinkedList uses nodes
- LinkedList cannot store primitives
- ArrayList is thread-safe
- ArrayList is faster for all operations
Show answer
Answer: ArrayList uses array, LinkedList uses nodes. ArrayList is backed by an array (fast random access), while LinkedList uses doubly-linked nodes (fast insertion/deletion).
3. Which keyword is used to handle multiple catch blocks based on exception type?
- catch-multiple
- multi-catch
- catch-all
- | (pipe)
Show answer
Answer: | (pipe). Java 7 introduced multi-catch using the pipe (|) operator: catch (IOException | SQLException e)
Frequently asked questions
How many questions are in this Java quiz?+
30 questions, with a 60-minute time limit. Every question includes a written explanation of the correct answer.
Is this Java quiz free?+
Yes. Every quiz on CodexQuizz is free and needs no account. You only enter a name if you choose to post your score to the leaderboard.
What level is the intermediate quiz aimed at?+
Explore collections, exception handling, generics, and design patterns
Can I use this to prepare for a Java interview?+
Yes. The questions cover the topics that come up in Java technical screens, and the explanations are written so that a wrong answer still teaches you the underlying concept.
Ready to test your Java?
30 questions, 60 minutes. Free, no sign-up.
Start now