PRACTICE • LEARN • GROW
Module 7: Strings - Final Quiz MCQs
Solve topic-wise placement questions and improve your skills.
Module 7: Strings - Final Quiz Progress
0 of 12 completed
0%
Topic Track
You are viewing MCQs in preview mode. Log in to select options, submit answers, and track your progress.
Log In to Answer
1
Why does string concatenation with
+ in a large loop lead to quadratic $O(N^2)$ execution time in Python?
A.
Because Python verifies spelling of every word
B.
Because strings are immutable, so each '+' allocates a new string object and copies all previous characters into it
C.
Because the '+' operator causes CPU interrupts
D.
Because strings are stored in disk swap space
Explanation & Key
Correct Answer:
2
What will be printed by the following negative indexing snippet?
s = "Python"
print(s[-1] + s[-3])
A.
nh
B.
no
C.
ph
D.
nt
Explanation & Key
Correct Answer:
3
What is extracted by the slice s[1:4] on s = "PYTHON"?
A.
PYT
B.
YTH
C.
YTHO
D.
THO
Explanation & Key
Correct Answer:
4
What will be the output of reversing a string using step -1?
s = "Ready"
print(s[::-1])
A.
Ready
B.
ydaeR
C.
ydae
D.
SyntaxError
Explanation & Key
Correct Answer:
5
What is the output of str.split() without arguments on a string with irregular spaces?
text = " Java Python C "
print(text.split())
A.
['', '', 'Java', '', '', '', 'Python', '', '', 'C', '', '', '']
B.
['Java', 'Python', 'C']
C.
[' Java', 'Python', 'C ']
D.
TypeError
Explanation & Key
Correct Answer:
6
What is printed by the following join operation?
words = ["2026", "09", "27"]
print("-".join(words))
A.
2026-09-27
B.
-2026-09-27-
C.
['2026', '09', '27']
D.
20260927
Explanation & Key
Correct Answer:
7
What is the output of str.find() when the search substring is NOT present?
s = "ReadyToGo"
print(s.find("Java"))
A.
None
B.
-1
C.
False
D.
Raises ValueError
Explanation & Key
Correct Answer:
8
What is the output of str.replace() with the optional count argument?
s = "banana"
print(s.replace("a", "o", 1))
A.
bonono
B.
bonana
C.
banana
D.
banona
Explanation & Key
Correct Answer:
9
What is the difference between single/double quotes and triple quotes in Python?
A.
Triple quotes can span multiple lines without escape characters and are commonly used for docstrings
B.
Triple quotes produce mutable string objects
C.
Single quotes store ASCII; triple quotes store Unicode
D.
Single quotes run faster than double quotes
Explanation & Key
Correct Answer:
10
What is a 'raw string' in Python (e.g.
r'C:\new\test')?
A.
A string containing binary data
B.
A string literal where backslashes are treated as literal characters rather than escape sequences
C.
A string that cannot be printed
D.
An unallocated string pointer
Explanation & Key
Correct Answer:
11
What will be the output of string strip?
s = "###Python###"
print(s.strip("#"))
A.
Python
B.
#Python#
C.
###Python
D.
TypeError
Explanation & Key
Correct Answer:
12
What will happen when attempting to reassign a single character in a string?
s = "Hello"
s[0] = "J"
A.
s becomes 'Jello'
B.
Raises TypeError: 'str' object does not support item assignment
C.
s becomes 'HelloJ'
D.
Silently ignored
Explanation & Key
Correct Answer:
Question Palette
Answered
Current
Not Attempted
Wrong