CHINMAYA VIDYALAYA SENIOR SECONDARY SCHOOL
VIRUGAMBAKKAM, CHENNAI – 92
CHAPTER 4 – STRING HANDLING IN PYTHON
A. Tick the correct Option
1. Which of the following is used to insert special characters that are invalid
in Python?
Ans: (a) Escape Sequence
2. Which operator is used to repeat the string for a given number of times?
Ans: (d) None of the above
Correct Answer – String Replication Operator (*)
3. Which of the following does string include?
Ans: (d) All of the above (Letter, Special Characters, Number)
4. Which of the following is correct about multiline string?
Ans: (d) It begins and ends with either three single quotes or three
double quotes.
5. Which of the following string function calculates and return the length of
a string supplied as an argument?
Ans: (a) len( )
B. Write ‘T’ for true and ‘F’ for false
1. Escape sequences are used to delete special characters. – False
2. Strings can be created by enclosing characters inside single or double
quotes. – True
3. Traversing means visiting each element and processing it as required
by the program. – True
4. Index with positive integer’s starts from left with 1. – False (it starts
with 0)
5. Python uses + for concatenation and * for replication – True
C. Fill in the blanks
1. Index with negative integers starts from right with -1.
2. The backslash (\) is a special character and is also known as the
escape character.
3. String concatenation operator joins two or more strings into one.
4. The lower ( ) function converts all uppercase letters to lowercase.
5. The capitalize( ) function returns a string with the first character in
capital.
D. Short answer type questions
1. What are strings?
Ans: A sequence of characters which is enclosed or surrounded by
single (‘ ’) or double (“ ”) quotes is known as a string.
2. What is the difference between (+) and (*)?
Ans: String concatenation operator (+) joins two or more strings
into one.
String replication operator (*) is used to repeat the string for a
given number of times.
3. What do you mean by traversing a string?
Ans: Traversing means visiting each element and processing it as
required by the program.
E. Long answer type questions
1. Explain different ways of indexing a list/string.
Ans: There are two ways of indexing:
*Index with positive integers: Index from left starts with 0.
*Index with negative integers: Index from right starts with -1.
2. Write about any two built-in functions to manipulate strings.
Ans: len( ) – This function calculates and returns the length of a
string supplied as an argument.
count( ) – This function returns the number of times substring
occurs in the given string.
3. What do you mean by escape sequence? Explain in detail.
Ans: Escape sequence or characters are used to insert special
characters that are invalid in Python. The backslash (\) is a special
character and also known as the escape character in Python.
Example : \n – for New Line
\t – for tab
\r – for carriage return