🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Validation and Errors: all 10 questions

Quiz: Validation and Errors · Question 8 of 10

Why did the Course API store field errors in a TreeMap?

Why did the Course API store field errors in a TreeMap?

  1. A.TreeMap is faster than HashMap
  2. B.JSON requires sorted keys
  3. C.To remove duplicate errors
  4. D.So the field errors come out sorted and the output is predictable
Answer & explanation

Correct answer: So the field errors come out sorted and the output is predictable

Predictable output makes responses easy to test and read.

Can you get the rest right without peeking?

Take the timed Quiz: Validation and Errors quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →