Skip to main content

Strings In Python — Part 1 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on Strings In Python — Part 1 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.

Questions
40
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
48 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
40

Verified Practice Questions

Interactive test mode with detailed academic worked solutions

Live Progress | 0/40 answered
✓ 0 correct ✗ 0 wrong 0% score
Question 1 of 40
★ FPSC ★ PPSC

What will be the output of the following code: string = "Python" print(string[1:4])

Question 2 of 40
★ FPSC ★ PPSC

Which of the following is the correct way to create a string in Python?

Question 3 of 40
★ FPSC ★ PPSC

What is the output of the following code: word = "Python" print(word[2])

Question 4 of 40
★ FPSC ★ PPSC

What does the len() function do when applied to a string?

Question 5 of 40
★ FPSC ★ PPSC

Which character is used to access individual elements of a string by index in Python?

Question 6 of 40
★ FPSC ★ PPSC

Which of the following methods is used to find the index of the first occurrence of a substring in a string?

Question 7 of 40
★ FPSC ★ PPSC

What is the output of the code: string = "Python" print(string[-2])

Question 8 of 40
★ FPSC ★ PPSC

In Python, which escape sequence is used to represent a newline character?

Question 9 of 40
★ FPSC ★ PPSC

What method is used to convert a string to uppercase in Python?

Question 10 of 40
★ FPSC ★ PPSC

Which method is used to replace a substring in a string with another substring?

Question 11 of 40
★ FPSC ★ PPSC

In Python, how can you check if a string starts with a specific substring?

Question 12 of 40
★ FPSC ★ PPSC

Which method is used to count the occurrences of a substring in a string?

Question 13 of 40
★ FPSC ★ PPSC

What is the purpose of the strip() method for strings?

Question 14 of 40
★ FPSC ★ PPSC

What is the output of the following code: string = "Python" print(string[::-1])

Question 15 of 40
★ FPSC ★ PPSC

In Python, which escape sequence is used to represent a tab character?

Question 16 of 40
★ FPSC ★ PPSC

What does the isalpha() method of a string object check for?

Question 17 of 40
★ FPSC ★ PPSC

Which method is used to split a string into a list of substrings based on a specified separator?

Question 18 of 40
★ FPSC ★ PPSC

What is the purpose of the find() method for strings?

Question 19 of 40
★ FPSC ★ PPSC

What is the output of the following code: string = "Python is fun" print(string.split())

Question 20 of 40
★ FPSC ★ PPSC

In Python, how can you check if a string ends with a specific substring?

Question 21 of 40
★ FPSC ★ PPSC

What is the purpose of the join() method for strings?

Question 22 of 40
★ FPSC ★ PPSC

What is the output of the following code: string = "Python" print(string.find("th"))

Question 23 of 40
★ FPSC ★ PPSC

Which method is used to remove leading and trailing whitespace from a string?

Question 24 of 40
★ FPSC ★ PPSC

What will be the output of the following code: string = "Hello, world!" print(string.replace("o", "i"))

Question 25 of 40
★ FPSC ★ PPSC

What is the purpose of the title() method for strings?

Question 26 of 40
★ FPSC ★ PPSC

In Python, how can you check if a string contains only numeric characters?

Question 27 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code snippet? print('a@ 1,'.islower())

Question 28 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code? print("xyyzxyzxzxyy".count('xyy', 2, 11))

Question 29 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code? >>>example = "helle" >>>example.find("e")

Question 30 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code snippet? print('xyyxyyxyxyxxy'.replace('xy', '12', 100))

Question 31 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code snippet? print('abcd'.translate({'a': '1', 'b': '2', 'c': '3', 'd': '4'}))

Question 32 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code? print('1Rn@'.lower())

Question 33 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code snippet? print('1@ a'.isprintable())

Question 34 of 40
★ FPSC ★ PPSC

What arithmetic operators cannot be used with strings?

Question 35 of 40
★ FPSC ★ PPSC

What will be the output of the following Python statement? >>>chr(ord('A'))

Question 36 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code snippet? print('1.1'.isnumeric())

Question 37 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code? print('*', "abcdef".center(7), '*')

Question 38 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code? print("xyyzxyzxzxyy".endswith("xyy", 0, 2))

Question 39 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code snippet? print(''.isdigit())

Question 40 of 40
★ FPSC ★ PPSC

What will be the output of the following Python code? print('ab'.isalpha())

✓ Link copied to clipboard
Continue Your Practice

Advance Html — Part 1

Master the next curriculum module with 40 exam-standard MCQs.

Next Practice Set →

💡 Examiner's Advisory for Programming & Software Development

In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.

More Modules in Programming & Software Development

View All →
📚

Study Guides

Topic summaries and syllabus breakdown

Explore Guides →
🎯

Complete Library

Search through 78,000+ verified MCQs

Browse Library →
📱

Mobile App

Offline mock tests and instant bookmarks

Get Mobile App →