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 4 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 12 Computer Science Chapter 1 Data Structures Using Python Quiz 4 (60 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. 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]. 2. Which data structure is mainly used for implementing the recursive algorithm? A) List. B) Stack. C) Array. D) Queue. Show Answer Correct Answer: B) Stack. 3. 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) [3, 4, 2, 1, 5, 7, 6, 8]. B) [2, 1, 3, 4, 5, 6, 7, 8]. C) [2, 4, 1, 3, 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]. 4. What would be the Prefix notation for the given equation?A+(B*C) A) *B+AC. B) *A+CB. C) +A*CB. D) +A*BC. Show Answer Correct Answer: D) +A*BC. 5. 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. 6. 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) Ages[0] = 3. C) Print(ages[2]). D) Ages = ages[2:]. Show Answer Correct Answer: B) Ages[0] = 3. 7. 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. 8. 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) (3, 8). C) (7, 4). D) (8, 3). Show Answer Correct Answer: C) (7, 4). 9. 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. 10. 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: B) $2^{\left(h+1\right)}-1$. 11. In the ..... traversal we process all of a vertex's descendents before we move to an adjacent vertex. A) Depth First. B) With First. C) Depth Limited. D) Breadth First. Show Answer Correct Answer: A) Depth First. 12. 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. 13. How do you remove a key-value pair from a dictionary in Python? A) Dictionary.delete(key). B) Del dictionary[key]. C) Dictionary.remove(key). D) Dictionary.pop(key). Show Answer Correct Answer: B) Del dictionary[key]. 14. In a 2D array with dimensions m x n, how are elements stored in memory? A) In a tree structure. B) In a column-major order (each column is stored consecutively). C) In a mixed-order arrangement. D) In a row-major order (each row is stored consecutively). Show Answer Correct Answer: D) In a row-major order (each row is stored consecutively). 15. What data structure is used for breadth first traversal of a graph? A) Queue. B) Stack. C) List. D) None of the above. Show Answer Correct Answer: A) Queue. 16. Full form of LIFO is ..... A) Last Innner First Outer. B) Last Impact First Out. C) Last In First Out. D) Last Inside First Outside. Show Answer Correct Answer: C) Last In First Out. 17. ..... operation returns the value of the topmost element of the stack. A) Peep. B) Push. C) Pop. D) Update. Show Answer Correct Answer: A) Peep. 18. If a node having two children is to be deleted from binary search tree, it is replaced by its A) Post-order successor. B) In-order successor. C) Pre-order predecessor. D) In-order predecessor. Show Answer Correct Answer: B) In-order successor. 19. What is a hash table and how does it work? A) A hash table is a graphical representation of data relationships. B) A hash table is a data structure that uses a hash function to map keys to values for efficient data retrieval. C) A hash table is a linear data structure that stores elements in a sequential manner. D) A hash table is a type of database used for storing large amounts of data. Show Answer Correct Answer: B) A hash table is a data structure that uses a hash function to map keys to values for efficient data retrieval. 20. List and explain the common sorting algorithms in Python. A) Bubble Sort, Selection Sort, Insertion Sort, Merge Sort, Quick Sort, Timsort. B) Heap Sort. C) Shell Sort. D) Radix Sort. Show Answer Correct Answer: A) Bubble Sort, Selection Sort, Insertion Sort, Merge Sort, Quick Sort, Timsort. 21. (A):Queue is an ordered collection of items (B):Queue is an example for non-linear data structure A) Both A and B are true. B) A is false and B is true. C) A is true and B is false. D) Both A and B are false. Show Answer Correct Answer: C) A is true and B is false. 22. What is a dequeue? A) A queue with insert/delete defined for both front and rear ends of the queue. B) A queue implemented with a doubly linked list. C) A queue implemented with both singly and doubly linked lists. D) A queue with insert/delete defined for front side of the queue. Show Answer Correct Answer: A) A queue with insert/delete defined for both front and rear ends of the queue. 23. Process of removing an element from stack is called ..... A) Peek. B) Create. C) Push. D) Pop. Show Answer Correct Answer: D) Pop. 24. What are the main types of data structures in Python? A) Arrays, Strings, Floats, Booleans. B) Graphs, Trees, Queues, Stacks. C) Files, Modules, Classes, Functions. D) Lists, Tuples, Sets, Dictionaries. Show Answer Correct Answer: D) Lists, Tuples, Sets, Dictionaries. 25. In linked list implementation of a queue, front and rear pointers are tracked. Which of these pointers will change during an insertion into a NONEMPTY queue? A) Only front pointer. B) Only rear pointer. C) Both front and rear pointer. D) No pointer will be changed. Show Answer Correct Answer: B) Only rear pointer. 26. When analyzing the function call syntax 'fun()', what distinguishes this from a variable reference? A) The length of the name. B) The position in the code. C) The presence of parentheses. D) The capitalization of the name. Show Answer Correct Answer: C) The presence of parentheses. 27. Which data structure in Python is best suited for implementing a stack? A) Set. B) Deque. C) Dictionary. D) List. Show Answer Correct Answer: D) List. 28. Which of the following types of queues is used to handle multiple tasks in a real-time system where tasks are prioritized? A) Circular Queue. B) Priority Queue. C) Simple Queue. D) Double-Ended Queue (Deque). Show Answer Correct Answer: B) Priority Queue. 29. Why would a programmer choose to break down a complex program into multiple functions rather than writing everything in one large block of code? A) To make the program run in parallel. B) To reduce memory usage. C) To make the program file smaller. D) To improve code organization, readability, and maintainability. Show Answer Correct Answer: D) To improve code organization, readability, and maintainability. 30. Which statement is true about Python dictionaries?Criterion 1:Evaluate and select information sources based on their appropriateness to specific tasks A) They cannot be changed once created. B) They can only store strings as values. C) They store key-value pairs. D) They store items in a specific order. Show Answer Correct Answer: C) They store key-value pairs. 31. Which of the following is non-linear data structure? A) Stacks. B) Trees. C) List. D) Strings. Show Answer Correct Answer: B) Trees. 32. What is the main difference between a set and a list? A) A set can contain duplicates and is ordered, while a list cannot. B) The main difference is that a set contains only unique elements and is unordered, while a list can contain duplicates and is ordered. C) A list is always unordered and contains only unique elements. D) A set is a type of list that allows for ordering of elements. Show Answer Correct Answer: B) The main difference is that a set contains only unique elements and is unordered, while a list can contain duplicates and is ordered. 33. In binary tree nodes with no successor are called terminal nodes A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 34. Define linear data structures and give an example in Python. A) Example of a linear data structure in Python:my dict = {'a':1, 'b':2}. B) Example of a linear data structure in Python:my tuple = (1, 2, 3). C) Example of a linear data structure in Python:my set = {1, 2, 3}. D) Example of a linear data structure in Python:my list = [1, 2, 3, 4, 5]. Show Answer Correct Answer: D) Example of a linear data structure in Python:my list = [1, 2, 3, 4, 5]. 35. A queue is a ..... data structure in which each element that was inserted first is the first one to be taken out. A) FIVO. B) FIFO. C) FITO. D) FISO. Show Answer Correct Answer: B) FIFO. 36. What are the disadvantages of arrays? A) Index value of an array can be negative. B) Elements are sequentially accessed. C) Data structure like queue or stack cannot be implemented. D) There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size. Show Answer Correct Answer: D) There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size. 37. A tree is composed of ..... connected by edges or lines. A) Fruit. B) Nodes. C) Root Node. D) Leaf Node. Show Answer Correct Answer: B) Nodes. 38. What is the maximum number of children that a node can have in a binary tree? A) 3. B) 2. C) 1. D) 4. Show Answer Correct Answer: B) 2. 39. What is the correct way to create a set in Python? A) Set = {1, 2, 3}. B) Set = (1, 2, 3). C) Set = <1, 2, 3>. D) Set = [1, 2, 3]. Show Answer Correct Answer: A) Set = {1, 2, 3}. 40. What method in Python is used to check if a key exists in a dictionary? A) In(). B) Exists(). C) Check(). D) Contains(). Show Answer Correct Answer: A) In(). 41. The optimal data structure used to solve Tower of Hanoi is ..... A) Stack. B) Priority queue. C) Heap. D) Tree. Show Answer Correct Answer: A) Stack. 42. What is the name given to a number that corresponds to the location of an item of data in an array? A) Index. B) Initial. C) Primary. D) Identifier. Show Answer Correct Answer: A) Index. 43. How do you access the value for a key? A) Student$\rightarrow$name. B) Student.name. C) Student["name"]. D) Student(0). Show Answer Correct Answer: C) Student["name"]. 44. How do you add an element to the end of a list in Python? A) List.add(element). B) List.insert(element). C) List.append(element). D) List.push(element). Show Answer Correct Answer: C) List.append(element). 45. Arranging elements of a data structure in increasing or decreasing order is known as ..... A) Sorting. B) Searching. C) Arrangement. D) Indexing. Show Answer Correct Answer: A) Sorting. 46. Consider the following operation performed on a stack of size 5.Push(1);Pop();Push(2);Push(3);Pop();Push(4);Pop();Pop();Push(5);After the completion of all operation, get the total number of element present in stack is A) 2. B) 1. C) 4. D) 3. Show Answer Correct Answer: B) 1. 47. To measure Time complexity of an algorithm Big O notation is used which: A) Describes limiting behaviour of the function. B) Characterises a function based on growth of function. C) Upper bound on growth rate of the function. D) All of the mentioned. Show Answer Correct Answer: D) All of the mentioned. 48. What is the difference between linear search and binary search? A) Linear search is O(n) and works on unsorted lists; binary search is O(log n) and requires sorted lists. B) Linear search is faster than binary search for large datasets. C) Linear search requires a sorted list to function properly. D) Binary search can be used on unsorted lists without any preprocessing. Show Answer Correct Answer: A) Linear search is O(n) and works on unsorted lists; binary search is O(log n) and requires sorted lists. 49. Stacks 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: B) LIFO (Last In First Out). 50. Which data structure in Python follows the First In First Out (FIFO) principle? A) Set. B) Stack. C) Array. D) Queue. Show Answer Correct Answer: D) Queue. 51. A Binary Tree can have A) Can have 2 children. B) Can have 1 children. C) Can have 0 children. D) All of the above. Show Answer Correct Answer: D) All of the above. 52. Queue Implementation using Array. Array name is Queuearray and rear is the current element pointer and "data" is the new item to be added. For adding a new element int the queue, is the following statement correct? queue[rear] = data;Queuearray[rear] = data; A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: B) False. 53. A complete binary tree with 5 levels has how many nodes? (Root is Level 1) A) Op 4:31. B) Op 1:15. C) Op 2:25. D) Op 3:63. Show Answer Correct Answer: A) Op 4:31. 54. When designing a function for 'Multiplying Numbers', what parameter design would provide the most flexibility? A) Accept only string parameters. B) Accept a variable number of parameters (*args). C) Accept exactly two parameters only. D) Accept no parameters and use global variables. Show Answer Correct Answer: B) Accept a variable number of parameters (*args). 55. How can we describe an array in the best possible way? A) The Array shows a hierarchical structure. B) The Array is not a data structure. C) Container that stores the elements of similar types. D) The Array shows a hierarchical structure. Show Answer Correct Answer: C) Container that stores the elements of similar types. 56. In ..... , search start at the beginning of the list and check every element in the list. A) Hash Search. B) Binary Search. C) Linear Search. D) Binary Tree Search. Show Answer Correct Answer: C) Linear Search. 57. ..... approach is best to solve 0/1 Knapsack problem A) Greedy. B) Divide and Conquer. C) Dynamic Programming. D) Iterative. Show Answer Correct Answer: C) Dynamic Programming. 58. A record allows multiple data items to be stored using ..... ..... to identify each item of data A) Record entries. B) Array lists. C) Table references. D) Field names. Show Answer Correct Answer: D) Field names. 59. If the elements "A" , "B" , "C" and "D" are placed in a queue and are deleted one at a time, in what order will they be removed? A) ABDC. B) DCAB. C) ABCD. D) DCBA. Show Answer Correct Answer: C) ABCD. 60. Example of linear data structure except A) Tree. B) Queue. C) Array. D) Stack. Show Answer Correct Answer: A) Tree. ← 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 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 9 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books