Python String MCQs with Answers

100% found this document useful (1 vote)
412 views2 pages
This document contains 10 multiple choice questions that test string operations and methods in Python. Some questions test immutable nature of strings, string slicing, string methods like fi…

Uploaded by

Mafnitha KK
  • String Manipulation Questions

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:]

STRING MCQ
1.What arithmetic operators cannot be used with strings?
a) +
b) –
c) *
d) All of the mentioned
2.What is the outp
a) s1.contains(s2)
b) s2 in s1
c) s1.contains(s2)
d) si.in(s2)
7.Find the output of the given Python program?
print("Know Pro

You might also like