0% found this document useful (0 votes)
32 views25 pages

MCQs On Python Revision Tour

The document contains a set of 100 multiple-choice questions (MCQs) focused on Python lists, covering their properties, methods, and functionalities. Each question is presented with four answer options, and the correct answer is indicated. The document serves as a study guide for understanding lists in Python programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views25 pages

MCQs On Python Revision Tour

The document contains a set of 100 multiple-choice questions (MCQs) focused on Python lists, covering their properties, methods, and functionalities. Each question is presented with four answer options, and the correct answer is indicated. The document serves as a study guide for understanding lists in Python programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

100 MCQs on Python Q7. Which of the Q14.

Which is correct
Lists following is a nested about list in Python?
Concepts & Basics list? a) Ordered & Mutable
(Q1–Q25) a) [1, 2, 3] b) Ordered &
Q1. Which of the b) [[1, 2], [3, 4]] Immutable
following is the correct c) (1, 2, 3) c) Unordered & Mutable
way to create a list in d) {1:2, 3:4} d) Unordered &
Python? Answer: b Immutable
a) list1 = (1, 2, 3) Q8. What is the Answer: a
b) list1 = {1, 2, 3} maximum size of a list Q15. Which is correct
c) list1 = [1, 2, 3] in Python? list concatenation?
d) list1 = <1, 2, 3> a) 10,000 a) [1,2] + [3,4]
Answer: c b) 1 million b) [1,2] * [3,4]
Q2. Lists in Python are: c) Depends on RAM c) [1,2] - [3,4]
a) Immutable d) Fixed 2^31 d) [1,2] / [3,4]
b) Mutable Answer: c Answer: a
c) Fixed length Q9. List is a type of: Q16. A list can be
d) Not ordered a) Sequence created using:
Answer: b b) Mapping a) list() function
Q3. What will be the c) Set b) [] operator
output of len([10, 20, d) File c) Both a & b
30])? Answer: a d) None
a) 2 Q10. Which one is not Answer: c
b) 3 a list function? Q17. What is the data
c) 30 a) append() type of [ ]?
d) Error b) extend() a) tuple
Answer: b c) sort() b) list
Q4. Which index d) keys() c) set
represents the last Answer: d d) dict
element of a list L? Q11. Lists support: Answer: b
a) 0 a) Indexing Q18. Lists can be used
b) 1 b) Slicing for:
c) -1 c) Iteration a) Stack
d) n d) All of the above b) Queue
Answer: c Answer: d c) Both
Q5. A Python list can Q12. Which symbol is d) None
store: used for list Answer: c
a) Only integers comprehension? Q19. Which of the
b) Only strings a) {} following is true about
c) Different data types b) [] lists?
d) Only floats c) () a) Can contain
Answer: c d) <> duplicate values
Q6. What is the default Answer: b b) Cannot contain
index of the first Q13. What is returned duplicates
element in a list? by list(range(0))? c) Must be sorted
a) 1 a) [0] d) Must be unique
b) 0 b) [] Answer: a
c) -1 c) None Q20. Which operator
d) None d) Error checks membership in
Answer: b Answer: b a list?
a) == L = [1, 2, 3] c) count()
b) in L.append([4, 5]) d) len()
c) is print(L) Answer: c
d) not a) [1, 2, 3, 4, 5] Q32. Which method
Answer: b b) [1, 2, 3, [4, 5]] sorts a list in-place?
Q21. Which of the c) [1, 2, 3, (4, 5)] a) sorted()
following creates an d) Error b) sort()
empty list? Answer: b c) arrange()
a) list1 = {} Q27. Which method d) order()
b) list1 = [] adds multiple elements Answer: b
c) list1 = () at the end of a list? Q33. What will be the
d) list1 = None a) insert() output of:
Answer: b b) append() L = [3, 1, 4, 1, 5]
Q22. Which indexing is c) extend() L.sort()
allowed in lists? d) add() print(L)
a) Positive Answer: c a) [3, 1, 4, 1, 5]
b) Negative Q28. What will be the b) [5, 4, 3, 1, 1]
c) Both output of: c) [1, 1, 3, 4, 5]
d) None L = [10, 20, 30] d) Error
Answer: c L.insert(1, 15) Answer: c
Q23. A slice of list [10, print(L) Q34. Which method
20, 30][1:3] gives: a) [10, 15, 20, 30] reverses the elements
a) [10, 20] b) [10, 20, 15, 30] of a list?
b) [20, 30] c) [15, 10, 20, 30] a) flip()
c) [30] d) Error b) reverse()
d) [10, 30] Answer: a c) rev()
Answer: b Q29. Which of the d) invert()
Q24. List is best following removes and Answer: b
described as: returns the last Q35. min([2, 8, -3, 5])
a) Mutable collection element of a list? gives:
b) Immutable collection a) remove() a) 8
c) Fixed-length array b) del b) -3
d) Key-value store c) pop() c) 2
Answer: a d) discard() d) Error
Q25. Which function Answer: c Answer: b
gives the maximum Q30. What will Q36. Which of these
value in a list? list("Python") return? statements removes
a) max() a) ['Python'] element 20 from list L?
b) min() b) ['P', 'y', 't', 'h', 'o', a) L.remove(20)
c) sort() 'n'] b) del L[20]
d) len() c) c) L.pop(20)
Answer: a ("P","y","t","h","o","n") d) remove(L,20)
Perfect 👍 Let’s d) Error Answer: a
complete the Answer: b Q37. Which method
remaining 75 MCQs Q31. Which function is returns index of first
on Lists. used to count occurrence of element?
Q26–Q50 → List occurrences of an a) index()
Operations & Methods element in a list? b) find()
Q26. What will be the a) index() c) search()
output of: b) find()
d) count() Q44. What will be the Q50. Which operator is
Answer: a output of: used to check if
Q38. What will be the L = [1, 2, 3] element exists in list?
output of: print(L*0) a) in
L = [1, 2, 3] * 2 a) [] b) is
print(L) b) [1, 2, 3] c) ==
a) [1, 2, 3] c) [0,0,0] d) has
b) [2, 4, 6] d) Error Answer: a
c) [1, 2, 3, 1, 2, 3] Answer: a Q51–Q75 → Output
d) Error Q45. Which method Prediction
Answer: c adds one element at Q51.
Q39. Which operator is the end of a list? L = [10, 20, 30]
used for list a) insert() print(L[-1])
concatenation? b) append() a) 10
a) + c) extend() b) 20
b) * d) push() c) 30
c) - Answer: b d) Error
d) / Q46. all([True, False, Answer: c
Answer: a True]) gives: Q52.
Q40. What is the a) True L = [1, 2, 3, 4, 5]
output of: b) False print(L[1:4:2])
L = [1, 2, 3, 4, 5] c) [True, False, True] a) [2, 4]
print(L[1:4]) d) Error b) [1, 3, 5]
a) [1, 2, 3] Answer: b c) [2, 3, 4]
b) [2, 3, 4] Q47. What does d) [2]
c) [2, 3, 4, 5] any([0, "", False, 5]) Answer: a
d) [1, 2, 3, 4] return? Q53.
Answer: b a) True L = ['a', 'b', 'c']
Q41. Which method b) False print("".join(L))
clears all elements of a c) None a) ['a','b','c']
list? d) Error b) 'abc'
a) remove() Answer: a c) 'a b c'
b) pop() Q48. Which method d) Error
c) clear() combines two lists Answer: b
d) reset() element by element? Q54.
Answer: c a) zip() L = [1,2,3]
Q42. Which returns a b) join() print(L*3)
shallow copy of a list? c) merge() a) [1,2,3]
a) copy() d) extend() b) [1,2,3,1,2,3,1,2,3]
b) list() Answer: a c) [3,6,9]
c) slicing [:] Q49. What is the d) Error
d) All of the above output of: Answer: b
Answer: d L = [2, 4, 6] Q55.
Q43. sum([1, 2, 3]) print(max(L) - min(L)) L = [1, [2,3], 4]
returns: a) 4 print(L[1][0])
a) 123 b) 6 a) 2
b) 6 c) 2 b) 3
c) [6] d) 0 c) [2,3]
d) Error Answer: a d) Error
Answer: b Answer: a
Q56. Q62. print(L*2 + [4])
L = [1, 2, 3] L = [] a) [1,2,3,4]
L[1] = 10 print(bool(L)) b) [1,2,3,1,2,3,4]
print(L) a) True c) [2,4,6,4]
a) [1, 2, 3] b) False d) Error
b) [1, 10, 3] c) [] Answer: b
c) [10, 2, 3] d) Error Q69.
d) Error Answer: b L = [1,2,3,4,5]
Answer: b Q63. print(L[::-1])
Q57. L = [2,4,6] a) [5,4,3,2,1]
L = [10,20,30] print(sum(L)) b) [1,2,3,4,5]
print(L.index(30)) a) 12 c) Error
a) 1 b) 24 d) None
b) 2 c) [2,4,6] Answer: a
c) 30 d) Error Q70.
d) Error Answer: a L = ['a','b','c']
Answer: b Q64. print(len(L))
Q58. L = [1,2,3] a) 2
L = [5,4,3,2,1] print(2 in L) b) 3
print(sorted(L)) a) True c) None
a) [5,4,3,2,1] b) False d) Error
b) [1,2,3,4,5] c) None Answer: b
c) None d) Error Q71.
d) Error Answer: a L = [1,2,2,3]
Answer: b Q65. print(L.count(2))
Q59. L = [1,2,3,4] a) 1
L = ['x','y','z'] print(L[:]) b) 2
L.reverse() a) [] c) 3
print(L) b) [1,2,3,4] d) Error
a) ['x','y','z'] c) Error Answer: b
b) ['z','y','x'] d) None Q72.
c) Error Answer: b L = [1,2,3]
d) None Q66. L.remove(2)
Answer: b L = [100,200,300] print(L)
Q60. print(min(L)) a) [1,2,3]
L = [1,2,3] a) 100 b) [1,3]
print(L*0) b) 200 c) [2,3]
a) [] c) 300 d) Error
b) [1,2,3] d) Error Answer: b
c) [0,0,0] Answer: a Q73.
d) Error Q67. L = [1,2,3,4]
Answer: a L = ['a','b','c'] print(L[::2])
Q61. print(L[1:]) a) [1,3]
L = [1,2,3] a) ['a'] b) [2,4]
print(L[-4]) b) ['b','c'] c) [1,2]
a) 1 c) ['c'] d) [3,4]
b) Error d) Error Answer: a
c) 3 Answer: b Q74.
d) None Q68. L = [10,20,30]
Answer: b L = [1,2,3] print(L.pop())
a) 10 Q80. L = [1,2,3]
b) 20 L = [1,2,3] print(min())
c) 30 print(L/2) a) 1
d) Error a) [0.5,1,1.5] b) Error
Answer: c b) [0,1] c) None
Q75. c) Error d) 3
L= d) None Answer: b
['apple','banana','cherr Answer: c Q87.
y'] Q81. L = [1,2,3]
print(L[0][1]) L = [1,2,3] print(max([]))
a) 'a' print(L.index(4)) a) None
b) 'p' a) 4 b) Error
c) 'b' b) 0 c) []
d) Error c) Error d) 0
Answer: b d) None Answer: b
Q76–Q100 → Error Answer: c Q88.
Finding & Reasoning Q82. L = [1,2,3]
Q76. L = [1,2,3] print(sum("123"))
L = [1,2,3] L.sort(reverse=True) a) 6
print(L[5]) print(L) b) "123"
a) 3 a) [1,2,3] c) Error
b) None b) [3,2,1] d) None
c) Error c) Error Answer: c
d) 0 d) None Q89.
Answer: c Answer: b L = [1,2,3]
Q77. Q83. print(L.clear(1))
L = [1,2,3] L = [1,2,3] a) []
L.remove(4) print(L[::0]) b) [2,3]
a) Removes 4 a) [1,2,3] c) Error
b) Removes last b) Error d) None
element c) None Answer: c
c) Error d) [ ] Q90.
d) None Answer: b L = [1,2,3]
Answer: c Q84. print(L.extend(4))
Q78. L = [1,2,3] a) [1,2,3,4]
L = [1,2,3] print(L[1.0]) b) Error
del L[3] a) 2 c) None
a) Deletes 3 b) 1 d) [4]
b) Deletes last element c) Error Answer: b
c) Error d) None Q91.
d) None Answer: c L = [1,2,3]
Answer: c Q85. print(L.remove(2,3))
Q79. L = [1,2,3] a) [1]
L = (1,2,3) print(len(5)) b) Error
L[0] = 5 a) 1 c) [2,3]
a) (5,2,3) b) Error d) None
b) Error c) 5 Answer: b
c) [5,2,3] d) None Q92.
d) None Answer: b L = [1,2,3]
Answer: b Q86. print(L.pop(5))
a) 3 c) Error Q5. Tuples are defined
b) 5 d) None using:
c) Error Answer: c a) []
d) None Q99. b) {}
Answer: c L = [1, 2, 3] c) ()
Q93. print(L.count()) d) <>
L = [1,2,3] a) 0 Answer: c
print(sorted(5)) b) Error Q6. Which is the
a) 5 c) 3 correct empty tuple?
b) [5] d) None a) []
c) Error Answer: b b) {}
d) None Q100. c) ()
Answer: c L = [1, 2, 3] d) None
Q94. print(L[1:100]) Answer: c
L = [1,2,3] a) [2, 3] Q7. Tuples are best
print(L + 5) b) Error described as:
a) [1,2,3,5] c) [ ] a) Ordered & Mutable
b) [5,1,2,3] d) None b) Ordered &
c) Error Answer: a Immutable
d) None Python Tuples c) Unordered & Mutable
Answer: c Q1–Q25 → Concepts d) Unordered &
Q95. & Basics Immutable
L = [1,2,3] Answer: b
Q1. Tuples in Python
print(L * "2") Q8. Can a tuple contain
are:
a) [1,2,3,1,2,3] duplicate values?
a) Mutable
b) Error a) Yes
b) Immutable
c) None b) No
c) Dynamic
d) [2,2,2] c) Only numbers
d) Changeable
Answer: b d) Only strings
Answer: b
Q96. Answer: a
Q2. Which of the
L = [1,2,3] Q9. Which of the
following is a tuple?
print(L.append(4,5)) following is a nested
a) (1, 2, 3)
a) [1,2,3,4,5] tuple?
b) [1, 2, 3]
b) Error a) (1, 2, 3)
c) {1, 2, 3}
c) None b) ((1, 2), (3, 4))
d) {1:2, 3:4}
d) [4,5] c) [1, 2, 3]
Answer: a
Answer: b d) {1, 2, 3}
Q3. What is the type of
Q97. Answer: b
(5)?
L = [1, 2, 3] Q10. Which operator is
a) int
print(L.insert()) used for tuple
b) tuple
a) [1, 2, 3] concatenation?
c) list
b) [1, 2, 3, None] a) +
d) float
c) Error b) *
Answer: a
d) None c) -
Q4. What is the type of
Answer: c d) /
(5,)?
Q98. Answer: a
a) int
L = [1, 2, 3] Q11. Which operator is
b) tuple
print(L.sort(5)) used for tuple
c) list
a) [1, 2, 3, 5] repetition?
d) float
b) [1, 2, 3] a) +
Answer: b
b) * Q18. Which function Q24. Which is the
c) - returns the minimum correct way to create a
d) / element of a tuple? single-element tuple?
Answer: b a) max() a) (5)
Q12. Which function b) min() b) (5,)
returns the number of c) sum() c) [5]
elements in a tuple? d) len() d) {5}
a) size() Answer: b Answer: b
b) count() Q19. Tuples are stored Q25. Tuples support:
c) len() in: a) Indexing
d) length() a) Continuous memory b) Slicing
Answer: c blocks c) Iteration
Q13. Which of the b) Hash tables d) All of the above
following methods is c) Linked lists Answer: d
NOT available for d) None Q26–Q50 → Tuple
tuples? Answer: a Operations &
a) index() Q20. Which is faster in Functions
b) count() Python?
Q26. What is the
c) append() a) List
output of:
d) len() b) Tuple
T = (1, 2, 3)
Answer: c c) Both equal
print(T*2)
Q14. Tuples can store: d) None
a) (2,4,6)
a) Only integers Answer: b
b) (1,2,3,1,2,3)
b) Only strings Q21. What is the result
c) [1,2,3,1,2,3]
c) Mixed data types of len(())?
d) Error
d) Only floats a) 0
Answer: b
Answer: c b) 1
Q27. Which of the
Q15. Which indexing is c) None
following returns the
supported by tuples? d) Error
index of an element in
a) Positive Answer: a
a tuple?
b) Negative Q22. Which is correct
a) find()
c) Both about tuple
b) search()
d) None immutability?
c) index()
Answer: c a) Elements cannot be
d) count()
Q16. What is the changed
Answer: c
output of tuple("ABC")? b) Elements can be
Q28. Which of the
a) ('ABC') changed
following counts the
b) ['A','B','C'] c) Tuple can be
number of times an
c) ('A','B','C') extended
element appears in a
d) Error d) Tuple can shrink
tuple?
Answer: c Answer: a
a) index()
Q17. Which function Q23. Which function
b) count()
returns the maximum converts a list into a
c) frequency()
element of a tuple? tuple?
d) size()
a) max() a) list()
Answer: b
b) min() b) tuple()
Q29. Which operator
c) sum() c) set()
checks membership in
d) len() d) dict()
a tuple?
Answer: a Answer: b
a) in
b) is
c) == d) count() d) Error
d) has Answer: a Answer: b
Answer: a Q36. What is the result Q42. Which of these
Q30. Which function of: can a tuple contain?
returns the sum of all tuple([1,2,3]) a) List
numeric elements of a a) [1,2,3] b) Dictionary
tuple? b) (1,2,3) c) Another tuple
a) sum() c) {'1','2','3'} d) All of the above
b) add() d) Error Answer: d
c) total() Answer: b Q43. Which one is
d) max() Q37. What will be the faster in iteration?
Answer: a output of: a) List
Q31. What will be the T = (1,2,3) b) Tuple
output of: print(T[0:2]) c) Both same
T = (10, 20, 30) a) (1,) d) None
print(max(T)) b) (1,2) Answer: b
a) 10 c) (2,3) Q44. What is the result
b) 20 d) Error of:
c) 30 Answer: b tuple("AB")
d) Error Q38. Which function a) ('AB')
Answer: c converts a tuple into a b) ('A','B')
Q32. Which of the list? c) ['A','B']
following is valid? a) tuple() d) Error
a) T[0] = 5 b) list() Answer: b
b) T.append(5) c) set() Q45. Which method is
c) del T[0] d) dict() not valid for tuple?
d) T = T + (5,) Answer: b a) index()
Answer: d Q39. Which operator b) append()
Q33. Which statement repeats elements of a c) count()
deletes the entire tuple tuple? d) len()
variable? a) + Answer: b
a) del T b) * Q46. Which statement
b) T.remove() c) % creates a tuple with
c) T.clear() d) / numbers 1 to 5?
d) T.pop() Answer: b a) tuple(range(1,6))
Answer: a Q40. Which function b) (1:5)
Q34. Which function gives the smallest c) (range(1,6))
returns the sorted list element in a tuple? d) [1..5]
of elements of a tuple? a) min() Answer: a
a) sort() b) max() Q47. What is returned
b) sorted() c) len() by:
c) arrange() d) sum() len((5,))
d) order() Answer: a a) 0
Answer: b Q41. What will be the b) 1
Q35. Which built-in output of: c) 5
function finds length of T = ('a','b','c') d) Error
a tuple? print(T.index('b')) Answer: b
a) len() a) 0 Q48. Which of the
b) length() b) 1 following is False about
c) size() c) 2 tuples?
a) They are ordered T = (1, [2,3], 4) print(min(T))
b) They are immutable T[1][0] = 5 a) 100
c) They allow print(T) b) 200
duplicates a) (1,[5,3],4) c) 300
d) They support b) (1,2,3,4) d) Error
append() c) Error Answer: a
Answer: d d) None Q61.
Q49. Which built-in Answer: a T = (1,2,3)
function returns tuple Q55. print(T.index(3))
of zipped elements? T = (1,2,3) a) 0
a) merge() print(2 in T) b) 1
b) zip() a) True c) 2
c) join() b) False d) Error
d) extend() c) Error Answer: c
Answer: b d) None Q62.
Q50. Which operator is Answer: a T = ('a','b','c')
not supported by Q56. print(len(T))
tuples? T = (10,20,30) a) 2
a) + print(sum(T)) b) 3
b) * a) 60 c) 1
c) -= b) 30 d) Error
d) in c) (10,20,30) Answer: b
Answer: c d) Error Q63.
Q51–Q75 → Output Answer: a T = (1,2,3)
Prediction Q57. print(T[::2])
Q51. T = (1,2,2,3) a) (1,3)
T = (1,2,3) print(T.count(2)) b) (2,)
print(T[-1]) a) 1 c) (2,3)
a) 1 b) 2 d) Error
b) 2 c) 3 Answer: a
c) 3 d) Error Q64.
d) Error Answer: b T = (1,2,3)
Answer: c Q58. print(T*0)
Q52. T = (5,) a) ()
T = (10,20,30,40) print(T*3) b) (1,2,3)
print(T[1:3]) a) (5,) c) None
a) (10,20) b) (5,5,5) d) Error
b) (20,30) c) [5,5,5] Answer: a
c) (30,40) d) Error Q65.
d) Error Answer: b T = (1,2,3)
Answer: b Q59. print(5 not in T)
Q53. T = (1,2,3) a) True
T = ('x','y')*2 print(T[:]) b) False
print(T) a) (1,2,3) c) Error
a) ('x','y') b) [] d) None
b) ('x','y','x','y') c) Error Answer: a
c) ['x','y','x','y'] d) None Q66.
d) Error Answer: a T = (1,2,3)
Answer: b Q60. print(T + (4,5))
Q54. T = (100,200,300)
a) (1,2,3,4,5) c) Error c) None
b) [1,2,3,4,5] d) None d) (2,)
c) Error Answer: a Answer: b
d) None Q73. Q79.
Answer: a T = (0,1,2) T = (1,2,3)
Q67. print(any(T)) print(T.pop())
T = ('p','q') a) True a) 3
print(T*2 + ('r',)) b) False b) Error
a) ('p','q','r') c) Error c) None
b) ('p','q','p','q','r') d) None d) (1,2)
c) ('r','p','q') Answer: a Answer: b
d) Error Q74. Q80.
Answer: b T = () T = (1,2,3)
Q68. print(bool(T)) print(T.clear())
T = ('apple','banana') a) True a) ()
print(T[0][1]) b) False b) Error
a) 'a' c) Error c) None
b) 'p' d) None d) [ ]
c) 'b' Answer: b Answer: b
d) Error Q75. Q81.
Answer: b T = (1,2,3) T = (1,2,3)
Q69. print(sum([])) print(T.sort())
T = (10,20,30,40) a) 6 a) (1,2,3)
print(T[::-1]) b) 0 b) Error
a) (40,30,20,10) c) Error c) None
b) (10,20,30,40) d) None d) [1,2,3]
c) Error Answer: b Answer: b
d) None Q76–Q100 → Error Q82.
Answer: a Finding & Reasoning T = (1,2,3)
Q70. Q76. print(T[1.0])
T = (1,2,3,4) T = (1,2,3) a) 2
print(T[1:100]) T[0] = 5 b) Error
a) (2,3,4) a) (5,2,3) c) None
b) (1,2,3,4) b) Error d) 1
c) () c) None Answer: b
d) Error d) (1,2,3) Q83.
Answer: a Answer: b T = (1,2,3)
Q71. Q77. print(T/2)
T = ('a','b','c') T = (1,2,3) a) (0.5,1,1.5)
print('d' in T) T.append(4) b) Error
a) True a) (1,2,3,4) c) None
b) False b) Error d) [ ]
c) Error c) None Answer: b
d) None d) (4,) Q84.
Answer: b Answer: b T = (1,2,3)
Q72. Q78. print(len(5))
T = (1,2,3) T = (1,2,3) a) 5
print(all(T)) T.remove(2) b) Error
a) True a) (1,3) c) None
b) False b) Error
d) 1 Q91. T = (1,2,3)
Answer: b T = (1,2,3) print(T.pop(2))
Q85. print(T + 5) a) 3
T = (1,2,3) a) (1,2,3,5) b) Error
print(min()) b) Error c) None
a) 1 c) None d) (1,2)
b) Error d) (5,) Answer: b
c) None Answer: b Q98.
d) 3 Q92. T = (1,2,3)
Answer: b T = (1,2,3) print(T.append(4,5))
Q86. print(T*'2') a) (1,2,3,4,5)
T = (1,2,3) a) (1,2,3,1,2,3) b) Error
print(max([])) b) Error c) None
a) None c) None d) (4,5)
b) Error d) (2,2,2) Answer: b
c) [] Answer: b Q99.
d) 0 Q93. T = (1,2,3)
Answer: b T = (1,2,3) del T[0]
Q87. print(T.count()) a) (2,3)
T = (1,2,3) a) 0 b) Error
print(sum("123")) b) 3 c) None
a) 6 c) Error d) (1,2,3)
b) "123" d) None Answer: b
c) Error Answer: c Q100.
d) None Q94. T = (1,2,3)
Answer: c T = (1,2,3) print(T[5])
Q88. print(T.index(4)) a) 3
T = (1,2,3) a) 4 b) Error
print(T.extend([4,5])) b) 0 c) None
a) (1,2,3,4,5) c) Error d) 0
b) Error d) None Answer: b
c) None Answer: c
d) (4,5) Q95.
Answer: b T = (1,2,3)
Q89. print(sorted(T,
T = (1,2,3) reverse="yes")) Python Sets
print(T.insert(1,5)) a) [3,2,1] Q1–Q25 → Concepts
a) (1,5,2,3) b) Error & Basics
b) Error c) None
Q1. A set in Python is:
c) None d) (3,2,1)
a) Ordered & Mutable
d) [ ] Answer: b
b) Unordered &
Answer: b Q96.
Mutable
Q90. T = (1,2,3)
c) Ordered &
T = (1,2,3) print(T.remove(2,3))
Immutable
print(T[::0]) a) (1,)
d) Unordered &
a) (1,2,3) b) Error
Immutable
b) Error c) (2,3)
Answer: b
c) None d) None
d) () Answer: b
Q2. Which of the
Answer: b Q97.
following is the correct
way to create an empty Q8. Which of the Q14. Which operator is
set? following is valid? used for intersection of
a) {} a) S = {1,2,3,2} two sets?
b) set() b) S = {‘a’,‘b’,‘a’} a) +
c) [] c) S = set([1,2,3]) b) |
d) () d) All of the above c) &
Answer: b Answer: d d) -
Answer: c
Q3. What is the type of Q9. Are sets mutable?
{} in Python? a) Yes Q15. Which operator is
a) set b) No used for difference of
b) dict c) Only integers can two sets?
c) list change a) +
d) tuple d) Only strings can b) -
Answer: b change c) *
Answer: a d) /
Q4. Which of the Answer: b
following creates a set Q10. Can a set contain
with one element? a list? Q16. Which operator is
a) {5} a) Yes used for symmetric
b) {5,} b) No difference?
c) set([5]) c) Only nested lists a) ^
d) All of the above d) Only empty lists b) *
Answer: d Answer: b c) |
d) &
Q5. Sets do not allow: Q11. Can a set contain Answer: a
a) Duplicates a tuple?
b) Integers a) Yes Q17. Which method
c) Strings b) No removes an element
d) Booleans c) Only numeric tuples safely without error?
Answer: a d) Only string tuples a) remove()
Answer: a b) pop()
Q6. Which data c) discard()
structure is used to Q12. Which function d) del
implement sets in finds length of a set? Answer: c
Python? a) size()
a) Array b) len() Q18. Which method
b) Dictionary (hash c) count() removes a random
table) d) length() element from a set?
c) List Answer: b a) discard()
d) Linked List b) remove()
Answer: b Q13. Which operator is c) pop()
used for union of two d) del
Q7. Which keyword is sets? Answer: c
used to define a set? a) +
a) set b) | Q19. Which method
b) list c) & removes all elements
c) tuple d) - from a set?
d) dict Answer: b a) clear()
Answer: a b) empty()
c) discard() Q25. Frozen sets are: a) union()
d) delete() a) Mutable sets b) update()
Answer: a b) Immutable sets c) combine()
c) Ordered sets d) join()
Q20. Which method d) Indexed sets Answer: a
adds an element to a Answer: b
set? Q31. Which method
a) add() Q26–Q50 → Set updates a set with
b) append() Operations & union of another?
c) insert() Functions a) add()
d) push() b) update()
Q26. What is the
Answer: a c) union()
output of {1,2,3} |
d) extend()
{3,4,5}?
Q21. Which method Answer: b
a) {1,2,3,4,5}
adds multiple elements b) {3}
at once? c) {1,2,3} Q32. Which method
a) append() d) {4,5} returns the intersection
b) update() Answer: a of sets?
c) add() a) intersection()
d) insert() b) common()
Q27. What is the
Answer: b c) &
output of {1,2,3} &
d) join()
{3,4,5}?
Q22. Which function Answer: a
a) {1,2,3,4,5}
checks membership in b) {3}
a set? c) {1,2} Q33. Which method
a) in d) {4,5} returns the difference
b) is Answer: b between sets?
c) == a) diff()
d) has b) difference()
Q28. What is the
Answer: a c) subtract()
output of {1,2,3} -
d) remove()
{3,4,5}?
Q23. What is returned Answer: b
a) {1,2}
by: b) {3}
c) {4,5} Q34. Which method
len(set()) d) {} returns symmetric
a) 0 Answer: a difference?
b) None a) symdiff()
c) Error b)
Q29. What is the
d) 1 symmetric_difference()
output of {1,2,3} ^
Answer: a c) xor()
{3,4,5}?
d) ^
a) {1,2,4,5}
Q24. Sets are: Answer: b
b) {3}
a) Ordered c) {1,2,3,4,5}
b) Indexed d) {} Q35. Which method
c) Mutable Answer: a checks if one set is
d) Allow duplicates subset of another?
Answer: c a) issubset()
Q30. Which method
b) issuperset()
returns the union of
c) in
two sets?
d) <= c) 1 a) sum()
Answer: a d) Error b) add()
Answer: b c) total()
Q36. Which method d) combine()
checks if one set is Q42. What is {1,2,3} Answer: a
superset of another? == {3,2,1}?
a) issuperset() a) True Q48. Which method
b) issubset() b) False removes and returns a
c) contains() c) Error random element?
d) >= d) None a) pop()
Answer: a Answer: a b) discard()
c) remove()
Q37. Which operator Q43. What is {1,2,3} is d) delete()
checks if one set is {1,2,3}? Answer: a
subset of another? a) True
a) < b) False Q49. What happens if
b) <= c) Error we remove() a non-
c) > d) None existing element?
d) >= Answer: b a) Ignores it
Answer: b b) Error
Q44. Which function c) Adds element
Q38. Which operator gives smallest element d) None
checks if one set is in a set? Answer: b
superset of another? a) min()
a) < b) max() Q50. What happens if
b) <= c) sum() we discard() a non-
c) > d) sorted() existing element?
d) >= Answer: a a) Ignores it
Answer: d b) Error
Q45. Which function c) Adds element
Q39. Which method gives largest element d) None
copies a set? in a set? Answer: a
a) copy() a) min()
b) clone() b) max() Q51–Q75 → Output
c) duplicate() c) sum() Prediction
d) replicate() d) sorted() Q51.
Answer: a Answer: b
S = {1,2,3}
Q40. Which function Q46. Which function print(2 in S)
converts list to set? returns sorted a) True
a) tuple() elements of a set? b) False
b) dict() a) sort() c) Error
c) set() b) sorted() d) None
d) list() c) arrange() Answer: a
Answer: c d) order()
Answer: b Q52.
Q41. What is
len({10,20,30})? Q47. Which function S = {1,2,3,2}
a) 2 returns sum of numeric print(S)
b) 3 set elements?
a) {1,2,3,2} print(max(S)) Q62.
b) {1,2,3} a) 10
c) [1,2,3] b) 20 S = {1,2,3}
d) Error c) 30 S.clear()
Answer: b d) Error print(S)
Answer: c a) {}
Q53. b) set()
Q58. c) None
S = set() d) Error
print(type(S)) S = {10,20,30} Answer: b
a) <class 'dict'> print(sum(S))
b) <class 'set'> a) 60 Q63.
c) <class 'list'> b) 30
d) <class 'tuple'> c) Error S1 = {1,2,3}
Answer: b d) None S2 = {3,4,5}
Answer: a print(S1 | S2)
Q54. a) {1,2,3,4,5}
Q59. b) {3}
S = {} c) {1,2,3}
print(type(S)) S = {1,2,3} d) {}
a) <class 'set'> S.add(4) Answer: a
b) <class 'dict'> print(S)
c) <class 'list'> a) {1,2,3} Q64.
d) <class 'tuple'> b) {1,2,3,4}
Answer: b c) {4} S1 = {1,2,3}
d) Error S2 = {3,4,5}
Q55. Answer: b print(S1 & S2)
a) {1,2,3,4,5}
S = {1,2,3} Q60. b) {3}
print(len(S)) c) {}
a) 2 S = {1,2,3} d) {1,2}
b) 3 S.discard(5) Answer: b
c) 1 print(S)
d) Error a) {1,2,3,5} Q65.
Answer: b b) {1,2,3}
c) Error S1 = {1,2,3}
Q56. d) None S2 = {3,4,5}
Answer: b print(S1 - S2)
S = {10,20,30} a) {1,2}
print(min(S)) Q61. b) {3}
a) 10 c) {4,5}
b) 20 S = {1,2,3} d) {}
c) 30 print(S.pop()) Answer: a
d) Error a) 1
Answer: a b) 2 Q66.
c) 3
Q57. d) Any one element S1 = {1,2,3}
Answer: d S2 = {3,4,5}
S = {10,20,30} print(S1 ^ S2)
a) {1,2,4,5} S = {0,1,2} 🟦 Q76–Q100 → Error
b) {3} print(any(S)) Finding & Reasoning
c) {} a) True Q76.
d) {1,2,3,4,5} b) False
Answer: a c) Error S = {1,2,3}
d) None S[0]
Q67. Answer: a a) 1
b) Error
S1 = {1,2} Q72. c) None
S2 = {1,2,3,4} d) 2
print(S1.issubset(S2)) S = set("HELLO") Answer: b
a) True print(S)
b) False a) {'H','E','L','L','O'} Q77.
c) Error b) {'H','E','L','O'}
d) None c) ['H','E','L','O'] S = {1,2,3}
Answer: a d) Error S.add([4,5])
Answer: b a) {1,2,3,[4,5]}
Q68. b) Error
Q73. c) {1,2,3,4,5}
S1 = {1,2,3} d) None
S2 = {1,2} S = set([1,2,2,3]) Answer: b
print(S1.issuperset(S2)) print(S)
a) True a) {1,2,2,3} Q78.
b) False b) {1,2,3}
c) Error c) [1,2,3] S = {1,2,3}
d) None d) Error S.add((4,5))
Answer: a Answer: b print(S)
a) {1,2,3,(4,5)}
Q69. Q74. b) Error
c) {1,2,3,4,5}
S = {1,2,3} S = set() d) None
print(5 in S) print(len(S)) Answer: a
a) True a) 0
b) False b) 1 Q79.
c) Error c) None
d) None d) Error S = {1,2,3}
Answer: b Answer: a S.remove(5)
a) {1,2,3,5}
Q70. Q75. b) Error
c) {1,2,3}
S = {1,2,3} S = {1,2,3} d) None
print(all(S)) print(sorted(S)) Answer: b
a) True a) {1,2,3}
b) False b) [1,2,3] Q80.
c) Error c) (1,2,3)
d) None d) Error S = {1,2,3}
Answer: a Answer: b S.discard(5)
a) Error
Q71. b) {1,2,3}
c) {1,2,3,5} a) 1 print(S.remove(2,3))
d) None b) 2 a) {1}
Answer: b c) Error b) Error
d) None c) None
Q81. Answer: c d) {2,3}
Answer: b
S = {1,2,3} Q86.
S.update(4) Q91.
a) {1,2,3,4} S = {1,2,3}
b) Error print(S.count(2)) S = {1,2,3}
c) None a) 1 print(S.union(2))
d) [1,2,3,4] b) 2 a) {1,2,3,2}
Answer: b c) Error b) Error
d) None c) None
Q82. Answer: c d) {1,2,3}
Answer: b
S = {1,2,3} Q87.
S.update([4,5]) Q92.
print(S) S = {1,2,3}
a) {1,2,3,4,5} print(S[1:2]) S = {1,2,3}
b) Error a) {2} print(S.difference())
c) [1,2,3,4,5] b) Error a) {1,2,3}
d) None c) None b) {}
Answer: a d) [2] c) Error
Answer: b d) None
Q83. Answer: a
Q88.
S = {1,2,3} Q93.
print(S + {4,5}) S = {1,2,3}
a) {1,2,3,4,5} S.clear(2) S = {1,2,3}
b) Error a) {1,3} print(S.symmetric_diffe
c) None b) {} rence())
d) [1,2,3,4,5] c) Error a) {1,2,3}
Answer: b d) None b) {}
Answer: c c) Error
Q84. d) None
Q89. Answer: a
S = {1,2,3}
print(S*2) S = {1,2,3} Q94.
a) {1,2,3,1,2,3} del S[0]
b) Error a) {2,3} S = {1,2,3}
c) None b) Error print(S.add())
d) [1,2,3,1,2,3] c) None a) {1,2,3,None}
Answer: b d) {1,2,3} b) {1,2,3}
Answer: b c) Error
Q85. d) None
Q90. Answer: c
S = {1,2,3}
print(S.index(2)) S = {1,2,3} Q95.
S = {1,2,3} S = {1,2,3} Python Dictionaries
print(S.pop(2)) print(10 not in S)
a) 2 a) True Q1–Q25 → Concepts /
b) Error b) False Theory
c) None c) Error
d) {1,3} d) None Q1. A dictionary in
Answer: b Answer: a Python is:
a) Ordered collection of
Q96. elements
b) Key-value pair
S = {1,2,3} collection
print(S.update(1,2)) c) Only keys
a) {1,2,3} d) Only values
b) Error Answer: b
c) None
d) {1,2} Q2. Dictionary keys
Answer: b must be:
a) Mutable
Q97. b) Immutable
c) Lists
S = {1,2,3} d) Any data type
print(S |= {4,5}) Answer: b
a) {1,2,3,4,5}
b) Error Q3. Dictionary values
c) None can be:
d) [1,2,3,4,5] a) Only strings
Answer: a b) Only numbers
c) Any data type
Q98. d) Only lists
Answer: c
S = {1,2,3}
print(S <= {1,2,3,4}) Q4. Which of these is a
a) True valid dictionary?
b) False a) {1,2,3}
c) Error b) {1:"one", 2:"two"}
d) None c) [1:"one", 2:"two"]
Answer: a d) (1:"one", 2:"two")
Answer: b
Q99.
Q5. Duplicate keys in a
S = {1,2,3} dictionary:
print(S >= {1,2}) a) Allowed
a) True b) Not allowed
b) False c) Error
c) Error d) Both a and c
d) None Answer: b
Answer: a
Q6. Keys in a
Q100. dictionary are:
a) Unique Q12. Dictionary c) count()
b) Duplicated preserves insertion d) length()
c) Optional order from Python Answer: a
d) None version:
Answer: a a) 2.7 Q18. Which method
b) 3.6+ returns default if key
Q7. Which of the c) 3.4 not found?
following is a d) 3.2 a) get()
dictionary? Answer: b b) keys()
a) {"a":1, "b":2} c) values()
b) {"a",1,"b",2} Q13. Dictionary items d) items()
c) [("a",1),("b",2)] are accessed using: Answer: a
d) {"a","b"} a) Index numbers
Answer: a b) Keys Q19. Which method
c) Random order removes and returns
Q8. Dictionary is d) Position only item?
implemented internally Answer: b a) popitem()
using: b) pop()
a) Array Q14. Which method c) del
b) Stack returns dictionary d) remove()
c) Hash table keys? Answer: a
d) Queue a) values()
Answer: c b) keys() Q20. Which keyword is
c) items() used to delete a
Q9. Which symbol is d) get() dictionary key?
used for dictionary Answer: b a) del
literals? b) remove
a) [] Q15. Which method c) discard
b) () returns dictionary d) delete
c) {} values? Answer: a
d) <> a) values()
Answer: c b) keys() Q21. Can a dictionary
c) items() have list as a key?
Q10. Empty dictionary d) get() a) Yes
is written as: Answer: a b) No
a) {} c) Sometimes
b) [] Q16. Which method d) Only if empty
c) set() returns key-value Answer: b
d) None pairs?
Answer: a a) values() Q22. Can a dictionary
b) keys() have tuple as a key?
Q11. The function to c) items() a) Yes
create a dictionary is: d) get() b) No
a) dict() Answer: c c) Error
b) set() d) Never
c) list() Q17. Which function Answer: a
d) tuple() returns number of
Answer: a items in dictionary? Q23. Default return of
a) len() popitem() is:
b) size() a) First key-value pair
b) Last inserted key- b) clone() Q34. Which method
value pair c) deepcopy() returns view of
c) Random pair d) duplicate() dictionary keys?
d) None Answer: a a) keys()
Answer: b b) values()
Q29. Which method c) items()
Q24. Which method creates dictionary with d) all()
merges two default value? Answer: a
dictionaries? a) fromkeys()
a) update() b) newdict() Q35. Which method
b) extend() c) setdefault() returns view of
c) join() d) update() dictionary values?
d) merge() Answer: a a) keys()
Answer: a b) values()
Q30. Which method c) items()
Q25. The membership inserts key with default d) get()
operator works on: if not present? Answer: b
a) Keys only a) setdefault()
b) Values only b) fromkeys() Q36. Which method
c) Keys and values c) update() returns key-value pairs
d) None d) copy() as tuples?
Answer: a Answer: a a) items()
b) values()
Q26–Q50 → Q31. Which method c) keys()
Dictionary Methods merges one dictionary d) get()
& Operations into another? Answer: a
a) update()
b) join() Q37. Which method is
Q26. Which method
c) merge() used to safely get value
removes a key and
d) combine() of a key?
returns its value?
Answer: a a) get()
a) pop()
b) values()
b) popitem()
Q32. What does c) keys()
c) remove()
dict1.update(dict2) do? d) index()
d) del
a) Adds dict2 to dict1 Answer: a
Answer: a
b) Deletes dict1
c) Returns new dict Q38. What happens if
Q27. Which method
d) Clears dict1 we use pop(key) on
removes all dictionary
Answer: a missing key?
items?
a) None
a) delete()
Q33. Which function b) Error
b) clear()
returns all dictionary c) Deletes all
c) reset()
methods? d) Ignores
d) discard()
a) dir(dict) Answer: b
Answer: b
b) help(dict)
c) dict.methods() Q39. What happens if
Q28. Which method
d) functions(dict) we use get(key) on
returns shallow copy of
Answer: a missing key?
a dictionary?
a) None
a) copy()
b) Error
c) Deletes all Q45. Which operator is d) list()
d) Ignores used to check key Answer: a
Answer: a membership?
a) in Q51–Q75 → Output
Q40. Which method b) of Prediction
returns dict from c) contains
sequence of keys? d) is
Q51.
a) fromkeys() Answer: a
b) setdefault()
d = {"a":1, "b":2}
c) update() Q46. What does
print(len(d))
d) copy() dict.clear() return?
Answer: a a) {}
b) None a) 1
c) Error b) 2
Q41. Which method
d) True c) 3
removes last inserted
Answer: b d) Error
key-value pair?
Answer: b
a) pop()
b) popitem() Q47. What does
c) remove() dict.copy() return? Q52.
d) del a) New dictionary
Answer: b b) Same reference d = {"a":1, "b":2}
c) None print(d["a"])
Q42. Which method d) Error
checks existence of key Answer: a a) 1
in dictionary? b) a
a) in Q48. Which statement c) Error
b) has() deletes dictionary d) None
c) contains() completely? Answer: a
d) exists() a) del dict
Answer: a b) dict.clear() Q53.
c) dict.delete()
Q43. Which method d) dict.remove() d = {"a":1, "b":2}
sets default if key not Answer: a print(d.get("c"))
present?
a) setdefault() Q49. Which method a) Error
b) fromkeys() returns all dictionary b) None
c) update() items? c) "c"
d) copy() a) items() d) {}
Answer: a b) keys() Answer: b
c) values()
Q44. Which method d) all() Q54.
updates value if key Answer: a
exists? d = {"a":1, "b":2}
a) update() Q50. Which method print("a" in d)
b) setdefault() returns list of all
c) append() values? a) True
d) insert() a) values() b) False
Answer: a b) keys() c) Error
c) items() d) None
Answer: a
Q55. a) {"a":1} d) Error
b) {"a":1,"b":2} Answer: a
d = {"a":1, "b":2} c) {"b":2}
print("c" in d) d) Error Q64.
Answer: b
a) True d=
b) False Q60. dict.fromkeys(["x","y"],
c) Error 0)
d) None d = {"a":1} print(d)
Answer: b d["a"]=10
print(d) a) {"x":0,"y":0}
Q56. b) {"x":None,"y":None}
a) {"a":1} c) ["x","y"]
d = {"a":1, "b":2} b) {"a":10} d) Error
print(list(d.keys())) c) {"a":1,"a":10} Answer: a
d) Error
a) ["a","b"] Answer: b Q65.
b) [1,2]
c) [("a",1),("b",2)] Q61. d = {"a":1,"b":2}
d) None print("c" not in d)
Answer: a d = {"a":1,"b":2}
print(d.pop("a")) a) True
Q57. b) False
a) "a" c) Error
d = {"a":1, "b":2} b) 1 d) None
print(list(d.values())) c) {"b":2} Answer: a
d) Error
a) ["a","b"] Answer: b Q66.
b) [1,2]
c) [("a",1),("b",2)] Q62. d = {"a":1,"b":2}
d) None print(d.get("c",5))
Answer: b d = {"a":1,"b":2}
print(d.popitem()) a) 5
Q58. b) None
a) ("a",1) c) Error
d = {"a":1, "b":2} b) ("b",2) d) "c"
print(list(d.items())) c) Random Answer: a
d) Error
a) ["a","b"] Answer: b Q67.
b) [1,2]
c) [("a",1),("b",2)] Q63. d = {"a":1}
d) None print(d.setdefault("b",2)
Answer: c d = {"a":1,"b":2} )
d.clear()
Q59. print(d) a) 2
b) None
d = {"a":1} a) {} c) Error
d["b"]=2 b) {"a":1,"b":2} d) {"a":1,"b":2}
print(d) c) None Answer: a
Q68. for v in d.values(): print(d["c"])
print(v)
d = {"a":1} a) None
d.update({"b":2}) a) a b b) Error
print(d) b) 1 2 c) 0
c) ("a",1),("b",2) d) {}
a) {"a":1} d) Error Answer: b
b) {"a":1,"b":2} Answer: b
c) {"b":2} Q77.
d) Error Q73.
Answer: b d = {"a":1}
d = {"a":1,"b":2} d.add("b")
Q69. for k,v in d.items():
print(k,v) a) {"a":1,"b":None}
d = {"a":1} b) Error
print(len(d)) a) a 1 b 2 c) {"a":1}
b) 1 a 2 b d) None
a) 0 c) {"a":1,"b":2} Answer: b
b) 1 d) Error
c) 2 Answer: a Q78.
d) Error
Answer: b Q74. d = {"a":1}
print(d.keys(0))
Q70. d = {"x":5,"y":10}
print(sum(d.values())) a) dict_keys(["a"])
d = {"a":1,"b":2} b) Error
print(type(d)) a) 5 c) ["a"]
b) 10 d) None
a) <class 'list'> c) 15 Answer: b
b) <class 'tuple'> d) Error
c) <class 'dict'> Answer: c Q79.
d) <class 'set'>
Answer: c Q75. d = {"a":1}
print(d.values(1))
Q71. d = {"x":5,"y":10}
print(min(d)) a) dict_values([1])
d = {"a":1,"b":2} b) Error
for k in d: a) x c) [1]
print(k) b) y d) None
c) 5 Answer: b
a) a b d) Error
b) 1 2 Answer: a Q80.
c) ("a",1),("b",2)
d) Error Q76–Q100 → Error d = {"a":1}
Answer: a Finding & Reasoning print(d.items(2))

Q72. Q76. a) dict_items([("a",1)])


b) Error
d = {"a":1,"b":2} d = {"a":1,"b":2} c) [("a",1)]
d) None d = {"a":1} Q91.
Answer: b print(d + {"b":2}) d = {"a":1}
print(1 in d.values())
Q81. a) {"a":1,"b":2} a) True
b) Error b) False
d = {"a":1} c) None c) Error
del d["b"] d) {} d) None
Answer: b Answer: a
a) Deletes b Q92.
b) Error Q86. d = {"a":1}
c) None print("b" in d.keys())
d) Ignores d = {"a":1} a) True
Answer: b print(d * 2) b) False
a) {"a":1,"a":1} c) Error
Q82. b) Error d) None
c) None Answer: b
d) {} Q93.
d = {"a":1}
Answer: b d = {"a":1}
print(d.get())
Q87. print(list(d))
d = {"a":1} a) ["a"]
a) None
print(d[0]) b) [1]
b) Error
a) "a" c) [("a",1)]
c) {}
b) 1 d) None
d) 0
c) Error Answer: a
Answer: b
d) None Q94.
Answer: c d = {"a":1}
Q83. print(len(d.keys()))
Q88.
d = {"a":1} a) 1
d = {"a":1} b) 0
print(d.count("a"))
print(d.pop()) c) Error
a) 1
b) 0 d) None
a) 1 Answer: a
c) Error
b) Error Q95.
d) None
c) None d = {"a":1}
Answer: c
d) {} print(len(d.values()))
Q89.
Answer: b a) 1
d = {"a":1}
print("a" not in d) b) 0
Q84. a) True c) Error
b) False d) None
d = {"a":1} c) Error Answer: a
print(d.popitem(0)) d) None Q96.
Answer: b d = {"a":1}
a) ("a",1) Q90. print(len(d.items()))
b) Error d = {"a":1} a) 1
c) None print("a" in d.values()) b) 0
d) {} a) True c) Error
Answer: b b) False d) None
c) Error Answer: a
Q85. d) None Q97.
Answer: b d = {"a":1}
print(type(d.keys()))
a) list
b) dict_keys
c) tuple
d) Error
Answer: b
Q98.
d = {"a":1}
print(type(d.values()))
a) list
b) dict_values
c) tuple
d) Error
Answer: b
Q99.
d = {"a":1}
print(type(d.items()))
a) list
b) dict_items
c) tuple
d) Error
Answer: b
Q100.
d = {"a":1}
print(isinstance(d,dict))
a) True
b) False
c) Error
d) None
Answer: a

You might also like