python Strings

python Strings

Assessment

Interactive Video

Science

University

Hard

Created by

Laghane Parmeswar

FREE Resource

6 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does it mean for Python strings to be immutable?

Their length cannot be changed.

Their characters cannot be changed after creation.

They can only store numbers.

They can be modified in place.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens if you try to change a specific character in an existing Python string using indexing (e.g., str1[0] = 'B')?

The character is successfully updated.

A new string is automatically created with the change.

Python will raise an error.

The string becomes mutable.

3.

MULTIPLE CHOICE QUESTION

30 sec • Ungraded

Are you enjoying the video lesson?

Yes

No

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

If you want to modify a Python string (e.g., change its first character), what is the correct approach?

Directly assign a new character to the desired index.

Use a built-in modify() method.

Create an entirely new string with the desired changes.

Convert the string to a list, modify it, then convert it back to a string.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you effectively 'change' a string in Python by creating a new one, as demonstrated?

str1 = 'B' + str1[0]

str1 = str1[1:] + 'B'

str1 = 'B' + str1[1:]

str1[0] = 'B'

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens to the identity (ID number) of a Python string when you 'modify' it by creating a new string and assigning it to the same variable name?

The ID number remains the same, as the original string is updated.

A new ID number is assigned to the variable, indicating a new string object.

The ID number changes only if the length of the string changes.

Python does not track ID numbers for strings.