WorksheetsPython String Functions
Total questions: 12
Worksheet time: 9mins
How do we store a string with the value: string
'string'
"string"
%string%
#string#
For strings, the symbol + means........................
addition
swap
concatenation
slicing
What is the output of the following code?
str1='101'
x=int(str1)
z=x+400
print(z)
101400
x400
501
none of above
What is the output of the following code?
fruit1="kiwi"
fruit2="strawberry"
print(len(fruit1))
print(len(fruit2))
kiwi and strawberry
4
10
4 10
410
The index of a string begins with ...
1
0
a
-1
What is the output of the following code?
X="BOnVoyage"
print X[0:5]
BOnVoy
BOnVo
oyage
bonvo
What is the output of the following code?
x="BOnvoyage"
print(x[4: ])
BOnvo
bonvo
voyage
VOYAGE
What is the output of the following code?
s="INDIA".lower()
print(s)
India
india
INDIA
INDIAlower
print("Hello" + str(2) + "world!")
What does the following code do?
myAge = int(myAge)
Converts the var (variable) myAge to a string
Converts the var (variable) myAge to a integer
Converts the var (variable) myAge from a integer to a string
Converts the var (variable) myAge to if statement
