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

Stack & Queue Quiz · Question 2 of 8

Which strings are valid bracket sequences? (select all that apply)

Which strings are valid bracket sequences? (select all that apply)

  1. A.()[]{}
  2. B.{[()]}
  3. C.([)]
  4. D.((
Answer & explanation

Correct answer: ()[]{} · {[()]}

"([)]" closes ( before ], breaking the most-recent-first rule; "((" never closes.

Can you get the rest right without peeking?

Take the timed Stack & Queue Quiz quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →