Exam 8: More About Strings

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

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

Free
(Multiple Choice)
4.9/5
(70)
Correct Answer:
Verified

C

Indexing of a string starts at 1, so the index of the first character is 1, the index of the second character is 2, and so forth.

Free
(True/False)
4.9/5
(73)
Correct Answer:
Verified

False

Which of the following string methods can be used to determine if a string contains only '\n' characters?

Free
(Multiple Choice)
4.8/5
(95)
Correct Answer:
Verified

D

If the + operator is used on strings, it produces a string that is the combination of the two strings used as its operands.

(True/False)
4.7/5
(68)

Which list will be referenced by the variable list_strip after the execution of the following code? List_string = '03/07/2008' List_strip = list_string.split('/')

(Multiple Choice)
4.9/5
(90)

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

(Multiple Choice)
4.9/5
(74)

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.9/5
(81)

Each character in a string has a(n) _______________ which specifies its position in the string.

(Short Answer)
4.8/5
(88)

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.9/5
(84)

Indexing works with both strings and lists.

(True/False)
4.9/5
(70)

Which method would you use to determine whether a substring is the suffix of a string?

(Multiple Choice)
4.9/5
(81)

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.

(True/False)
4.8/5
(88)

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.7/5
(81)

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

(Short Answer)
4.7/5
(75)

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

(Multiple Choice)
4.8/5
(86)

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

(True/False)
4.9/5
(94)

When the operand on the left side of the * symbol is a string and the operand on the right side is an integer, it becomes the _______________ operator.

(Short Answer)
4.8/5
(76)

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

(Short Answer)
4.9/5
(80)

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.8/5
(75)

Strings are _______________, which means that once a string is created, it cannot be changed.

(Short Answer)
4.7/5
(78)
Showing 1 - 20 of 35
close modal

Filters

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