WorksheetsQuiz 8
Total questions: 11
Worksheet time: 6mins
What will be printed when the following executes?
str = "His shirt is red"
pos = str.find("is")
print(pos)
1
9
2
10
What will be printed when the following executes?
str = "This is fun"
str = str[5]
print(str)
i
is fun
is
none of these
What would the following code print?
flm= 5
print("Front" + " Line " + str(flm))
Front Line flm
Front Line 5
5 Front Line
None
What is printed by the following statements?
s = "python rocks"
print(s[3])
t
h
c
Error
s = "Front Line Media"
print(s[6] + s[-5])
LM
ML
tL
Lt
s = "Front Line Media"
print(len(s))
15
13
16
None
What is printed by the following statements:
s = "Rose"
s[1] = "i"
print(s)
Rose
Rise
iose
TypeError
True or false: the string is immutable type in python
True
False
Negative index -1 belongs to _____ of string
first character
last character
second last character
second character
Which of the following functions will return the total number of characters in a string?
count ()
index ()
len()
all of these
Which of the following functions will return the string in all caps ?
upper ()
toupper()
isupper()
to-upper()
