0% found this document useful (0 votes)
28 views2 pages

Chapter 10 String Manuplation

class 11th CS test Question paper for chapter 10th
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views2 pages

Chapter 10 String Manuplation

class 11th CS test Question paper for chapter 10th
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Kakka International School Nalkheda

Class 11 - Computer Science


Chapter 10: String Manipulation
Time: 1.5 Hours Total Marks: 50

Instructions:
Answer all questions.
Read each question carefully before attempting.
For MCQ questions, choose the most appropriate answer and write the corresponding letter (A, B, C, or D) in the
answer sheet.
For programming questions, use meaningful variable names.
Comments are appreciated but not mandatory.
Marks are indicated for each question.
Questions:

Part A: Multiple Choice Questions (20 Marks)

1. Which of the following is NOT a valid way to create a string in Python?


A) my_string = "Hello"
B) my_string = 'World'
C) my_string = "Python's"
D) my_string = 'This is a string'

2. What is the output of the following code?


my_string = "Hello"
print(my_string[0])
A) H
B) e
C) 0
D) Error

3. Which operator is used for string concatenation?


A) *
B) /
C) +
D) -

4. What does the len() function do for a string?


A) Returns the first character of the string
B) Returns the last character of the string
C) Returns the number of characters in the string
D) Converts the string to lowercase

5. What is the output of the following code?


my_string = "Hello, World!"
print(my_string[7:12])
A) "Hello"
B) "World"
C) "World!"
D) "o, Wor"

6. Which string method converts all characters in a string to uppercase?


A) lower()
B) upper()
C) capitalize()
D) title()

1|Page
7. Which string method removes leading and trailing whitespace from a string?
A) strip()
B) replace()
C) split()
D) join()

8. What does the split() method do to a string?


A) Joins a list of strings into a single string
B) Splits the string into a list of substrings
C) Replaces occurrences of one substring with another
D) Reverses the order of characters in the string

9. Which string method returns the index of the first occurrence of a specified substring within a string?
A) find()
B) count()
C) replace()
D) split()

10. What is the output of the following code?


my_string = "Hello"
print(my_string[::-1])
A) "Hello"
B) "olleh"
C) "eHllo"
D) "oHell"
Part B: Programming Questions (5 Marks)

11. String concatenation in Python can be achieved using the '+' operator.
12. The len() function in Python returns the number of characters in a string, including spaces.
13. String indexing in Python is zero-based, meaning the first character in a string has an index of 1.
14. The find() method in Python returns the index of the first occurrence of a substring within a string. If the
substring is not found, it returns -1.
15. Strings in Python are immutable, meaning they cannot be changed after they are created.
True
Part C: Programming Questions (30 Marks)

16. Write Python code to:


Extract the first five characters from the string "Computer Science".

17. Write Python code to:


Check if the substring "Python" exists within the string "I love learning Python!".

18. Write Python code to:


Replace all occurrences of the letter 'a' with the letter 'o' in the string "banana".

19. Write Python code to:


Count the number of words in the string "This is a sample sentence.".

20. Write a Python function named count_vowels that takes a string as input and returns the number of vowels
('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U') present in the string.

2|Page

You might also like