🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Strings Quiz: questions with answers

8 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. Why is s = s + ch inside a loop slow in Java and Python?
  2. Q2. In Java, how should you compare the contents of two strings a and b?
  3. Q3. What does this print? (code)
  4. Q4. What does this print? (code)
  5. Q5. How many centers does "expand around center" check for a string of length n?
  6. Q6. What is the longest palindromic substring of "babad"? (either correct answer is accepted)
  7. Q7. Which techniques are commonly used for string problems? (select all that apply)
  8. Q8. What is the longest common prefix of ["flower", "flow", "flight"]?