Courses
Courses for Kids
Free study material
Offline Centres
More
Store Icon
Store

Class 11 Computer Science Chapter 8: Strings – NCERT Solutions with PDF

ffImage
banner

How to Write Stepwise NCERT Answers for Computer Science Strings

Mastering strings is key to excelling in Class 11 Computer Science. Our NCERT Solutions for Class 11 Computer Science Chapter 8 give you stepwise clarity and exam strategies, tailored to the latest CBSE 2025–26 syllabus.


Every solution follows the CBSE marking scheme and helps answer both intext and back exercises with confidence. Practice important programs, definitions, and structured long answers—plus get guidance on presenting answers perfectly.


Download the free PDF for exercise-wise solutions and quick revision, so you score higher in every test. Start your journey to Computer Science success with clear, accessible, and trusted solutions!


How to Write Stepwise NCERT Answers for Computer Science Strings

Exercise: NCERT Solutions Computer Science Chapter 8 Strings (2025-26)

1. Consider the following string mySubject:


mySubject = "Computer Science"

What will be the output of the following string operations:

  1. print(mySubject[0:len(mySubject)])
    Answer: Computer Science
  2. print(mySubject[-7:-1])
    Answer: Scienc
  3. print(mySubject[::2])
    Answer: Cmue cec
  4. print(mySubject[len(mySubject)-1])
    Answer: e
  5. print(2*mySubject)
    Answer: Computer ScienceComputer Science
  6. print(mySubject[::-2])
    Answer: eniSrtpo
  7. print(mySubject[:3] + mySubject[3:])
    Answer: Computer Science
  8. print(mySubject.swapcase())
    Answer: cOMPUTER sCIENCE
  9. print(mySubject.startswith('Comp'))
    Answer: True
  10. print(mySubject.isalpha())
    Answer: False

2. Consider the following string myAddress:


myAddress = "WZ-1,New Ganga Nagar,New Delhi"

What will be the output of the following string operations:

  1. print(myAddress.lower())
    Answer: wz-1,new ganga nagar,new delhi
  2. print(myAddress.upper())
    Answer: WZ-1,NEW GANGA NAGAR,NEW DELHI
  3. print(myAddress.count('New'))
    Answer: 2
  4. print(myAddress.find('New'))
    Answer: 5
  5. print(myAddress.rfind('New'))
    Answer: 21
  6. print(myAddress.split(','))
    Answer: ['WZ-1', 'New Ganga Nagar', 'New Delhi']
  7. print(myAddress.split(' '))
    Answer: ['WZ-1,New', 'Ganga', 'Nagar,New', 'Delhi']
  8. print(myAddress.replace('New','Old'))
    Answer: WZ-1,Old Ganga Nagar,Old Delhi
  9. print(myAddress.partition(','))
    Answer: ('WZ-1', ',', 'New Ganga Nagar,New Delhi')
  10. print(myAddress.index('Agra'))
    Answer: ValueError: substring not found

3. Programming Problems:


  • 1. Write a program to input line(s) of text from the user until enter is pressed. Count the total number of characters in the text (including white spaces), total number of alphabets, total number of digits, total number of special symbols and total number of words in the given text. (Assume that each word is separated by one space).
    Answer:
    text = input("Enter text: ")
    char_count = len(text)
    alpha_count = sum(c.isalpha() for c in text)
    digit_count = sum(c.isdigit() for c in text)
    special_count = sum(not c.isalnum() and not c.isspace() for c in text)
    word_count = len(text.split())
    print("Total characters:", char_count)
    print("Total alphabets:", alpha_count)
    print("Total digits:", digit_count)
    print("Total special symbols:", special_count)
    print("Total words:", word_count)
      
  • 2. Write a user defined function to convert a string with more than one word into title case string where string is passed as parameter. (Title case means that the first letter of each word is capitalised)
    Answer:
    def toTitleCase(st):
        return st.title()
    text = input("Enter a string: ")
    print("Title Case String:", toTitleCase(text))
      
  • 3. Write a function deleteChar() which takes two parameters. One is a string and other is a character. The function should create a new string after deleting all occurrences of the character from the string and return the new string.
    Answer:
    def deleteChar(st, ch):
        return st.replace(ch, '')
    s = input("Enter string: ")
    c = input("Enter character to delete: ")
    print("Result:", deleteChar(s, c))
      
  • 4. Input a string having some digits. Write a function to return the sum of digits present in this string.
    Answer:
    def sumDigits(st):
        return sum(int(c) for c in st if c.isdigit())
    s = input("Enter string with digits: ")
    print("Sum of digits:", sumDigits(s))
      
  • 5. Write a function that takes a sentence as an input parameter where each word in the sentence is separated by a space. The function should replace each blank with a hyphen and then return the modified sentence.
    Answer:
    def replaceBlanks(st):
        return st.replace(' ', '-')
    s = input("Enter a sentence: ")
    print("Modified sentence:", replaceBlanks(s))
      

Mastering Python Strings with 2025-26 NCERT Solutions

Understanding strings in Python is vital for Computer Science Class 11. Our NCERT Solutions for Chapter 8 help you grasp string indexing, slicing, and methods with easy code examples and clear explanations.


Focus on practicing questions related to string operations like concatenation, repetition, and membership. These concepts often appear in board exams, so clear your basics by revising NCERT exercise problems regularly.


Use real code examples and practice daily to boost your programming confidence. Solid preparation from the 2025-26 NCERT Computer Science textbook ensures higher scores and a deeper understanding of Python strings.


FAQs on Class 11 Computer Science Chapter 8: Strings – NCERT Solutions with PDF

1. What is a string in Computer Science?

A string in Computer Science refers to a sequence of characters used to store and manipulate text.

  • Strings are data types in Python and most programming languages.
  • Each character in a string can be accessed using indexing.
  • Common string operations include concatenation, slicing, and searching.
  • In Python, strings are immutable and defined using single or double quotes.

2. What are the data types in Python NCERT?

Python supports several data types as per the NCERT Class 11 syllabus:

  • Numeric types: int, float, complex
  • Sequence types: string (str), list, tuple
  • Boolean type: bool (True/False values)
  • Set types
  • Mapping type: dict (dictionary)
Strings are one of the most used sequence types for text processing.

3. How many types of strings are supported in Python class 11?

In Class 11 Python (NCERT), a single string type is used, but strings support different formats:

  • Single-line strings - enclosed in single (' ') or double (" ") quotes
  • Multi-line strings - enclosed in triple quotes (''' ''' or """ """)
  • All string types support operations like concatenation, slicing, and repetition

4. Are NCERT Solutions enough for Class 11 Computer Science exams?

NCERT Solutions provide comprehensive, stepwise answers aligned with CBSE marking schemes:

  • Ensure all syllabus topics, definitions, and important programs are covered
  • Helps understand the exam pattern and answer structure
  • Best used along with practice questions and revision notes for full preparation

5. How to write stepwise NCERT answers to score full marks?

To score maximum marks in CBSE Class 11 Computer Science, follow these tips:

  • Start with a definition where required
  • Show each calculation or logic step clearly
  • Label diagrams or code properly
  • Conclude with a final answer or output
  • Use keywords from the question and maintain presentation neatness

6. Where can I download the chapter’s solutions PDF?

You can download the NCERT Solutions for Computer Science Chapter 8 Strings PDF for Class 11 on trusted educational platforms.

  • Look for a single-click PDF download button or link
  • Ensure solutions are for the current academic year (CBSE 2025–26)
  • Choose teacher-reviewed and syllabus-aligned PDFs for accuracy

7. How to present long answers to match CBSE marking?

Effective long answers for CBSE Computer Science must:

  • Start with a brief introduction
  • Break the answer into logical sections with headings
  • Include steps, code snippets, or diagrams where relevant
  • Use bullet points for clarity
  • Conclude with summary or output and use all keywords

8. What are the most important topics from Computer Science Chapter 8 Strings?

The key topics in Class 11 Computer Science Chapter 8 Strings include:

  • Definition and properties of strings in Python
  • String operations: concatenation, slicing, indexing
  • Built-in string functions and methods (len(), lower(), upper(), etc.)
  • Practical programs on strings
  • Differences between mutable and immutable types (strings are immutable)

9. Are diagrams or definitions mandatory in answers?

Including definitions and neatly labelled diagrams can help earn full stepwise marks:

  • Definitions clarify concepts and should be concise
  • Diagrams (if relevant) should be neat and clearly labelled
  • Marking schemes usually allocate marks for these elements, so add them where applicable

10. Do examiners award partial marks for correct steps even if the final answer is wrong?

Yes, in CBSE exams partial marks are awarded for each correct step shown, even if the final answer is incorrect:

  • Write every step of your logic or calculation clearly
  • Correct application of formulae, concepts, or reasoning fetches stepwise marks
  • This approach is especially important for NCERT Computer Science problems and programming questions