---------------------------------------------------------------------------------------------------------------------------
UNIT TEST - 9 (2024-25)
Grade : XI Subject : Computer science
Marks : 50 Time : 3hours
---------------------------------------------------------------------------------------------------------------------------
[Link] choice question: 25 x 1 = 25
1. To indicate position of an element from the end of the list----- ---- is used.
a)len() b) pop() c)negative indexing d) slicing
2. List can contain values of these types.
a)Integer b) float c) lists d) tuples e) all of these
3. Which of the following will always return a list?
a) max() b) min () c)sort() d)sorted
4. Elements of a list can be changed in place.[true/false]
5. The append() can add an element in the middle of a list.[true/false]
6. The ------------ list contains another list as its member.
7. Lists are -------------datatypes and thus their values can be changed.
8. Which of the following is not list operation?
a)Indexing b) slicing c) Dividing d) Concatenation
9. List can have elements of ----- -------- datatypes
a) same b)different c) Both of the above d)None of the above
[Link] the output of the following:
L= [1,2,3,4,5,6,7,8,9,10]
print (L[L[3]])
a) 3 b) 4 c) 5 d) 6
11. Traversing a list can be done with the help of ------------
a) loop b) if c)if- elif d) None of the above
12. Which of the following function creates the new list?
a) sort() b)sorted() c) reverse() d) all of the above
Match the following ([Link].13 to 22)
[Link]-list [1:] – Reverse a list
14. my-list .reverse() - get the first element
15. my-list [0] – Get all elements except the first
16. [Link] (‘new’) – Add multiple elements to the end
17. my-list . insert(2,’new’) – sort the list in ascending order
18. my-list .remove (‘old’) – count the occurrences of an element
19. my-list . sort() - insert an element at a specific index
20. my-list .index(‘element’) – find the index of an element
21. my-list .count(‘element’) – Remove the first occurrence of an element
22. my-list . extend([1,2,3]) - Add an element at the end
Question No.23, 24,25, are Assertion and Reasoning based questions. Mark the correct
choice as : (A) Both (A) and (R) are true and (R) is the correct explanation of (A)
(B) Both (A) and (R) are true but (R) is not the correct explanation of (A)
( C) (A) is true, but (R) is false
( D) (A) is false, but (R) is true
23. Assertion (A) : A list slice is an extracted part of a list..
Reason (R) : A list slice is a list in itself
24. Assertion (A) : Lists unsliced strings are mutable
Reason (R) : lists are similar to strings in a number of ways like indexing, slicing and
accessing individual elements
25. Assertion (A) : my-list=[1,2,2]; [Link] (2 )== 2
Reason (R) : The count() method returns the number of occurrences of the specified element.
[Link] the following 5 x 2 = 10
1. What is list()?
2. What is a nested list?
3. How can you make copy of a list using : a) copy()
4. which method of python list must be used in these cases? a) get the position of an item in the list .
b) Add single item at the end of the list.
5. Define a list?
III. Answer the following : 2 x 3= 6
1. What is the difference between extend() function and append() function?
2. What is the difference between the following lines of codes:
code1: list 1= [1,3,5,6]
list 2= list1
code2 : list 1=[1,3,5,6]
list 2 = copy. copy(list1)
IV. Answer the following : (any one) 1x4=4
1. write the output of the following :
string 1 = ‘Rainbow’
print (list(string1))
2. write any five list manipulations?
V. Write the detail question: 1x5=5
1. What is the difference between sort() and sorted() functions. OR
Write a program to find the largest and smallest number in a list?