Exam 9: More About Strings

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

The _______________ operator can be used to determine whether one string is contained in another string.

Free
(Short Answer)
4.8/5
(36)
Correct Answer:
Verified

in

The _______________ method returns a copy of the string with all alphabetic letters converted to lower case.

Free
(Short Answer)
4.8/5
(32)
Correct Answer:
Verified

lower()

If a whole paragraph is included in a single string, the split() method can be used to obtain a list of the sentences included in the paragraph.

Free
(True/False)
4.8/5
(35)
Correct Answer:
Verified

True

What will be assigned to the string variable even after the execution of the following code? special = '0123456789' Even = special[0:10:2]

(Multiple Choice)
5.0/5
(33)

An expression of the form string[i] = 'i' is a valid expression.

(True/False)
4.7/5
(28)

What will be assigned to s_string after the execution of the following code? special = '1357 Country Ln.' S_string = special[4: ]

(Multiple Choice)
4.8/5
(48)

Which method would you use to determine whether a substring is present in a string?

(Multiple Choice)
4.9/5
(36)

The strip() method returns a copy of the string with all leading whitespace characters removed, but does not remove trailing whitespace characters.

(True/False)
4.8/5
(30)

When accessing each character in a string, such as for copying purposes, you would typically use a while loop.

(True/False)
4.9/5
(43)

The index -1 identifies the last character in a string.

(True/False)
4.7/5
(40)

What is the first negative index in a string?

(Multiple Choice)
4.8/5
(36)

What are the valid indexes for the string 'New York'?

(Multiple Choice)
4.8/5
(39)

What will be assigned to s_string after the execution of the following code? special = '1357 Country Ln.' S_string = special[-3: ]

(Multiple Choice)
4.8/5
(41)

What will be assigned to the string variable pattern after the execution of the following code? i = 3 Pattern = 'z' * (5*i)

(Multiple Choice)
4.9/5
(34)

The third number in string slicing brackets represents the _______________ value.

(Short Answer)
4.8/5
(38)

Invalid indexes do not cause slicing expressions to raise an exception.

(True/False)
4.8/5
(34)

Indexing works with both strings and lists.

(True/False)
4.9/5
(36)

In slicing, if the end index specifies a position beyond the end of the string, Python will use the length of the string instead.

(True/False)
4.7/5
(31)

What will be assigned to s_string after the execution of the following code? special = '1357 Country Ln.' S_string = special[ :4]

(Multiple Choice)
4.8/5
(38)

The _______________ method returns the list of the words in the string.

(Short Answer)
4.8/5
(40)
Showing 1 - 20 of 35
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)