Python string methods: Class 11 practice
Strings are immutable; methods like upper(), lower(), count(), find(), replace() and split() return new values. The quick answer and an example come first; then the method, worked examples and six graded questions.
Python string methods: quick answer
Strings are immutable; methods like upper(), lower(), count(), find(), replace() and split() return new values. find() returns −1 when the substring is absent.
Example: What does "classroom".count("c") return? Answer: 1.
- Where it is taught: "Strings in Python", Class 11 Computer Science.
- On this page: the method, 3 worked examples and 6 graded questions with a full answer key.
How to use this page (about 30 minutes)
- Read the method once, then cover the worked examples and try them yourself before reading the steps.
- Do the two Basic questions without notes. If either is wrong, re-read the matching worked example.
- Do the Standard and Challenge questions, then check every line of working against the answer key — not only the final answer.
- Write down the mistake behind each wrong answer and redo that question the next day.
What you should know first
- String indexing
The idea behind python string methods
Strings are immutable; methods like upper(), lower(), count(), find(), replace() and split() return new values. find() returns −1 when the substring is absent.
Step-by-step method
- Identify the method and its arguments.
- Apply it to the original string (it does not change).
- Write the exact output, including quotes for strings in a list.
Worked example 1 (Basic)
What does "classroom".count("c") return?
- Occurrences of "c": 1
- Answer: 1
Worked example 2 (Standard)
What does "banana".find("ana") return?
- First match starts at index 1
- Answer: 1
Worked example 3 (Challenge)
What is "banana".replace("a", "A").split("A")?
- replace gives "bAnAnA"
- split on "A"
- Answer: ['b', 'n', 'n', '']
Common mistakes and misconceptions
- Expecting the original string to change
- find() returning an error instead of −1
Practice questions
- (Basic) What does "committee".count("t") return?
- (Basic) What does "assessment".count("t") return?
- (Standard) What does "bookkeeper".find("ook") return?
- (Standard) What does "mississippi".find("iss") return?
- (Challenge) What is "classroom".replace("m", "M").split("M")?
- (Challenge) What is "classroom".replace("r", "R").split("R")?
Answer key with full working
- Q1: Occurrences of "t": 2 → Answer: 2
- Q2: Occurrences of "t": 1 → Answer: 1
- Q3: First match starts at index 1 → Answer: 1
- Q4: First match starts at index 1 → Answer: 1
- Q5: replace gives "classrooM" → split on "M" → Answer: ['classroo', '']
- Q6: replace gives "classRoom" → split on "R" → Answer: ['class', 'oom']
Which textbook this practice follows
This skill is taught under "Strings in Python" in Class 11 Computer Science. Check your own textbook's contents page — CBSE, ICSE/ISC and state boards order chapters differently.
Answers on this page are generated and automatically re-checked by a second, independent calculation. They have not been reviewed by a teacher — if you spot a problem, tell us on WhatsApp.
Still stuck after the answer key?
If the same step in python string methods keeps going wrong, a short live 1 on 1 class can find the exact gap. The first demo class is free; send the class, board and chapter on WhatsApp (+91 9379416374).
Related practice and notes
More Class 11 Computer Science practice
Continue with this syllabus
Frequently asked questions
Which chapter is python string methods in?
This skill is taught under "Strings in Python" in Class 11 Computer Science. Check your own textbook's contents page — CBSE, ICSE/ISC and state boards order chapters differently.
Which question should I start with?
Start with the Basic questions. Move to Standard only when both Basic answers match the key with the same working; the Challenge questions combine this skill with earlier ones.
How were the answers checked?
Answers on this page are generated and automatically re-checked by a second, independent calculation. They have not been reviewed by a teacher — if you spot a problem, tell us on WhatsApp.
Is this only for CBSE?
The skill names follow NCERT/CBSE, but the method is the same for ICSE, state boards, IGCSE and IB. Only the chapter name and order differ.
Can I get live help with this topic?
Yes. RG's E-Learning teaches live 1 on 1 online classes; the first demo class is free and fees are shared after it.