ACCESS COMPUTER EDUCATION CENTER
Python Test Paper
Topic: Sequence Data Types (List, Tuple, Dictionary)
Student Name : ____________________________
Date : ___________________________________
Time : 1 Hour
Maximum Marks : 50
1. Which data type is mutable in Python?
a) Tuple
b) String
c) List
d) Integer
2. Which symbol is used to create a list?
a) {}
b) []
c) ()
d) <>
3. What is the output of the following code?
x = (1, 2, 3)
print(len(x))
a) 2
b) 3
c) 1
d) Error
4. Which method is used to add an element at the end of a list?
a) insert()
b) append()
c) add()
d) extend()
5. Dictionary elements are stored in:
a) Index values
b) Key-value pairs
c) Tuples only
d) Sets only
6. Which of the following is a valid dictionary?
a) {1,2,3}
b) [1:"A"]
c) {"name":"Ali","age":20}
d) (1:"A")
7. Tuples are:
a) Mutable
b) Ordered and immutable
c) Unordered
d) Dynamic only
8. Which function is used to sort a list?
a) arrange()
b) order()
c) sort()
d) organize()
9. What is the index number of the first element in a list?
a) 1
b) -1
c) 0
d) 2
10. Which method removes all items from a dictionary?
a) delete()
b) clear()
c) remove()
d) pop()
11. Which bracket is used for tuple creation?
a) []
b) {}
c) ()
d) <>
12. Which method removes a specific item from a list?
a) pop()
b) clear()
c) remove()
d) delete()
13. What is the output of the following code?
a = [1,2,3]
print(a[1])
a) 1
b) 2
c) 3
d) Error
14. Which method is used to add multiple elements in a list?
a) append()
b) extend()
c) add()
d) join()
15. Which keyword is used to check membership in a list?
a) exists
b) has
c) in
d) include
16. Dictionary keys must be:
a) Duplicate
b) Unique
c) Mutable
d) Lists
17. What is the output of the following code?
t = (5,10,15)
print(t[-1])
a) 5
b) 10
c) 15
d) Error
18. Which function returns the length of a sequence?
a) size()
b) count()
c) len()
d) length()
19. Which method is used to copy a dictionary?
a) clone()
b) duplicate()
c) copy()
d) paste()
20. Which of the following is immutable?
a) List
b) Dictionary
c) Tuple
d) Set
21. Lists are created using ______ brackets.
22. A tuple is an ______ data type.
23. The method used to remove all elements from a list is ______.
24. Dictionary stores data in ______ pairs.
25. The function used to find the length of a sequence is ______.
26. Differentiate between List and Tuple.
27. Write a Python program to create a list of 5 numbers and print the largest number.
28. Explain any three dictionary methods with examples.
29. Write a program to count the number of elements in a tuple.
30. What is slicing in Python? Explain with an example using a list.
31. Find the output of the following code:
a = [10, 20, 30]
[Link](40)
print(a)
32. Find the output of the following code:
d = {"A":10, "B":20}
print(d["B"])
33. Find the output of the following code:
t = (1,2,3,4)
print(t[1:3])
34. Find the output of the following code:
x = [5, 10, 15]
[Link](10)
print(x)
35. Find the output of the following code:
d = {"name":"Ram", "age":18}
print([Link]())
Examiner Signature : _____________________