You are on page 1of 9

CHAPTER IV – DATA STRUCTURES

I. Choose the following:

1. __________ are a particular way of organizing data in a computer so that it can be used effectively.

a. Data structure b. Data Organization c. Data constructor d. Data builder

2. Python has ____________ basic inbuilt data structures.

a. 1 b. 2 c3 d. 4

3. List and tuples can contain _______ type of objects.

a. integer b. float c. string d. any

5. _________ is an ordered collection of values and are mutable.

a. String b. Set c. List d. all the above

6. ___________ allows duplicate values

a. String b. Set c. List d. all the above

7. In list values are given within ___________ bracket.

a. parenthesis b. square c. curly d. double curly

8. Each value in a list is called ___________.

a. argument b. parameter c. element d. list value

9. A list inside another list is called ________________.

a. nested list b. inside list c. double list d. pair list

10. Python assigns an automatic index value for each of the list beginning from ___________.

a. 10 b. 0 c. 1 d. default

11. lst_empty=[ ] this list is called ___________ list.

a. empty b. no value c. garbage d. space

12. rollno = [12101,12102,12103,12104] This list contains ___________ no of elements.

a. 1 b. 2 c. 3 d. 4

13. The element of a list can be accessed with the ________ value.

a. index b. subscript c. element d. both a and b

14. We can change a single element or a range of elements in a list using __________ operator.

a. equality b. assignment c. == d. both b and c


15. __________ function returns the number of elements in a list.

a. len() b. length() c. leng() d. leg()

16. The append() function is used to add a single element at the _________ of the list as the last element.

a. first b. middle c. end d. first or last

17. The __________ function is used to insert an element into the list at a specific position.

a. insrt() b. insert() c. in() d. put()

18. The __________ function is used to insert multiple elements at the end of the list.

a. insert() b. extend() d. append() d. both b and c

19. The ________ function deletes a specific element from the list.

a. del() b. delete c. remove() d. rem()

20. The _________ function is used to remove the last element from the list.

a. remove() b. pop() c. delete() d. clear()

21. The __________ command is used to delete the element with a specific index or can be used to delete a group of
elements from the range of index specified.

a. del b. delete c. clear d. remove

21. The __________ function is used to remove all the elements from the list.

a. remove() b. pop() c. delete() d. clear()

22. The index() function returns the _____________ value of the first occurrence of the search element.

a. index b. element number c. list d. sum

23. The copy( ) function is used to __________ all the elements of a list into another list.

a. paste b. send c. copy d. duplicate

24. In python we can copy the existing list to another list by the following ______ methods.

a. 1 b. 2 c. 3 d. 4

25. The __________ function is used to count and return the number of occurrences of a particular element in the
list.

a. count( ) b. occur( ) c. len() d. clear()

26. The __________ function is used to reverse the order of the elements in a list.

a. rev() b. reverse() c. revs() d. rever()


27. The _________ function is used to arrange the elements of the list in either ascending or descending order.

a. order() b. reverse() c. sort() d. asc()

28. The default sort order is ____________.

a. descending b. ascending c. no order d. both a and b

29. If we want the list in descending order, we have to use the argument ____________ with the value ‘True’.

a. reverse b. order c. ascending d. descending

30. A list can be added with another list by using the __________ operator.

a. = b. * c. ^ d. +

31. __________ operator acts as an extend function where the second list is added at the end of the first list.

a. + b. - c. * d. /

32. ___________ function returns the minimum value from the list.

a. max() b. min() c. sum() d. range()

33. ________ and ________ function works on the list that have elements of character data type. The elements will
occupy the first position and last position if the list is sorted in ascending order.

a. min ( ) & max() b. min( ) & sum() c. max() & sum() d. sum() & range()

34. ____________ function returns the maximum value from the list.

a. min() b. sum() c. max() d. range()

35. ___________ function returns the sum of all the elements of the list.

a. min() b. sum() c. max() d. range()

36. A list can be created with the ___________ function and the _________ function combined together.

a. min() & max() b. max() & sum() c. min() & max() d. list() & range()

36. The __________ function is used to convert the values generated by the range function into a list.

a. list() b. range() c. sum() d. listrange()

37. List can also be created with elements based on an expression and a range. This is called _____________.

a. range comprehension b. list comprehension c. comprehension d. comparison

38. In list comprehension, the expression and the range has to be given within _______ brackets.

a. curly b. parenthesis c. square d. either a or c


39. The __________ function returns the data type of the value or the variable given as argument.

a. datatype() b. data() c. type() d. all the above

40. ____________ is an ordered collection of data which are unchangeable.

a. list b. tuple c. set d. dictionary

41. The __________ is an ordered collection of data which allows duplication.

a. list b. tuple c. set d. dictionary

42. The elements of the tuples are given within _________ separated by comma.

a. curly b. parenthesis c. square d. either a or b

43. The tuple with a single element is called ________________ tuple.

a. single element b. one element c. oneton d. singleton

44. A tuple can be created with the ___________ function and __________ function combined together.

a. list and range b. tuple and range c. set and range d. range and sum

45. A tuple defined within another tuple is called __________ tuple.

a. nested b. within c. one inside another d. combined

46. The elements of a tuple can be accessed by its ____________ number.

a. element b. position c. index d. value

47. We can delete the entire tuple using _______ keyword.

a. delete b. remove c. ignore d. del

48. The sum(), min() and max() functions only works with tuples conataining ____________.

a. alphabets b. numbers c. symbols d. operators

49. __________ is an unordered collection of data which is unindexed.

a. list b. tuple c. set d. dictionary

50. __________ contains duplicate values and it is mutable.

a. list b. tuple c. set d. dictionary

51. A set can be created by placing the elements within ________ bracket.

a. square b. parenthesis c. double square d. set

52. We can use the ___________ function to create set from a list or a tuple.

a. set() b. list() c. tuple() d. create_set()


53. The __________ function is used to add a single element to the set.

a. place() b. create() c. add() d. both a and b

54. The __________ function is used to add more number of elements to the set.

a. add() b. update() c. create() d. construct()

55. The remove() and discard() functions are used to remove __________ element from the set.

a. single b. double c. triple d. 4

56. The ___________ function will remove a random element from the set.

a. pop() b. remove() c. discard() d. erase()

57. The __________ function removes the elements from the set and will retain the empty set.

a. del() b. remove() c . clear() d. discard()

56. The ___________ function will delete the set completely along with its element.

a. del() b. remove() c . clear() d. discard()

57. The operator used for union is _____________.

a. | b. @ c. U d. 

58. Performing _____________ operation between two sets will create a new set with all the elements available in
both the sets excluding duplicate elements.

a. union b. symmetric difference c. difference d. intersection

59. To perform union operation we can use pipeline (|) operator and ___________ function.

a. union() b. join() c. add() d. intersect()

60. The ____________ operator is used to perform intersection operation.

a.  b.  c. & d. $

61. Performing ___________ operation between two sets will create a new set with all the common elements
available in both the sets.

a. union b. symmetric difference c. difference d. intersection

62. To perform the intersection operation between two sets, we can use the ampersand (&) and _______ function.

a. union() b. join() c. common() d. intersect()

63. Performing ___________ operation between two sets will create a new set with all the elements available in the
first sets which are not in the second.

a. union b. symmetric difference c. difference d. intersection


64. The operator used for difference operation is _____________.

a. + b. - c.  d. $

65. To perform the difference operation between two sets, we have to use the minus(-) operator and __________
function.

a. union() b. difference() c. common() d. intersect()

66. Performing _____________ operation between two sets will create a new set with all the elements available in
both the sets excluding the common elements in both sets.

a. union b. symmetric difference c. difference d. intersection

67. The operator used for symmetric difference operation is ____________.

a. ^ b. - c.  d. $

68. To perform symmetric difference operation between two sets we can use caret(^) operator and _________
function.

a. union() b. join() c. symmetric_difference() d. intersect()

69. ____________ is an unordered, mixed collection of elements which are indexed and are changeable.

a. list b. tuple c. set d. dictionary

70. ___________ and _____________ cannot have duplicate values.

a. List and tuples b. Set and dictionary c. Tuple and dictionary d. list and set

71. In python dictionaries are written with ____________ brackets.

a. square b. parenthesis c. curly d. set

72. __________ have keys and elements.

a. list b. tuple c. set d. dictionary

73. In dictionary, the key along with the element is called a __________ pair.

a. element value b. key value c. dictionary value d. both b and c

74. In dictionary, the key value pairs are enclosed with the _____ brackets.

a. square b. parenthesis c. curly d. set

75. In dictionary, the ___________ must be unique and case sensitive.

a. key b. element c. values d. set

76. We can access the elements from the dictionary by using the ________ within the square brackets.

a. key b. element c. values d. index


77. The _________ function removes all the key value pairs from the dictionary and will retain the empty dictionary.

a. del() b. remove() c . clear() d. discard()

78. The del() function will delete the _________ dictionary completely along with its key value pairs..

a. specified b. indexed c. key value d. entire

79. The __________ function removes the item with the specified key name from the dictionary.

a. popitem() b. pop() c. remove() d. del()

80. The __________ function removes the last item from the dictionary.

a. popitem() b. pop() c. remove() d. del()

II. Fill in the blanks:

81. In nested list one of elements of the list is a ____________.[list]

82. The index value for each element of the list begins from _________. [zero]

83. Python assigns an __________ index value for each element of the list beginning from zero. [automatic]

84. After reversing the elements in the list using reverse() function, the ___________ order cannot be restored.
[original]

85. When the output of the range() function is taken as input for the list() function, this is called __________.
[composition]

86. The word immutable means ____________. [unchangeable]

87. The elements of the tuple are given within parenthesis(()) separated by ___________. [comma]

88. The tuple with single element is called ______________ tuple. [singleton]

89. The __________ function is used to add a single element to the set. [add()]

90. xyz={‘rollno’:12101,’name’:parthiban}. This is a __________. [dictionary]

91. list1={1,2,3,4,5}. This is a ___________. [set]

92. ________ are written with curly bracket and they have keys and elements. [ Dictionaries]

IV. Match the following based on the given list:

list1=[45,65,78,45,98,12,30,45,56]

93. print(list1.index(78)) - 474

94. print(max(list1)) - 9

95. print(min(list1)) - 3

96. print(sum(list1)) - [45,65,78,45,98,12,30,45,56]


97. print(len(list1)) - 12

98. print(list1) - 2

99. list1.pop() - 56

100. print(list1.count(45)) - 98

III. Write true or false:

101. Pop() function will know which item gets remove from the set. False

102. After reversing the elements in the list using reverse() function, the original order cannot be restored. True

103. min() function returns the maximum value from the list. [False]

104. In sort function, the default sort order is ascending. [True]

105. In python, the sum function works on both numbers and alphabets. [False]

106. The count() function is used to count and return the number of occurrence of a particular element in the list.
[True]

107. In python, A set is immutable. [False]

108. In python, the operator used for union operation is . [False]

109. The add() function is used to find the sum of all the elements in the list. [False]

110. The discard() function is used to remove a single element from the set. [True]

You might also like