This quiz works best with JavaScript enabled. Home > Class 12 > 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 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Which data structure is needed to convert infix notation to postfix notation? A) Tree. B) List. C) Stack. D) Queue. Show Answer Correct Answer: C) Stack. 2. What does the .append() function do in Python Lists? A) Adds an item to the end of the List. B) Insert an item to the List based on index position. C) Removes an item from the List. D) Returns the number of items in the List. Show Answer Correct Answer: A) Adds an item to the end of the List. 3. Which sorting algorithm is known for its average time complexity of O(n log n)? A) Bubble sort. B) Insertion sort. C) Merge sort. D) Selection sort. Show Answer Correct Answer: C) Merge sort. 4. How can you merge two dictionaries in Python? A) By using the 'merge' method available on dictionaries. B) By using the 'update' method or the '|' operator in Python 3.9 and later. C) By using a for loop to iterate through the keys of both dictionaries. D) By converting them to lists and concatenating. Show Answer Correct Answer: B) By using the 'update' method or the '|' operator in Python 3.9 and later. 5. How do you raise an exception in Python? A) Raise Exception(). B) Raise Exception('Error message'). C) Raise 'Error message'. D) Throw Exception('Error message'). Show Answer Correct Answer: B) Raise Exception('Error message'). 6. Can I put different data types into a set? A) Yes. B) No. C) Idk. D) I should know but I forgot:(. Show Answer Correct Answer: A) Yes. 7. What will be the output of the program?class Main\{public static void main(String args[]) \{int arr[] = \{10, 20, 30, 40, 50\};for(int i=0; i < arr.length; i++)\{System.out.print(" '' + arr[i]);\}\}\} A) 10 20 30 40 50. B) Compiler Error. C) 10 20 30 40. D) None of the above. Show Answer Correct Answer: A) 10 20 30 40 50. 8. The front and rear pointers of a queue are monitored in a linked list implementation. During an insertion into a NONEMPTY queue, which of these pointers would change? A) Only rear pointer. B) Only Front pointer. C) Both Front and Rear. D) None of the above. Show Answer Correct Answer: A) Only rear pointer. 9. What is the syntax for creating a tuple in Python? A) A tuple is created using square brackets, e.g., [1, 2, 3]. B) A tuple is created using angle brackets, e.g., <1, 2, 3>. C) A tuple is created using parentheses, e.g., (1, 2, 3). D) A tuple is created using curly braces, e.g., \{1, 2, 3\}. Show Answer Correct Answer: C) A tuple is created using parentheses, e.g., (1, 2, 3). 10. Assertion (A):A queue is a FIFO data structure.Reason (R):Addition and deletion of items takes place at same end. A) A is true and R is correct explanation. B) A is true and R is incorrect explanation. C) A is true and R is true. D) A is false and R is false. Show Answer Correct Answer: B) A is true and R is incorrect explanation. 11. How can you use comprehension with tuples? A) You can use a generator expression to create a tuple, e.g., tuple(x for x in iterable). B) You can use a dictionary comprehension to create a tuple, e.g., \{x:x for x in iterable\}. C) You can use a list comprehension to create a tuple, e.g., [x for x in iterable]. D) You can convert a set to a tuple using set(x for x in iterable). Show Answer Correct Answer: A) You can use a generator expression to create a tuple, e.g., tuple(x for x in iterable). 12. How can you remove an item from a list by its value? A) Use list.pop(index) to remove an item by its value. B) Use list.remove(value) to remove an item by its value. C) Use del list[index] to remove an item by its value. D) Use list.clear() to remove all items from the list. Show Answer Correct Answer: B) Use list.remove(value) to remove an item by its value. 13. Which data structure allows deleting data elements from front and inserting from rear? A) Stack. B) Queue. C) Array. D) Linked List. Show Answer Correct Answer: B) Queue. 14. Which of the following is NOT a typical use case for a queue? A) Managing tasks in a print server. B) Handling IO buffers in networking. C) Implementing recursive function calls. D) Implementing breadth-first search in graph traversal. Show Answer Correct Answer: C) Implementing recursive function calls. 15. What methods can be used with dictionaries? A) Add, remove, clear, merge, find, search. B) Append, insert, delete, replace, copy, clone. C) Methods that can be used with dictionaries include get, keys, values, items, update, and pop. D) First, last, next, previous, count, sort. Show Answer Correct Answer: C) Methods that can be used with dictionaries include get, keys, values, items, update, and pop. 16. Arrays can have different data types?True or False? A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: B) False. 17. Identify the data structure which allows deletions at both ends of the list but insertion at only one end. A) Input restricted dequeue. B) Output restricted dequeue. C) Circular queue. D) Priority queue. Show Answer Correct Answer: A) Input restricted dequeue. 18. What are the key-value pairs in a dictionary? A) Key-value pairs consist of a unique key and its associated value, formatted as 'key:value'. B) Key-value pairs are lists of strings without any structure. C) Key-value pairs are unordered collections of items. D) Key-value pairs are only numeric values without keys. Show Answer Correct Answer: A) Key-value pairs consist of a unique key and its associated value, formatted as 'key:value'. 19. Which syntax correctly creates a set? A) Fruits = \{"apple", "banana", "orange"\}. B) Fruits = ["apple", "banana", "orange"]. C) Fruits = ("apple", "banana", "orange"). D) Fruits = "apple, banana, orange". Show Answer Correct Answer: A) Fruits = \{"apple", "banana", "orange"\}. 20. Records would typically be seen in use with which type of software? A) Image editor. B) Browser. C) Database. D) Defragmenter. Show Answer Correct Answer: C) Database. 21. What does the following function do for a given Linked List with first node as head? void fun1(struct node* head)\{ if(head == NULL) return; fun1(head$\rightarrow$next); printf("%d ", head$\rightarrow$data);\} A) Prints all nodes of linked lists. B) Prints all nodes of linked list in reverse order. C) Prints alternate nodes of Linked List. D) Prints alternate nodes in reverse order. Show Answer Correct Answer: B) Prints all nodes of linked list in reverse order. 22. Which of the following principle does queue use? A) LIFO. B) FIFO. C) Linear. D) Ordered. Show Answer Correct Answer: B) FIFO. 23. How do you iterate over a dictionary's keys and values? A) For value in my dict.values():. B) For key, value in my dict.items():. C) For key in my dict.keys():. D) For item in my dict:. Show Answer Correct Answer: B) For key, value in my dict.items():. 24. What are the advantages of using a set over a list? A) Advantages of using a set over a list include uniqueness of elements, faster membership tests, support for mathematical operations, and no order maintenance. B) Sets allow duplicate elements. C) Sets maintain the order of elements. D) Lists provide faster membership tests. Show Answer Correct Answer: A) Advantages of using a set over a list include uniqueness of elements, faster membership tests, support for mathematical operations, and no order maintenance. 25. How many stacks are required for reversing a word algorithm? A) One. B) Two. C) Three. D) Four. Show Answer Correct Answer: A) One. ← 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 8Class 12 Computer Science Chapter 1 Data Structures Using Python Quiz 9Class 12 Computer Science Chapter 1 Data Structures Using Python Quiz 10 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books