NEW
Font size
WorksheetsString and List
Total questions: 14
Worksheet time: 7mins
Which of the operator can be used in Strings?
+
*
Both of the above
None of the above
word = "amazing"
For the given string if we run word[2:5] what does it mean?
It will extract alphabets from index 2 to index 4
It will extract alphabets from index 2 to index 5
It will extract alphabets from position 2 to position 4
It will extract alphabets from position 2 to position 5
Which method is used to convert a given string in Capital letters?
Capital
Upper
ConverttoUpper
Capitalize
s1="Hello"
s2="10"
print(s1+n1)
What is the error in this code?
String 2 written in quotes
String cannot be multiplied with a string
colon not written after print statement
Number written in quotes
Which method is used to add a value at a specified position in the list?
append
extend
insert
pop
Which of these is the correct code for creating a list of names?
nameList = John, Harry, Jesse, John, Harry, Harry
nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList = [John, Harry, Jesse, John, Harry, Harry]
List items have an index number. In the following list, which item has the index number of 3?
["John", "Harry", "Jesse", "John", "Harry", "Harry"]
"John"
"Harry"
"Jesse"
"John"
Which of these pieces of code would return the name "Harry" from the following list?
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList()
nameList[1]
NameList(4)
nameList["4"]
To insert an the string "strawberries" in the first position of a list we use
fruit.append("strawberries, 1")
fruit.insert("strawberries",0)
fruit.insert(1, "strawberries")
fruit.insert(0, "strawberries")
variable.sort() will do what?
Sort the list into alphabetical order
Sort the list into reverse order
Create a new list
Error
nameList = ["John", "Harry", "Jesse", "John", "Marry", "Larry"]
del nameList[3]
print(nameList)
What would be the output
['John', 'Harry', 'Jesse', 'Marry', 'Larry']
['John', 'Harry', 'Jesse', 'John', 'Larry']
['John', 'Harry', 'John', 'Marry', 'Larry']
Error
