Home
About
Services
Portfolio
Quiz
Charts
Contact
Quiz on string slicing
Question 1: What is the result of string[2:6] for string = "Aftermath" in Python?
Aft
ftem
fter
term
Question 2: Which of the following is the correct way to slice the string "Aftermath" to get "ret"?
string[5:1:-1]
string[4:1:-1]
string[5:1:-2]
string[4:1:-2]
Question 3: What does string[::-1] do for string = "Aftermath" in Python?
Returns the original string
Reverses the string
Returns the string in uppercase
Returns the string in lowercase
Question 4: What is the result of string[::2] for string = "Aftermath" in Python?
Atrah
Afemh
Atfth
Ahm
Question 5: How do you slice the string "Aftermath" to get "After"?
string[1:6]
string[0:5]
string[0:6]
string[1:5]
Question 6: What is the result of string[3:] for string = "Aftermath" in Python?
ermat
thermath
ermath
After
Question 7: What is the result of string[-3:-1] for string = "Aftermath" in Python?
ma
at
he
te
Question 8: What is the result of string[-1::-1] for string = "Aftermath" in Python?
htamretfA
htamretf
tamretf
tamretfA
Question 9: What is the result of string[6:1:-2] for string = "Aftermath" in Python?
mef
tme
mht
art
Question 10: How do you slice the string "Aftermath" to get "mat"?
string[3:6]
string[4:7]
string[5:8]
string[3:6]
Submit