This quiz works best with JavaScript enabled. Home > Class 12 > Class 12 Computer Science Chapter 1 Data Structures Using Python – Quiz 8 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 12 Computer Science Chapter 1 Data Structures Using Python Quiz 8 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What is the purpose of the reduce function in Python? A) To create a new iterable from an existing one. B) To reduce an iterable to a single cumulative value using a specified function. C) To sort an iterable in ascending order. D) To filter elements from an iterable based on a condition. Show Answer Correct Answer: B) To reduce an iterable to a single cumulative value using a specified function. 2. Act of adding values into a stack is called A) Popping. B) Polling. C) Pushing. D) None. Show Answer Correct Answer: C) Pushing. 3. Explain the concept of recursion in programming. A) Recursion is a method where a function calls itself to solve smaller instances of a problem. B) Recursion is a method of storing data in a database. C) Recursion is when a function is executed multiple times without any conditions. D) Recursion is a technique where a function runs in a loop until a condition is met. Show Answer Correct Answer: A) Recursion is a method where a function calls itself to solve smaller instances of a problem. 4. What should be the value of rear (end) if the queue is full (elements are completely occupied )? A) 1. B) -1. C) MAX + 1. D) MAX-1. Show Answer Correct Answer: D) MAX-1. 5. In the linked list implementation of queue, where will the new element be inserted? A) At the middle position of the linked list. B) At the head position of the linked list. C) At the tail position of the linked list. D) None of the above. Show Answer Correct Answer: C) At the tail position of the linked list. 6. Minimum nodes possible height for a AVL tree with 16 nodes A) 2. B) 3. C) 4. D) Either 3 or 4. Show Answer Correct Answer: C) 4. 7. Which of the following is the most widely used external memory data structure? A) AVL tree. B) B-tree. C) Red-black tree. D) Both AVL tree and Red-black tree. Show Answer Correct Answer: B) B-tree. 8. Can dictionary keys be of any data type? A) All data types can be used as dictionary keys. B) Only strings can be used as dictionary keys. C) Dictionary keys must be numeric types only. D) Yes, but only immutable data types can be used as dictionary keys. Show Answer Correct Answer: D) Yes, but only immutable data types can be used as dictionary keys. 9. In which algorithm takes less time or space is called A) Best case. B) Worst case. C) Average case. D) None of the above. Show Answer Correct Answer: A) Best case. 10. Which situation is best for using a tuple? A) Storing fixed values that should not change. B) Storing values that will be updated frequently. C) Holding temporary inputs. D) Saving key-value pairs. Show Answer Correct Answer: A) Storing fixed values that should not change. 11. How can you check if an item exists in a tuple in Python? A) Using the .add() method. B) Using the 'in' keyword. C) Using the .remove() method. D) Using the .exist() method. Show Answer Correct Answer: B) Using the 'in' keyword. 12. How do you access the first element of a list? A) Items[0]. B) Items[1]. C) Items[-1]. D) Items(first). Show Answer Correct Answer: A) Items[0]. 13. Which data structure is mainly used for implementing the recursive algorithm? A) Queue. B) Stack. C) Array. D) List. Show Answer Correct Answer: B) Stack. 14. Consider the following array:[7, 4, 2, 8, 5, 1, 6, 3]. If you use the QuickSort algorithm and choose the pivot as the last element, what will be the array after the first partitioning step? A) [2, 4, 1, 3, 5, 7, 6, 8]. B) [2, 1, 3, 4, 5, 6, 7, 8]. C) [3, 4, 2, 1, 5, 7, 6, 8]. D) [7, 4, 2, 8, 5, 1, 6, 3]. Show Answer Correct Answer: B) [2, 1, 3, 4, 5, 6, 7, 8]. 15. What would be the Prefix notation for the given equation?A+(B*C) A) +A*CB. B) *B+AC. C) +A*BC. D) *A+CB. Show Answer Correct Answer: C) +A*BC. 16. How can you access the value associated with a specific key in a dictionary? A) Call dictionary name.value(key) to find the value. B) Use dictionary name[key] to access the value. C) Access the value with dictionary name[keys] where keys is a list. D) Use dictionary name.get(key) to retrieve the value. Show Answer Correct Answer: B) Use dictionary name[key] to access the value. 17. Which of the following lines of code will cause an error? Use the following definition of ages:ages = (12, 5, 8) A) Ages = ages + (1, 3, 5). B) Print(ages[2]). C) Ages = ages[2:]. D) Ages[0] = 3. Show Answer Correct Answer: D) Ages[0] = 3. 18. What happens when you delete a node from a singly linked list? A) The entire list is restructured automatically. B) The node is removed, and the previous node's next reference is updated to skip the deleted node. C) The node's data is set to None, but the node remains in the list. D) Python's garbage collector automatically removes the node without any need for reference updates. Show Answer Correct Answer: B) The node is removed, and the previous node's next reference is updated to skip the deleted node. 19. A binary search tree is generated by inserting in order the following integers:50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24 The number of the node in the left sub-tree and right sub-tree of the root, respectively, is A) (4, 7). B) (7, 4). C) (8, 3). D) (3, 8). Show Answer Correct Answer: B) (7, 4). 20. How do you use the map function in Python? A) Use the map function by calling map(func, iterable) where 'func' is the function to apply and 'iterable' is the collection of items. B) Call map(iterable, func) to apply a function to a list. C) Use map(func) on a single item to transform it directly. D) Invoke map with a function and a dictionary to get results. Show Answer Correct Answer: A) Use the map function by calling map(func, iterable) where 'func' is the function to apply and 'iterable' is the collection of items. 21. The height of a Binary Search Tree is given as h. Consider the height of the tree as the no. of edges in the longest path from root to the leaf. The maximum no. of nodes possible in the tree is? A) $2^{\left(h+1\right)}-1$. B) $2^{\left(h-1\right)}-1$. C) $2^{\left(h-1\right)}+1$. D) $2^{\left(h\right)}+1$. Show Answer Correct Answer: A) $2^{\left(h+1\right)}-1$. 22. In the ..... traversal we process all of a vertex's descendents before we move to an adjacent vertex. A) Depth First. B) Breadth First. C) With First. D) Depth Limited. Show Answer Correct Answer: A) Depth First. 23. What is a dictionary in Python and how is it used? A) A dictionary in Python is a type of list that stores elements in a sequential order. B) A dictionary in Python is a single value that cannot be modified after creation. C) A dictionary in Python is a collection of key-value pairs used for storing and retrieving data efficiently. D) A dictionary in Python is a collection of unique values used for mathematical operations. Show Answer Correct Answer: C) A dictionary in Python is a collection of key-value pairs used for storing and retrieving data efficiently. 24. Python built-in data structures are A) Integer, float, string. B) List, tuple, dictionary, sets. C) Tree, graph. D) None of the above. Show Answer Correct Answer: A) Integer, float, string. 25. How do you remove a key-value pair from a dictionary in Python? A) Dictionary.remove(key). B) Del dictionary[key]. C) Dictionary.delete(key). D) Dictionary.pop(key). Show Answer Correct Answer: B) Del dictionary[key]. ← PreviousNext →Related 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 9Class 12 Computer Science Chapter 1 Data Structures Using Python Quiz 10Class 12 Computer Science Chapter 1 Data Structures Using Python Quiz 11 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books