STRING MCQ
[Link] arithmetic operators cannot be used with strings?
a) +
b) –
c) *
d) All of the mentioned
[Link] is the output of the given below program?
string = "Know Program"
print(string[:5] + "Python”
a) Know
b) Know Program
c) Know Python
d) None of these
[Link] are immutable in Python, which means a string cannot be modified.
a) True
b) False
[Link] return the length of string s what command do we execute?
a) [Link]()
b) len(s)
c) size(s)
d) [Link]()
[Link] method should I use to convert String “Python programming is fun” to “Python
Programming Is Fun”?
a) capitalize()
b) title()
c) istitle()
d) upper()
6. To check whether string s1 contains another string s2, use __.
a) [Link](s2)
b) s2 in s1
c) [Link](s2)
d) [Link](s2)
[Link] the output of the given Python program?
print("Know Program".find("o"))
a) 7
b) 2
c) 2, 7
d) None of these
[Link] would you extract 'World' from the string 'Hello, World!'?
a) 'Hello, World!'[7:11]
b) 'Hello, World!'[6:11]
c) 'Hello, World!'[7:12]
d) 'Hello, World!'[6:12]
[Link] is the output of 'Python'.isalpha()?
a) True
b) False
c) 1
d) 0
[Link] of the following will return the string 'Python' backward?
a) 'Python'[::-1]
b) 'Python'.reverse()
c) reverse('Python')
d) 'Python'[-1:]