4
QuizMultiple Choice

Global Connections

Question 4 • Introduction to Computer Science B – 4-232

Which statement is true about encoding in Python?

Answer
A
Every string declaration needs to use the encode() function.
B
You cannot use Unicode in Python.
C
The encode() plug-in automatically translates ASCII to Unicode when you activate the global setting.
D
In Python 3, strings are automatically encoded using Unicode.

Explanation

In Python 3, ordinary strings (`str`) contain Unicode text by default, so you do not need to call `encode()` when declaring a string. Encoding is used when converting a string to a particular byte format, such as UTF-8, often for saving or sending data. Thus, the true statement is “In Python 3, strings are automatically encoded using Unicode,” though more precisely, Python 3 strings are Unicode text.

AI-written and checked against the verified answer.