Professional Documents
Culture Documents
CLASS XI
CHAPTER 6
Lists
QUESTION BANK/ASSIGNMENT
list1[:31 + list1[3:]
(iv) list1 = [1,2,3,4,5]
listl [len (list1)-1]
9. What will be the output of the following code segment?
myList = [1,2, 3,4,5, 6,7,8,9,10]
for i in range (0, len (myList)):
if 182 == 0:
print (myList [i])
10. What will be the output of the following code segment?
(i) myList = [1,2, 3,4, 5, 6, 7,8, 9, 10]
del myList [3:]
print (myList)
(hi) myList = [1,2,3,4,5, 6,7,8,9, 10]
del myList(:5]
print (myList)
len()
3
list()
False
3
Error – is not in list
append()
extend()
True
insert()
pop()
remove()
clear()
count()
True
reverse=True
sorted()
True
sum()
True
Subjective Type questions
Write the significance use of following standard methods.
len
list
Find the output:
l=list(‘ListMethods’);print(l)
l=((78,90,12,34));print(l)
l=list({‘Karthik’:90,’Manoj’:85})
What is the use of index() method? Explain with example.
Explain the ValueError exception with example.
Differentiate between append(),extend() and insert() methods.
Differentiate between pop(), remove() and clear() methods.
What is the use of count() method? Explain with example.
Justify the statement: “reverse() does not return anything.”
Differentiate between sort() and sorted() methods.
What do you mean two-dimensional lists?
How to create and traverse 2D lists?
Output Questions:
[1]
l1 = [78,89,67,45,69,42,89,]
n = l1.index(89) + l1.index(42)
print(l1.count(89))
l1.append(l1.count(100)+34)
print(l1.len())
[2]
l1=[56,45,23,12,'ABC']
l1.extend([85,63])
l1.insert(3,99)
l1.pop()
print(l1)
l1.insert(0,101)
l1.insert(2,111)
l1.pop(2)
l1.remove('ABC')
print(l1)
[3]
l = [9,5,3,6,7,8]
l.sort()
l.reverse()
print(l)
n=sum(l)+max(l)+min(l)
print(n)
Now let’s see some error questions for QnA List methods Class 11:
l = (9,5,3,6,7,8)
print(l.len())
[2]
l=['Jan','Feb','Mar','Apr']
l.index(2)
l.remove('Jun')
print(sort(l))
n = l.max()