Chapter 8 · Class 11 · CBSE · Science Computer Science

Strings

25 practice questions · 5 marks weightage

Topics in this chapter

  • String Indexing and Slicing
  • String Methods and Manipulation
  • String Searching and Validation
  • String Immutability and Operators
  • String Coding Problems and Palindromes

Cheat sheet

Cheat Sheet

Practice questions

  1. Question 1Q-AE296D

    What is printed by the following Python code? s = "banana"; print(s[1:6:2])

    1. A.ban
    2. B.aaa
    3. C.nna
    4. D.ana
    See the answer and solution
  2. Question 2Q-1AA662

    What is the output of the following Python code? s = "Mississippi"; print(s.count("s"), s.find("sip"))

    1. A.4 5
    2. B.4 4
    3. C.3 5
    4. D.3 4
    See the answer and solution
  3. Question 3Q-E3C877

    Explain string immutability in Python and show how to change the first character of the string "cat" to produce "bat".

    See the answer and solution
  4. Question 4Q-2A6C7E

    What is printed by the following Python code? word = "Python"; print(word[-2])

    1. A.t
    2. B.h
    3. C.o
    4. D.n
    See the answer and solution
  5. Question 5Q-C714C8

    What is printed by the following Python code? s = " Data Science "; print(s.strip().replace(" ", "_").lower())

    1. A.Data_Science
    2. B.data_science
    3. C.data_science
    4. D.data science
    See the answer and solution

20 more questions on 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