WorksheetsPython Strings & Lists
Total questions: 20
Worksheet time: 18mins
Which of the operator can be used in Strings?
+
*
Both of the above
None of the above
When we create a program to extract each alphabet from a given string, what is it known as?
Transpose
Traverse
Translate
Terminate
Which of the following is not a comparison operator?
<
>
==
!==
word = "amazing"
For the given string if we run word[2:5] what does it mean?
It will extract alphabets from index 2 to index 4
It will extract alphabets from index 2 to index 5
It will extract alphabets from position 2 to position 4
It will extract alphabets from position 2 to position 5
word = "amazing"
For the given string if we run word[2:5:2] what does 2 mean in this function?
It will pick only second alphabet
It will pick only two alphabets
It will pick every alternate alphabet
It will pick first two alphabets
Which method is used to convert a given string in Capital letters?
Capital
Upper
ConverttoUpper
Capitalize
Which of the following is not a valid string function?
isalphanumeric
isspace
islower
isalnum
string="HELlo"
What will be the result of string.isupper()?
(a)
s1="Hello"
n1=10
print(s1+n1)
What is the error in this code?
Print statement not written in quotes
Numeric value not written in quotes
colon not written after the print statement
string cannot be added to a number
s1="Hello"
s2="10"
print(s1+n1)
What is the error in this code?
String 2 written in quotes
String cannot be multiplied with a string
colon not written after print statement
Number written in quotes
Which brackets are used for Lists?
( )
[ ]
{ }
None of the above
Which of the following does not work in Lists?
lstrip & rstrip
+ & * symbol
Membership operators
Slicing
Lists are?
Mutable
immutable
[1, 2, 8, 9] < [9, 1]
What will be the result if we compare these two lists?
True
False
[1, 2, 8, 9] < [1, 2, 8, 4]
What will be the result if we compare these two lists?
True
False
Which of the following operator is valid in Lists?
/
**
+
-
Which method is used to delete a value from the list and display it also?
del()
pop()
popshow()
remove()
Which method is used to merge two lists?
append
merge
join
extend
How many elements can be inserted using append() method?
1
2
3
Any number of elements
Which method is used to add a value at a specified position in the list?
append
extend
insert
pop
