➤ How to Code a Game
➤ Array Programs in Java
➤ Java Inline Thread Creation
➤ Java Custom Exception
➤ Hibernate vs JDBC
➤ Object Relational Mapping
➤ Check Oracle DB Size
➤ Check Oracle DB Version
➤ Generation of Computers
➤ XML Pros & Cons
➤ Git Analytics & Its Uses
➤ Top Skills for Cloud Professional
➤ How to Hire Best Candidates
➤ Scrum Master Roles & Work
➤ CyberSecurity in Python
➤ Protect from Cyber-Attack
➤ Solve App Development Challenges
➤ Top Chrome Extensions for Twitch Users
➤ Mistakes That Can Ruin Your Test Metric Program
Q1) Which operation cannot be performed on a python string?
a) Deletion of Python String
b) Splitting of Python String
c) Adding elements in a Python String
d) Reassigning of Python String
View Answer
Answer:- c) Adding elements in a Python StringQ2) What function do you use to read a string?
a) input(“Enter a string”)
b) eval(input(“Enter a string”))
c) enter(“Enter a string”)
d) eval(enter(“Enter a string”))
View Answer
Answer:- a) input(“Enter a string”)Q3) The format function when applied on a string returns _.
a) int
b) str
c) bool
d) Error
View Answer
Answer:- b) strQ4) What arithmetic operators cannot be used with strings?
a) +
b) –
c) *
d) All of the mentioned
View Answer
Answer:- b) –Q5) Which of the following is not a Python legal string operation?
a) ‘abc’ + ‘abc’
b) ‘abc’ * 3
c) ‘abc’ + 3
d) ‘abc’.lower()
View Answer
Answer:- d) ‘abc’.lower()Q6) To concatenate two strings to a third what statements are applicable?
a) s3 = s1 . s2
b) s3 = s1 * s2
c) s3 = s1.add(s2)
d) s3 = s1.add(s2)
View Answer
Answer:- d) s3 = s1.add(s2)Q7) What 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
View Answer
Answer:- c) Know PythonQ8) The output of executing string.ascii_letters can also be achieved by:
a) string.ascii_lowercase_string.digits
b) string.ascii_lowercase + string.ascii_uppercase
c) string.letters
d) string.lowercase_string.uppercase
View Answer
Answer:- b) string.ascii_lowercase+string.ascii_uppercaseQ9) Strings are immutable in Python, which means a string cannot be modified.
a) True
b) False
View Answer
Answer:- a) TrueQ10) To return the length of string s what command do we execute?
a) s.len()
b) len(s)
c) size(s)
d) s.size()
View Answer
Answer:- a) s.len()Also See:- String MCQ in Python– 2