Question Detail

COS 102 Advanced Text Processing Objective Question

Question

What does it mean for strings to be immutable in Python?
Options
A Strings cannot be declared or assigned new values.
B Strings can only contain alphanumeric characters.
C A string cannot be altered once it's created in memory.
Correct Answer
D String methods always modify the original string directly.
Correct Answer

Option C is the correct answer.

Detailed Explanation

The 'Strings are Immutable!' section states: 'Immutable means a string cannot be altered once it's created in memory.' This is a core concept of Python strings.

Hint

Consider the meaning of 'immutable' – something that cannot change.

Question Info