Python Strings
1. What is used to define a multi-line string?
-
A. '...'
-
B. "...\n..."
-
C. '''...'''
-
D. \multi{}
'''...'''
'''...'''
2.Which method is used to convert string to lowercase?
-
A. lowercase()
-
B. tolower()
-
C. lower()
-
D. toLowerCase()
lower()
lower()
3.What is the output of '2' + '3'?
-
A. 5
-
B. 23
-
C. Error
-
D. 2 3
23
23
4.Which of the following is a valid string in Python?
-
A. 'Hello'
-
B. "Hello"
-
C. '''Hello'''
-
D. All of the above
All of the above
All of the above
5.Which function is used to find the length of a string?
-
A. length()
-
B. count()
-
C. len()
-
D. size()
len()
len()