Last reviewed
Correct answer: D. Strings are commonly implemented internally as arrays of characters
Explanation
A string is stored as a run of character units laid out one after another and addressed by position, which is the shape of an array. NIST's dictionary defines a string as a list of characters usually implemented as an array, and Python states the same thing in its own vocabulary: strings are immutable sequences of Unicode code points. Once that registers, the transfer is free. Indexing, slicing, reversal, sliding windows and two-pointer sweeps all carry over unchanged.
The payoff shows up the moment a real problem lands. Palindrome checks, anagram grouping and longest-substring questions are the same index arithmetic you would write over an integer array. One difference is worth holding onto: strings are immutable in Python and Java, so an in-place array trick becomes a copy into a list or a builder first.
Each wrong answer plants something false. Strings routinely hold many characters, so B is simply untrue. C denies a relationship every standard library exposes; MDN describes bracket access on a JavaScript string as treating it as an array-like object. D claims arrays cannot hold character data, which is exactly what a char array is.
Sources
“A list of characters, usually implemented as an array”
“Strings are immutable sequences of Unicode code points.”
“treat the string as an array-like object, where individual characters correspond to a numerical index”
Practise 3 questions on this topic
Take Arrays & Strings — Timed Test (3 questions) — scored instantly, explanation for every question, no login.