← All topics
Quiz: Java Collections (List and Set): questions with answers
10 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. What does this print? (code)
- Q2. Which collection keeps elements SORTED automatically?
- Q3. What is the time complexity of get(i) on an ArrayList?
- Q4. What does this print? (code)
- Q5. What happens if you remove items from an ArrayList inside a for-each loop over it?
- Q6. What does this print? (code)
- Q7. What does this print? (code)
- Q8. Why write List<String names = new ArrayList<(); instead of ArrayList<String names = ...?
- Q9. What does it cost to insert an element at index 0 of an ArrayList with n elements?
- Q10. What does this print? (code)