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 11 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 12 Computer Science Chapter 1 Data Structures Using Python Quiz 11 (60 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. You are given pointers to first and last nodes of a singly linked list, which of the following operations are dependent on the length of the linked list? A) Delete the last element. B) Inser a new element as the first element. C) Delete the First element. D) Add a new element at the end of the list. Show Answer Correct Answer: A) Delete the last element. 2. Which is function in C? A) A named block of code. B) Group of statements that together perform a task. C) A & B both. D) None of the above. Show Answer Correct Answer: C) A & B both. 3. What method in Python is used to merge two dictionaries? A) Merge(). B) Combine(). C) Update(). D) Concat(). Show Answer Correct Answer: C) Update(). 4. Elements are added in queue at A) Rear / Back. B) Front. C) Both. D) None. Show Answer Correct Answer: A) Rear / Back. 5. It is a mathematical object which arises in many physical problems, consists of m rows and n columns A) Table. B) Excel. C) Matrix. D) Array. Show Answer Correct Answer: C) Matrix. 6. Given an undirected graph G with V vertices and E edges, the sum of the degrees of all vertices will be? A) 2E. B) E. C) V + E. D) 2V. Show Answer Correct Answer: A) 2E. 7. This is a binary tree in which every level of the tree is completely filled except the last level A) Strictly binary tree. B) Binary search tree. C) Complete binary tree. D) None of the above. Show Answer Correct Answer: C) Complete binary tree. 8. ..... is a prerequisite for the binary search. A) The data must be unsorted. B) The data must be in ascending order only. C) The data must be in a linked list. D) The data must be sorted. Show Answer Correct Answer: D) The data must be sorted. 9. What is the main characteristic of a queue? A) It follows the Last In First Out (LIFO) principle. B) It follows the First In First Out (FIFO) principle. C) It allows random access to elements. D) It allows elements to be accessed only by index. Show Answer Correct Answer: B) It follows the First In First Out (FIFO) principle. 10. What is the purpose of a hash function in data structures? A) A hash function is used to encrypt data for security purposes. B) A hash function is a method for compressing data to save storage space. C) A hash function is used to sort data in ascending order. D) A hash function maps data of arbitrary size to fixed-size values, facilitating efficient data retrieval in hash tables. Show Answer Correct Answer: D) A hash function maps data of arbitrary size to fixed-size values, facilitating efficient data retrieval in hash tables. 11. Which of the following points is/are not true about Linked List data structure when it is compared with an array? A) Arrays have better cache locality that can make them better in terms of performance. B) It is easy to insert and delete elements in Linked List. C) Random access is not allowed in a typical implementation of Linked Lists. D) Access of elements in linked list takes less time than compared to arrays. Show Answer Correct Answer: D) Access of elements in linked list takes less time than compared to arrays. 12. What is the primary difference between an array and a list in Python? A) Arrays can contain mixed data types, while lists cannot. B) Lists are faster for numerical operations compared to arrays. C) Arrays can be resized dynamically, while lists have a fixed size. D) The primary difference is that arrays store elements of the same type, while lists can store elements of different types. Show Answer Correct Answer: D) The primary difference is that arrays store elements of the same type, while lists can store elements of different types. 13. If two trees have same structure and node content, then they arecalled A) Equivalent trees. B) Synonyms trees. C) Joint trees. D) Similar trees. Show Answer Correct Answer: A) Equivalent trees. 14. What is the time complexity of the dynamic programming implementation of the longest common subsequence problem where length of one string is "m" and the length of the other string is "n" ? A) O(m). B) O (m + n). C) O(mn). D) O(n). Show Answer Correct Answer: C) O(mn). 15. The number of edges from the root to the node is called ..... of the tree. A) Width. B) Height. C) Depth. D) Length. Show Answer Correct Answer: C) Depth. 16. What method in Python is used to remove the last element from a list? A) Delete(). B) Pop(). C) Clear(). D) Remove(). Show Answer Correct Answer: B) Pop(). 17. A B-tree of order 4 and of height 3 will have a maximum of ..... keys. A) 63. B) 127. C) 188. D) 255. Show Answer Correct Answer: D) 255. 18. Arrays have a fixed number of items.True or False A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 19. (A) Non primitive data structures are more complex data structures.(R) Non primitive data structures are derived from the user defined data structure A) Both A and B are false. B) A is false and B is treu. C) A is true and B is false. D) Both A and B are true. Show Answer Correct Answer: D) Both A and B are true. 20. ..... technique doesn't give guarantee that our solution is optimal A) Greedy method. B) Dynamic programming approach. C) Backtracking. D) Branch and bound. Show Answer Correct Answer: A) Greedy method. 21. Assertion(A):A tree is non-linear data structure. Reason (R):In non-linear data structure data items are connected to many other data items. A) A is true R is false. B) A is true R is correct explanation. C) A is false R is correct. D) Bothe A and R is false. Show Answer Correct Answer: B) A is true R is correct explanation. 22. Which of the following are the tree traversal A) Hashing. B) Depth first search. C) Defense first search. D) Bottom first search. Show Answer Correct Answer: B) Depth first search. 23. Which of the following data structures is best suited for implementing a stack? A) Tree. B) Array. C) Queue. D) Linked List. Show Answer Correct Answer: D) Linked List. 24. What is a nonlinear data structure? Provide an example. A) An example of a nonlinear data structure is a stack. B) An example of a nonlinear data structure is a binary tree. C) An example of a nonlinear data structure is a queue. D) An example of a nonlinear data structure is a linked list. Show Answer Correct Answer: B) An example of a nonlinear data structure is a binary tree. 25. 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. 26. Collection of similar type of data item is called A) Structure. B) Array. C) Recursion. D) None of the above. Show Answer Correct Answer: B) Array. 27. In AVL tree, the balance factor of a node is defined as the difference between the heights of its left and right subtrees. What is the range of the balance factor for a node in a balanced AVL tree? A) 1 to 3. B) -1 to 1. C) -2 to 2. D) 0 to 2. Show Answer Correct Answer: B) -1 to 1. 28. This characteristic describes whether the data items are arranged in chronological sequence, such as with an array, or in an unordered sequence, such as with a graph. A) Static or dynamic. B) Linear or non-linear. C) Homogeneous or non-homogeneous. D) None of the above. Show Answer Correct Answer: B) Linear or non-linear. 29. What is the name given to an abstract representation of how data is stored in a 2D array? A) File. B) Field. C) Table. D) Record. Show Answer Correct Answer: C) Table. 30. Pop() method does ..... A) Shows the first element in the list. B) Shows the last element in the list. C) Deletes the last element from the list and returns. D) Deletes the last element from the list. Show Answer Correct Answer: C) Deletes the last element from the list and returns. 31. Which of the following is not a disadvantage to the usage of array? A) Fixed size. B) There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size. C) Insertion based on position. D) Accessing elements at specified positions. Show Answer Correct Answer: D) Accessing elements at specified positions. 32. What is the output of the following code:'print((1, 2) + (3, 4))'? A) (1, 2, 3, 4). B) (1, 2, 4). C) (1, 2, 3). D) (1, 2, 3, 4, 5). Show Answer Correct Answer: A) (1, 2, 3, 4). 33. What are the key characteristics of tuples in Python? A) Tuples are immutable, ordered, allow duplicates, can contain mixed data types, and are hashable. B) Tuples are dynamic, indexed, and only allow strings. C) Tuples are mutable, unordered, and cannot contain duplicates. D) Tuples are mutable, can only contain integers, and are not hashable. Show Answer Correct Answer: A) Tuples are immutable, ordered, allow duplicates, can contain mixed data types, and are hashable. 34. How do sets differ from lists in Python? A) Sets differ from lists in that sets are unordered and contain unique elements, while lists are ordered and can contain duplicates. B) Sets can contain duplicate elements like lists. C) Sets maintain the order of elements like lists. D) Lists are unordered collections of unique items. Show Answer Correct Answer: A) Sets differ from lists in that sets are unordered and contain unique elements, while lists are ordered and can contain duplicates. 35. What are the advantages of using a binary tree over a linked list? A) A binary tree allows for faster search operations compared to a linked list. B) A binary tree uses less memory than a linked list. C) A binary tree can only store integer values, while a linked list can store any data type. D) A binary tree is a linear data structure, while a linked list is hierarchical. Show Answer Correct Answer: A) A binary tree allows for faster search operations compared to a linked list. 36. Which of following data structure is more appropriate forimplementing quick sort iteratively? A) Deque. B) Priority queue. C) Stack. D) Queue. Show Answer Correct Answer: C) Stack. 37. Stack uses ..... data structure as the element that was inserted last is the first one to be taken out. A) FIPO. B) LIPO. C) FIFO. D) LIFO. Show Answer Correct Answer: D) LIFO. 38. How do you create a lambda function in Python? A) A lambda function is created using the 'lambda' keyword followed by parameters and an expression. B) A lambda function is defined using the 'def' keyword. C) A lambda function is a built-in function that cannot be created by the user. D) A lambda function is created by importing the 'lambda' module. Show Answer Correct Answer: A) A lambda function is created using the 'lambda' keyword followed by parameters and an expression. 39. What happens if you try to access a key that doesn't exist in a Python dictionary?Criterion 2:Apply reasoning to solve real-world problems in various contexts A) The program crashes. B) 'KeyError' is raised. C) It returns an empty string. D) It returns 'None'. Show Answer Correct Answer: B) 'KeyError' is raised. 40. Priority Queues can be implemented in Java using the PriorityQueue class from the ..... package. A) Java.io. B) Java.util. C) Java.linkedlist. D) Java.scanner. Show Answer Correct Answer: B) Java.util. 41. What does the following code snippet do? void solve(ListNode* node) \{ node = node $\rightarrow$ next;\} A) Deletes the given node form the linked list. B) Alters nothing in main function. C) Prints all nodes of linked list in reverse order. D) Prints alternate nodes of Linked List. Show Answer Correct Answer: B) Alters nothing in main function. 42. What is the number of moves required to solve Tower of Hanoi problem for k disks? A) 2k-1. B) 2$^{k}$ + 1. C) 2k + 1. D) 2$^{k}$-1. Show Answer Correct Answer: D) 2$^{k}$-1. 43. In a singly linked list, what does each node contain? A) Only the data value. B) Data and references to both previous and next nodes. C) Data and a reference to the next node. D) Data and a unique identifier. Show Answer Correct Answer: C) Data and a reference to the next node. 44. *The evaluation of the above postfix expression is A) 41. B) 21. C) 9. D) 10. Show Answer Correct Answer: B) 21. 45. How do you access the first element of a nested dictionary? A) Nested dict['inner key']['outer key']. B) Nested dict['outer key']['inner key']. C) Nested dict['outer key'].inner key. D) Nested dict.outer key.inner key. Show Answer Correct Answer: B) Nested dict['outer key']['inner key']. 46. A function calls itself is called ..... A) Queue. B) Recursion. C) Function. D) None of above. Show Answer Correct Answer: B) Recursion. 47. Under which situation is the Enum data structure used? A) Fix no. of values. B) Storing images. C) Date related data. D) Different data types. Show Answer Correct Answer: A) Fix no. of values. 48. What is the height of a binary tree with only one node (the root)? A) 2. B) 1. C) -1. D) 0. Show Answer Correct Answer: D) 0. 49. Which of the following is/are the levels of implementation of data structure A) Abstract level. B) Application level. C) Implementation level. D) All of the above. Show Answer Correct Answer: D) All of the above. 50. How do you access the second element of a tuple? A) T[2]. B) T(second). C) T[1]. D) T[-0]. Show Answer Correct Answer: C) T[1]. 51. What is the purpose of the quicksort algorithm? A) To merge sorted lists into a single array. B) To sort elements efficiently using a divide-and-conquer approach. C) To analyze data using a linear search method. D) To find the maximum element in a dataset. Show Answer Correct Answer: B) To sort elements efficiently using a divide-and-conquer approach. 52. Based on the following statements, which are the leaf nodes?ArrayList minHeap = new ArrayList<>();Collections.addAll(minHeap, 2, 4, 5, 7, 8); A) 5, 7, and 8. B) 4, 5, and 7. C) 2, 4, and 5. D) 7 and 8. Show Answer Correct Answer: A) 5, 7, and 8. 53. A binary search tree whose left subtree and right subtree differ in height by at most 1 unit is called A) AVL tree. B) Red-black tree. C) Lemma tree. D) None of the above. Show Answer Correct Answer: A) AVL tree. 54. Data structure can be of two types namely ..... A) Simple and Nested. B) Simple and Compound. C) Sequential and random. D) All of the above. Show Answer Correct Answer: B) Simple and Compound. 55. Give an example of a primitive data structure in Python. A) List. B) Int. C) String. D) Float. Show Answer Correct Answer: B) Int. 56. Other name for directed graph is ..... A) Dir-graph. B) Dgraph. C) Digraph. D) Direct graph. Show Answer Correct Answer: C) Digraph. 57. How do you create a set? A) Use set() or {}. B) Use list() or []. C) Create a tuple with (). D) Define a dictionary with {}. Show Answer Correct Answer: A) Use set() or {}. 58. For the activity 'Counting vowels in a sentence' that uses 'for loop within the function', what is the most efficient approach? A) Use nested loops to compare each character with each vowel. B) Sort the sentence alphabetically first. C) Convert the sentence to uppercase first, then check each character. D) Check each character once and count matches. Show Answer Correct Answer: C) Convert the sentence to uppercase first, then check each character. 59. Example of non linear data structure A) Tree. B) Array. C) Queue. D) Stack. Show Answer Correct Answer: A) Tree. 60. It is a type of queue where elements are processed based on their order either natural or custom. A) Min Heap. B) Array List. C) Max Heap. D) Priority Queue. Show Answer Correct Answer: D) Priority Queue. ← 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