Strings — Chapter Test

Answer all 5 questions, then submit. You need 60% to pass. Log in to save progress.

Question 1
For word = "Python", what is word[-1]?
A'P'
B'n'
C'o'
DError
Question 2
What does the slice "Programming"[0:4] return?
A'Prog'
B'Progr'
C'rogr'
D'Program'
Question 3
Why does word[0] = 'J' cause an error?
Aword is not defined
BStrings are immutable — characters can't be changed in place
CYou must use word.set()
D0 is not a valid index
Question 4
Which method splits "a,b,c" into the list ['a', 'b', 'c']?
Ajoin(',')
Bsplit(',')
Creplace(',')
Dfind(',')
Question 5
What does "ab" * 3 produce?
A'ab3'
B'ababab'
C'ab ab ab'
DError