Title: Competency 9 Practice Quiz
Course: Programming Fundamentals I > Section: Practice Quizzes

Q: Appending one string to the end of another string is known as ______________
A: concatenation

Q: Assume the variable named letter references a string. Write a for loop that prints each character in the string.
Feedback: for letter in name: print(letter)

Q: What is the index of the first character in a string?
Feedback: 0

Q: If a string has 10 characters, what is the index of the last character?
Feedback: 9

Q: What does the built-in len function do?
Feedback: Finds the length of a string

Q: What will the following code display?

mystring = ' abcdefg‘

print(mystring[2:5])
Feedback: c d e

Q: What will the following code display?

mystring = ' abcdefg‘

print(mystring[3:])
Feedback: d e f g

Q: What is the output of the following code?

ch = ‘a‘

ch2 = ch.upper( )

print(ch, ch2)
Feedback: a A

Q: Assume the following statement appears in a program:

days = ‘Monday Tuesday Wednesday’

Write a statement that splits the string, creating the following list:

[‘Monday’, ‘Tuesday’, ‘ Wednesday’]
Feedback: my_list = days.split( )

Q: Assume the following statement appears in a program:

values = ‘ one$two$three$four’

Write a statement that splits the string, creating the following list:

[‘one’, ‘two’, ‘three’, ‘ four’]
Feedback: my_list = values.split(‘$’