WorksheetsPython Strings
Total questions: 10
Worksheet time: 5mins
A: Strings can be changed during execution
B. Strings can be enclosed within single, double or even triple quotes
C. Strings are immutable
A,B & C are True
A,B are True but C is False
B, C are True but A is False
A,C are True but B is False
Find the output of the following code:
>>>str1='Save Soil'
>>>str1.isalnum( )
Save Soil
True
False
Identify the string membership operators of Python
in, not in
like, not like
as, not as
between, not between
Which is the powerful function used for formatting strings?
chr( )
format( )
title( )
capitalize( )
The title( ) function
assigns title
returns the title of the file
returns string in title case
Predict the output:
>>>str1="Rajathi Raja"
>>>print(str1.count('Raja'))
1
2
Error
Raja
Match the following:
1. \n A) Carriage return
2. \v B) BackSpace
3. \b C) new line
4. \r D) Vertical tab
1-C, 2-D, 3-B, 4-A
1-A, 2-C, 3-B, 4-D
1-C, 2-D, 3-A, 4-B
1-C, 2-A, 3-B, 4-D
Predict the output:
>>>saint="Thiruvalluvar"
>>>print(saint[5:])
valluvar
Thiruvalluvar
uvalluvar
Thiru
MATCH THE FOLLOWING:
1. concatenation A) +=
2. Append B) [ ]
3. String Slicing C) *
4. Repeating D) +
1-B. 2-A, 3-C, 4-D
1-D. 2-A, 3-B, 4-C
1-A,2-B,3-C,4-D
1-A,2-D,3-C,4-B
s="welcome"
print( s. center (15,'*'))
***welcome***
****welcome****
****welcome***
undefine function center
