Exam 8: More About Strings
Exam 1: Introduction to Computers and Programming39 Questions
Exam 2: Input, Processing, and Output40 Questions
Exam 3: Decision Structures and Boolean Logic40 Questions
Exam 4: Repetition Structures41 Questions
Exam 5: Functions66 Questions
Exam 6: Files and Exceptions40 Questions
Exam 7: Lists and Tuples40 Questions
Exam 8: More About Strings37 Questions
Exam 9: Dictionaries and Sets39 Questions
Exam 10: Classes and Object-Oriented Programming38 Questions
Exam 11: Inheritance36 Questions
Exam 12: Recursion35 Questions
Exam 13: Gui Programming42 Questions
Select questions type
The strip()method returns a copy of the string with all the leading whitespace characters removed but does not remove trailing whitespace characters.
Free
(True/False)
4.7/5
(80)
Correct Answer:
False
The __________ method returns a copy of the string with all the alphabetic letters converted to lower case.
Free
(Short Answer)
4.9/5
(81)
Correct Answer:
lower()
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
(78)
Correct Answer:
False
The __________ method returns True if the string contains only numeric digits.
(Short Answer)
4.8/5
(69)
What will be displayed after the following code executes?
Mystr = 'yes'
Yourstr = 'no'
Mystr += yourstr * 2
Print(mystr)
(Multiple Choice)
5.0/5
(69)
What will be the value of the variable string after the following code executes?
String = 'abcd'
String.upper()
(Multiple Choice)
4.8/5
(75)
A(n)__________ exception will occur if you try to use an index that is out of range for a particular string.
(Short Answer)
4.8/5
(84)
The isalpha()method returns __________ if the string contains only alphabetic characters and is at least one character in length.
(True/False)
5.0/5
(89)
The third number in string slicing brackets represents the ___________ value.
(Short Answer)
4.9/5
(85)
What will display after the following code executes?
Password = 'ILOVEPYTHON'
If password.isalpha():
Print('Invalid,must contain one number.')
Elif password.isdigit():
Print('Invalid,must have one non-numeric character.')
Elif password.isupper():
Print('Invalid,cannot be all uppercase characters.')
Else:
Print('Your password is secure!')
(Multiple Choice)
4.7/5
(72)
What will be assigned to the variable s_string after the following code executes?
Special = '1357 Country Ln.'
S_string = special[-3:]
(Multiple Choice)
4.8/5
(70)
What will be assigned to the variable s_string after the following code executes?
Special = '1357 Country Ln.'
S_string = special[ :4]
(Multiple Choice)
4.8/5
(80)
Each character in a string has a(n)__________ which specifies its position in the string.
(Short Answer)
4.7/5
(69)
What will be assigned to the string variable pattern after the following code executes?
I = 3
Pattern = 'z' * (5 * i)
(Multiple Choice)
4.9/5
(71)
What will be the value of the variable string after the following code executes?
String = 'Hello'
String += ' world!'
(Multiple Choice)
4.9/5
(82)
When accessing each character in a string,such as for copying purposes,you would typically use a while loop.
(True/False)
4.8/5
(73)
The __________ method returns the list of the words in a string.
(Short Answer)
4.9/5
(89)
Showing 1 - 20 of 37
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)