← All Python MCQ topics and your readiness dashboard
Test your Strings and f-strings knowledge with a timed Python MCQ mock test for interviews. Each attempt gives you 20 random questions in 20 minutes from a 200-question bank covering indexing and slicing, immutability, string methods (split, join, strip, replace, find), f-string format specs, encoding and bytes, Unicode and case-insensitive comparison, regular expressions for test data, and parsing UI text, logs, CSV and URLs in tests. 44 questions are written from a QA and test-automation angle and the rest from a developer angle; your result shows both scores.
What this Python MCQ test covers
Revise these lessons from the free Python tutorial before or after your test:
Sample Python Strings & f-strings questions with answers
- Q. A test compares names ignoring case. What does this code print?
print("Straße".casefold() == "STRASSE".casefold())
Answer:True
casefold() is a stronger lower() for caseless matching; "ß" folds to "ss". - Q. Cleaning a value scraped from the UI. What does this code print?
price = " $1,299.00\n"
print(price.strip().lstrip("$").replace(",", ""))
Answer:1299.00
Chained string methods: strip whitespace, remove the "$", then remove the thousands separator. - Q. What does this code print?
url = "https://sqatools.in/login"
print(url.removeprefix("https://"))
Answer:sqatools.in/login
removeprefix() (Python 3.9+) removes an exact prefix, unlike lstrip() which removes characters. - Q. What does this code print?
s = "python"
print(s[0], s[-1])
Answer:p n
Index 0 is the first character and index -1 the last. - Q. What does this code print?
s = "python"
print(s[1:4])
Answer:yth
A slice includes the start index and excludes the stop index: positions 1, 2, 3. - Q. What does this code print?
s = "python"
print(s[::-1])
Answer:nohtyp
A step of -1 walks the string backwards, the idiomatic way to reverse it.
Every predict-the-output question in this bank was run on Python 3, so the answer is the real output. Go back to the Python MCQ dashboard to see your overall Python learning progress and interview readiness.
Frequently asked questions
How many questions does the Python Strings & f-strings MCQ test have?
The bank has 200 questions. Each test picks 20 at random, favouring questions you have not seen yet, so about 10 attempts cover the whole bank.
How long is each test and what is the pass mark?
Each test has a 20-minute timer and submits itself when time runs out. You pass with 70%, which is 14 of 20 correct.
Is this test useful for QA and automation engineer interviews?
Yes. 44 of the questions use test-automation scenarios such as parsing UI text, test data and assertions, and your result shows your QA score separately.
Can I retake the test?
Yes, as often as you like. Every retake draws a fresh set of 20 questions and counts toward your 20-test readiness target.