This quiz works best with JavaScript enabled. Home > Cbse > Class 12 > Science > Computer Science > Class 12 Computer Science Chapter 1 Data Structures Using Python – Quiz 12 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 12 Computer Science Chapter 1 Data Structures Using Python Quiz 12 (60 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. If the elements P, W, S, D are placed in a stack and are deleted one at a time, what is the order of removal? A) PDWS. B) DSWP. C) DWSP. D) PWSD. Show Answer Correct Answer: B) DSWP. 2. What does the return statement do in a Python function?Criterion 2:Apply reasoning to solve real-world problems in various contexts A) It sends a result back to the function. B) It loops through the function. C) 'return' terminates the function and sends a result back. D) It skips the function. Show Answer Correct Answer: C) 'return' terminates the function and sends a result back. 3. The maximum number of nodes in a binary tree of depth 5 is A) 31. B) 32. C) 15. D) 16. Show Answer Correct Answer: A) 31. 4. Push() and pop() functions are found in ..... A) Lists. B) Stacks. C) Trees. D) Queues. Show Answer Correct Answer: B) Stacks. 5. Which among the following sorting algorithm is the most optimal one to sort a random linked list? A) Heap sort. B) Merge sort. C) Insertion sort. D) Quick sort. Show Answer Correct Answer: B) Merge sort. 6. To represent hierarchical relationship between elements, which data structure is suitable? A) Dequeue. B) Tree. C) Priority. D) Graph. Show Answer Correct Answer: B) Tree. 7. Finding the location of a given item in a collection of items is called ..... A) Discovering. B) Finding. C) Mining. D) Searching. Show Answer Correct Answer: D) Searching. 8. Which of the following is an advantage of using functions in Python?Criterion 1:Evaluate and select information sources based on their appropriateness to specific tasks A) They make code longer. B) They allow you to reuse code efficiently. C) They make the code harder to debug. D) They increase the risk of errors in the program. Show Answer Correct Answer: B) They allow you to reuse code efficiently. 9. How do you create a set in Python? A) Defining a dictionary with curly braces, e.g., {key:value}. B) Using square brackets, e.g., [1, 2, 3]. C) Creating a list with list() function. D) You can create a set in Python using set() or by using curly braces, e.g., set() or {1, 2, 3}. Show Answer Correct Answer: D) You can create a set in Python using set() or by using curly braces, e.g., set() or {1, 2, 3}. 10. What is an array in data structure theory? A) A data structure only used in Python. B) A data structure that stores multiple items of different data types. C) A data structure that stores multiple items of the same type. D) A data structure that only stores numeric data types. Show Answer Correct Answer: C) A data structure that stores multiple items of the same type. 11. What are the 3 depth traversals for a tree data structure? A) Pre-, In-and Post-order. B) Pro-, In-and Past-order. C) Pre-, Out-and Post-order. D) Pre-, In-and New-order. Show Answer Correct Answer: A) Pre-, In-and Post-order. 12. Which operator is used for checking if two values are equal in Python? A) !=. B) =. C) ==. D) Is. Show Answer Correct Answer: C) ==. 13. Describe how to traverse a binary tree in order. A) Post-order traversal visits nodes in the order:right subtree, root, left subtree. B) Level-order traversal visits nodes in the order:top to bottom, left to right. C) In-order traversal visits nodes in the order:left subtree, root, right subtree. D) Pre-order traversal visits nodes in the order:root, left subtree, right subtree. Show Answer Correct Answer: C) In-order traversal visits nodes in the order:left subtree, root, right subtree. 14. ..... is a data structure in which every individual node consists of INFO to store data and LINK to store the address of the next node. A) Circular queue. B) Singly Linked List. C) Stack. D) Queue. Show Answer Correct Answer: B) Singly Linked List. 15. The algorithms like merge sort, quick sort and binary search are based on A) Greedy algorithm. B) Divide and Conquer algorithm. C) Hash table. D) Parsing. Show Answer Correct Answer: B) Divide and Conquer algorithm. 16. Go to statement is the part of ..... A) Conditional statement. B) Unconditional statement. C) None of the above. D) None of the above. Show Answer Correct Answer: A) Conditional statement. 17. Given an empty AVL tree, how would you construct AVL tree when a set of numbers are given without performing any rotations? A) Just build the tree with the given input. B) Find the median of the set of elements given, make it as root and construct the tree. C) Use trial and error. D) Use dynamic programming to build the tree. Show Answer Correct Answer: B) Find the median of the set of elements given, make it as root and construct the tree. 18. Can I add any data type to a tuple A) Yes, they are the same as a python list, however immutable after creation. B) No, all of the elements in the tuple have to be the same datatype. C) All the above. D) None of the above. Show Answer Correct Answer: A) Yes, they are the same as a python list, however immutable after creation. 19. An array elements are always stored in ..... memory locations. A) Sequential. B) Random. C) Sequential and Random. D) None of the above. Show Answer Correct Answer: A) Sequential. 20. Python has true 2-dimensional arrays?True or False? A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: B) False. 21. In a max-heap, element with the greatest key is always in the which node? A) First node of left sub tree. B) First node of right sub tree. C) Leaf node. D) Root node. Show Answer Correct Answer: D) Root node. 22. How do you iterate over a dictionary in Python? A) For key in my dict.keys():# iterates over keys only. B) For item in my dict:# iterates over items. C) For key in my dict:# iterates over keysfor value in my dict.values():# iterates over valuesfor key, value in my dict.items():# iterates over key-value pairs. D) For entry in my dict.items():# iterates over entries. Show Answer Correct Answer: C) For key in my dict:# iterates over keysfor value in my dict.values():# iterates over valuesfor key, value in my dict.items():# iterates over key-value pairs. 23. Under which data structure category does the Stack fall? A) Built-in. B) Linear. C) Non linear. D) Homogeneous. Show Answer Correct Answer: B) Linear. 24. How do you create a dictionary? A) Use curly braces with key-value pairs, e.g., {'key':'value'}. B) Define a dictionary with a colon, e.g., 'key':'value'. C) Use square brackets with key-value pairs, e.g., ['key':'value']. D) Create a dictionary using parentheses, e.g., ('key', 'value'). Show Answer Correct Answer: A) Use curly braces with key-value pairs, e.g., {'key':'value'}. 25. What is a list in Python and how is it different from a tuple? A) Both lists and tuples are mutable and can be changed. B) A list is immutable and cannot be changed, while a tuple is mutable and can be changed. C) A list is mutable and can be changed, while a tuple is immutable and cannot be changed. D) A list can only contain integers, while a tuple can contain any data type. Show Answer Correct Answer: C) A list is mutable and can be changed, while a tuple is immutable and cannot be changed. 26. Which is an entity? A) Roll. B) Name. C) Age. D) Student. Show Answer Correct Answer: D) Student. 27. Queue follows ..... order A) FIFO (First In First Out ). B) LIFO (Last In First Out). C) Random. D) FILO(First In Last Out). Show Answer Correct Answer: A) FIFO (First In First Out ). 28. Quick sort follows Divide-and-Conquer strategy. A) A) True. B) B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) A) True. 29. What is the best data structure for implementing a priority queue? A) Linked list. B) Heap. C) Stack. D) Queue. Show Answer Correct Answer: B) Heap. 30. Which of the following algorithms is not feasible to implement in a linked list? A) Insertion Sort. B) Binary Search. C) Quick Sort. D) Heap Sort. Show Answer Correct Answer: B) Binary Search. 31. (A):Items of stack are inserted at top end.(B):Items of queue are inserted from front end. A) Both A and B are true. B) Only A is true. C) Only B is true. D) Both A and B are false. Show Answer Correct Answer: B) Only A is true. 32. What is the syntax for creating a set in Python? A) {key:value}. B) [value1, value2, ]. C) {value1, value2, }. D) (value1, value2, ). Show Answer Correct Answer: C) {value1, value2, }. 33. Are python lists ordered? A) Yes, they are ordered. B) No, they are not. C) Idk man. D) None of the above. Show Answer Correct Answer: A) Yes, they are ordered. 34. B-tree of order n is a order-n multiway tree in which each non-root node contains ..... A) Exact (n-1)/2 keys. B) At least (n-1)/2 keys. C) At least 2n keys. D) At most (n-1)/2 keys. Show Answer Correct Answer: B) At least (n-1)/2 keys. 35. What is a nested data structure in Python? A) A nested data structure in Python is a data structure that can only contain strings. B) A nested data structure in Python is a data structure that can only contain integers. C) A nested data structure in Python is a data structure that can contain other data structures within it. D) A nested data structure in Python is a data structure that can only contain booleans. Show Answer Correct Answer: C) A nested data structure in Python is a data structure that can contain other data structures within it. 36. For the 'Removing VOWELS' activity that uses 'char()' and 'Operator(+=)', what is the most logical sequence of operations? A) Sort characters alphabetically, then remove vowels. B) Check each character, if not a vowel, add to result string. C) Remove all characters first, then add back consonants. D) Convert to numbers, perform arithmetic, convert back. Show Answer Correct Answer: B) Check each character, if not a vowel, add to result string. 37. What is the result of pop(x) operation on the stack? A) Add x to the stack. B) Removes x from top of stack. C) Removes x from bottom of stack. D) Add x to top of stack. Show Answer Correct Answer: B) Removes x from top of stack. 38. What is the result of slicing a list using [2:5]? A) The result of slicing a list using [2:5] is a single element at index 2. B) The result of slicing a list using [2:5] is a new list containing the elements at index 2, 3, 4, and 5. C) The result of slicing a list using [2:5] is an empty list. D) The result of slicing a list using [2:5] is a new list containing the elements at index 2, 3, and 4. Show Answer Correct Answer: D) The result of slicing a list using [2:5] is a new list containing the elements at index 2, 3, and 4. 39. Process of inserting an element in stack is called ..... A) Evaluation. B) Push. C) Pop. D) Create. Show Answer Correct Answer: B) Push. 40. How can you use comprehension to create a set from a list? A) Use set comprehension:{item for item in my list}. B) Create a set using:set(my list). C) Use list comprehension:[item for item in my list]. D) Transform with:{item:item for item in my list}. Show Answer Correct Answer: A) Use set comprehension:{item for item in my list}. 41. Which data structure is the collection of nodes? A) Stack. B) Queue. C) Array. D) Linked List. Show Answer Correct Answer: D) Linked List. 42. In algorithm assignment operation is performed using the symbol ..... A) ==. B) :=. C) =. D) ++. Show Answer Correct Answer: B) :=. 43. In the 'Finding Sum of Array' activity, why would you use len() function within your custom function? A) To convert the array to a string. B) To sort the array elements. C) To determine how many elements to iterate through. D) To find the maximum value. Show Answer Correct Answer: C) To determine how many elements to iterate through. 44. Which of the following statement about binary tree is CORRECT? A) Every binary tree is either complete or full. B) Every complete binary tree is also a full binary tree. C) Every full binary tree is also a complete binary tree. D) A binary tree cannot be both complete and full. Show Answer Correct Answer: C) Every full binary tree is also a complete binary tree. 45. ..... operation removes the element from the top of the stack. A) Push. B) Pop. C) Update. D) None of the above. Show Answer Correct Answer: B) Pop. 46. In the following list, which item has the index number 3?["John", "Harry", "Jesse", "John", "Jairus", "Hamza"] A) "Jairus". B) "Jesse". C) "Harry". D) "John". Show Answer Correct Answer: D) "John". 47. Which one of the following node is considered the top of the stack if the stack is implemented using the linked list? A) First node. B) Second node. C) Third node. D) None of the above. Show Answer Correct Answer: A) First node. 48. Which traversal of a binary tree visits nodes in the following order:left, right, root? A) Level-order. B) Post-order. C) Pre-order. D) In-order. Show Answer Correct Answer: B) Post-order. 49. If node N is a terminal node in a binary tree then its ..... A) Right tree is empty. B) Left tree is empty. C) Both left & right sub trees are empty. D) Root node is empty. Show Answer Correct Answer: C) Both left & right sub trees are empty. 50. Can sets contain duplicate elements? A) Yes, sets can contain duplicate elements. B) Sets can contain only one element. C) No, sets cannot contain duplicate elements. D) Sets can contain elements of different data types. Show Answer Correct Answer: C) No, sets cannot contain duplicate elements. 51. For a given graph G having v vertices and e edges which is connected and has no cycles, which of the following statements is true? A) V=e. B) V = e-1. C) V = e+1. D) V + 1 = e. Show Answer Correct Answer: C) V = e+1. 52. What would be the output after performing the following operations in a Deque?Insertfront(10); Insertfront(20); Insertrear(30); Insertrear(40); Deletefront(); Insertfront(50); Deleterear(); Display(); A) 10, 20, 30. B) 50, 10, 30. C) 40, 20, 30. D) None of the above. Show Answer Correct Answer: B) 50, 10, 30. 53. How do you create a set in Python and what are its unique properties? A) You create a set in Python using set() or {}. Unique properties include being unordered and containing only unique elements. B) Sets are ordered collections of items. C) You create a set using list() or []. D) Sets can contain duplicate elements. Show Answer Correct Answer: A) You create a set in Python using set() or {}. Unique properties include being unordered and containing only unique elements. 54. Traversing each and every record exactly once is called ..... A) Traversing. B) Searching. C) Deletion. D) Insertion. Show Answer Correct Answer: A) Traversing. 55. Which of the following data structure is non linear type? A) Liked list. B) Queue. C) Tree. D) Stack. Show Answer Correct Answer: C) Tree. 56. The operation of visiting each element in the list is known as ..... A) Traversing. B) Sorting. C) Inserting. D) Merging. Show Answer Correct Answer: A) Traversing. 57. A normal queue, if implemented using an array of size MAX ..... SIZE, gets full when? A) Front = rear + 1. B) Rear = front. C) Front = (rear + 1)mod MAX SIZE. D) Rear = MAX SIZE-1. Show Answer Correct Answer: D) Rear = MAX SIZE-1. 58. The data structure required for Breadth First Traversal on a graph is A) Queue. B) Tree. C) Array. D) Stack. Show Answer Correct Answer: A) Queue. 59. Which of the following data structures is immutable? A) List. B) 2d List. C) Dictionary. D) Tuple. Show Answer Correct Answer: D) Tuple. 60. Consider an implementation of unsorted singly linked list. Suppose it has its representation with a head pointer only. Given the representation, which of the following operation can be implemented in O(1) time?i) Insertion at the front of the linked list ii) Insertion at the end of the linked list iii) Deletion of the front node of the linked list iv) Deletion of the last node of the linked list A) I and II. B) I and III. C) I, II and III. D) I, II and IV. Show Answer Correct Answer: B) I and III. ← PreviousNext →Related QuizzesScience QuizzesClass 12 QuizzesClass 12 Computer Science Chapter 1 Data Structures Using Python Quiz 1Class 12 Computer Science Chapter 1 Data Structures Using Python Quiz 2Class 12 Computer Science Chapter 1 Data Structures Using Python Quiz 3Class 12 Computer Science Chapter 1 Data Structures Using Python Quiz 4Class 12 Computer Science Chapter 1 Data Structures Using Python Quiz 5Class 12 Computer Science Chapter 1 Data Structures Using Python Quiz 6Class 12 Computer Science Chapter 1 Data Structures Using Python Quiz 7Class 12 Computer Science Chapter 1 Data Structures Using Python Quiz 8 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books