You are on page 1of 4

ASSIGNMENT NO-6

CLASS-XI
SUBJECT- COMPUTER SCIENCE PYTHON
TOPIC : LIST

MULTIPLE CHOICE QUESTIONS:-

1. Which of the following statement is correct?


(a) Lists are mutable in nature (b) Python list is immutable
(c) List have only positive indexing (d) List element cannot be updated

2. Elements of lists are separated by?


(a) full stop (b) comma (c) space (d) hash #

3. Which of the following functions will add only one element in the list?

(a) count() (b) extend() (c) append() (d) remove()

4. Which of the following functions will always remove the last element from
the list ?
(a) clear() (b) remove() (c) count() (d) pop()

5. Assertion (A) :-
Lists allows us to change individual elements but this is not possible in the
case of string.

Reason (R) :
Lists is mutable whereas string is immutable in nature.

(a) Both A and R are true and R is the correct explanation of A.


(b) Both A and R are true and R is not the correct explanation of A.
(c) A is true but R is false.
(d) A is false but R is true.

6. Which of the following is an invalid function of list?


(a) count() (b) pop() (c) insert() (d) isalnum()

8|Page
FILL IN THE BLANKS

1. The ______ loop makes it easy to traverse over the items in a list.
2. The _____ operator is used to replicate a list specified number of times.
3. The empty brackets [ ] indicate an ______ list.
4. _______ is an extracted part of the list.
5. The ______ function is used to insert an element at a designated position in a list.

OUTPUT CODES

1. Write the output of the following code:


s=[“90”, “10”, “30”, “40”]
count=3
Sum=0
for x in [1,2,5,4]:
a=s[count]
Sum=float(a)+1
print(Sum)
count-=1

2. Write the output of the following code:


list1=[12,32,65,26,80,10]
list1.sort()
print(list1)

3. Write the output of the following code:-


list1=[1,2,3,4,5,6,7,8,9,10]
list1[: : -2]
print(list1)
list1[:3]+list1[3:]
print(list1)

4. Write the output of the following code:


list1=[13,18,11,16,13,18,13]
print(list1.index(18))
print(list1.count(18))
list1.append(list1.count(13))
print(list1)

9|Page
5. Write the output of the following code:
L=[]
L1=[]
L2=[]
for x in range(1,10):
L.append(x)
for x in range(10,1,-2):
L1.append(x)
for x in range(len(L1)):
L2.append(L1[x]+L[x])
L2.append(len(L)-len(L1))
print(L2)

HOTS QUES.

1. Observe the given list and write the results of the following slices:-

L=[11,12,13,14,15,16,17,18,19,20]

(a) L[2:9]
(b) L[0:8]
(c) L[5:]
(d) L[:6]
(e) L[-8:-2]

2. CASE STUDY:
Observe the given List and give the result of following given methods:

List1=[21,22,23,24,25,26,27,28,29,30]

(a) print(List1.append(31))
(b) print(List1.extend([32,33,34])
(c) print(List1.remove(23))
(d) print(List1.pop(5))
(e) print(List1.insert(4,35))
(f) print(List1.sort())

10 | P a g e
PROGRAMS

1. WAP to initialize a list L , and the resultant list should be such that all even elements
should get multiplied by 3 and all the odd elements should get incremented by 5.

2. WAP to initialize a list L and resultant list should be such that it should transfer all
the multiple of 4 to new list M.

3. WAP to initialize a list A and display the list in reverse order.

11 | P a g e

You might also like