Data Structures & AlgorithmsModerateTCS NQT · Infosys

Problem: A text buffer contains "hello world". Each space is replaced by the three characters "%20" (URL-style encoding). What is the length of the resulting string?

  1. A. 11
  2. B. 13
  3. C. 12
  4. D. 14

Correct answer: B. 13

"hello world" has 11 characters and one space; replacing it with the 3 characters %20 adds 2, giving 13. 11 forgets the replacement, 12 counts %20 as 2 characters, and 14 adds 3 instead of 2.

More Coding Interview Problems questions

Exams that ask this topic