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

Quiz: Java Concurrency Utilities · Question 7 of 10

You want at most 3 threads to use the database at the same time. Which tool fits?

You want at most 3 threads to use the database at the same time. Which tool fits?

  1. A.CountDownLatch(3)
  2. B.AtomicInteger(3)
  3. C.CopyOnWriteArrayList
  4. D.Semaphore(3)
Answer & explanation

Correct answer: Semaphore(3)

A Semaphore hands out a fixed number of permits; acquire takes one and release returns it.

Can you get the rest right without peeking?

Take the timed Quiz: Java Concurrency Utilities quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →