NEW
Font size
Worksheetspython(strings)
Total questions: 10
Worksheet time: 5mins
example = "helle"
print(example.rfind("e") )
-4
4
3
1
example="helloworld"
print(example[::-1].startswith("d"))
dlrowolleh
True
c) -1
None
What will be the output of the “hello” +1+2+3?
hello123
hello
Error
hello6
What will be the output of the following Python code?
print("D", end = ' ')
print("C", end = ' ')
print("B", end = ' ')
print("A", end = ' ')
DCBA
A,B,C,D
D C B A
D
C
B
A
Say s=”hello” what will be the return value of type(s)?
STRING
bool
str
String
What is “Hello”.replace(“l”, “e”)?
Heeeo
Heelo
Heleo
none
What will be the output of the following Python code?
print("abcdef".find("cd") == "cd" in "abcdef")
True
False
error
none
which of the following is incorrect?
String is immutable.
capitalize() function in string is used to return a string by converting the whole given string into uppercase.
lower() function in string is used to return a string by converting the whole given string into lowercase.
None of these
Which of the following will give "Simon" as output?
If str1="John,Simon,Aryan"
print(str1[-7:-12])
print(str1[-11:-7])
print(str1[-11:-6])
print(str1[-7:-11])
What will the below Python code will return?
If str1="save paper,save plants"
print(str1.find("save"))
It returns the first index position of the first occurance of "save" in the given string str1.
It returns the last index position of the last occurance of "save" in the given string str1.
It returns the last index position of the first occurance of "save" in the given string str1.
It returns the first index position of the last occurance of "save" in the given string str1.
