Cheat sheet · Class 11 · CBSE · Science Computer Science

Strings cheat sheet

The whole chapter on one page: key formulas, facts and the points to remember, for quick revision before a test.

CBSE Class 11 · Computer Science

Cheat sheet

Chapter 8Strings

Strings are immutable — every ‘change’ makes a new string.

1. Indexing & Slicing

  • Indices 0 … n-1 forward, -1 … -n backward.
  • s[start:stop:step] — stop excluded.
  • s[::-1] reverses a string.

s = 'PYTHON' → s[1:4] = 'YTH', s[-2:] = 'ON'

2. Operations

  • Concatenation +, repetition *.
  • Membership: 'a' in s.
  • Traversal with for ch in s.

3. Common Methods

MethodDoes
len(s)length
upper(), lower(), title(), capitalize()change case
find(sub), index(sub), count(sub)search / count
isalpha(), isdigit(), isalnum(), isspace()tests
strip(), lstrip(), rstrip()remove spaces
split(), join(), replace(), partition()split / combine
startswith(), endswith()prefix / suffix check

4. Key Points

  • find() returns -1 if absent; index() raises an error.
  • s[0] = 'x' is an error (immutable).
  • Strings compare by Unicode values.
  • Triple quotes for multi-line strings.

Remember: Indexing & slicing | immutable | key methods

Strings: questions and notes

More Class 11 · CBSE · Science Computer Science cheat sheets

Practise Strings

Sign up free to practise the full chapter. Questions you get wrong come back until you've mastered them.

Start practising free

Free to start · No credit card needed