NEW
Font size
WorksheetsG10 CS String Manipulation
Total questions: 15
Worksheet time: 8mins
Python Program
If string_name=‘Programming techniques’.
What is the output of
print(string_name.length) ?
20
21
22
23
0
Python Program
If string_name=‘Programming techniques’.
What is the output of
print(string_name.substring(5,6)) ?
amming
ramming
rammin
gramm
None
Python Program
If string_name=‘Programming techniques’.
What is the output of
print(string_name.substring(5,6)) ?
gramming
ramming
rammin
gramm
None
Python Program
If string_name=‘Programming techniques’.
What is the output of
print(string_name.substring(12,4)) ?
tech
tec
echn
techn
None
Python Program
If string_name=‘Programming techniques’.
What is the output of
print(string_name.substring(12,6)) ?
techin
tec
echn
techn
None
Which of the following represents the code that changes a variable string_name to uppercase characters?
string.upper()
string_name.upper()
string_name.uppercase()
None of the choices
What command is used to find the length in Python program?
lenght( )
len( )
lengthof( )
None of the above
If string_name=‘Patrick’, what is the value returned for string_name[2:3]?
tri
Pat
2 and 3
ric
If string_name=‘Patrick’, what is the value returned for string_name[3:6]?
'trick'
'rick'
'ric'
Error Message
Check either the question and statement makes sense.
If string_name=‘I like Programming’,
what is the output for
print(‘like’ in string_name)?
[2:6]
True
False
None of the above
Check either the question and statement makes sense.
If str1=‘Yes’ and str2=‘No’,
what is the result for str1+str2 in Python?
'YesNo'
'Yes No'
YesNo
Yes and No
What function converts a character to its ASCII code in Python ?
ASC( )
ord( )
chr( )
ascii( )
What function converts a ASCII code to its character in Python ?
ASC( )
ord( )
chr( )
ascii( )
Which of the following method is used to convert the number 9.11 to string in Python
str( )
string( )
int( )
float ( )
Which of the following function is used to convert a string value '4.25' to a datatype such that it can be used in mathematical operations in Python.
str( )
string( )
int( )
float ( )
