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 7 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 12 Computer Science Chapter 1 Data Structures Using Python Quiz 7 (60 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Which data structure is used to check a palindrome? A) Tree. B) Queue. C) Stack. D) Linked List. Show Answer Correct Answer: C) Stack. 2. A collection of elements where each element is unique. A) TreeSet. B) HashSet. C) LinkedHashSet. D) Set. Show Answer Correct Answer: D) Set. 3. What is a non-primitive data structure? Provide an example. A) An example of a non-primitive data structure is an array. B) An example of a non-primitive data structure is a character. C) An example of a non-primitive data structure is a boolean. D) An example of a non-primitive data structure is a string. Show Answer Correct Answer: A) An example of a non-primitive data structure is an array. 4. The number of edges in a complete graph of n vertices is ..... A) N(n-1)/2. B) N(n+1)/2. C) N. D) N2 /2. Show Answer Correct Answer: A) N(n-1)/2. 5. Array data can be accessed using ..... A) Operator. B) Index. C) Pointer. D) Variable. Show Answer Correct Answer: B) Index. 6. What will be the result of the below given expression in prefix form-+ 2 3 8 A) -7. B) 3. C) 7. D) -3. Show Answer Correct Answer: D) -3. 7. What is the purpose of a data structure in programming? A) To define constants. B) To store and organise data efficiently. C) To perform mathematical calculations. D) To write comments in code. Show Answer Correct Answer: B) To store and organise data efficiently. 8. What is the primary data structure in Pandas used for representing tabular data? A) List. B) Tuple. C) DataFrame. D) Dictionary. Show Answer Correct Answer: C) DataFrame. 9. Which of the following is the postfix of the expression A+B/C*(D-A) A) +A/B*C-DA. B) +*-/ABCDA. C) ABC/DA-*+. D) ABCDA/-*+. Show Answer Correct Answer: C) ABC/DA-*+. 10. When implementing 'Greeting People' functionality, what makes a function more versatile than hardcoded text? A) Functions can accept different names as parameters. B) Functions automatically format text. C) Functions use less memory. D) Functions run faster than print statements. Show Answer Correct Answer: A) Functions can accept different names as parameters. 11. What is the optimal time complexity to count the number of nodes in a linked list? A) O(n). B) O(1). C) O(log n). D) O(n log n). Show Answer Correct Answer: A) O(n). 12. Can I add onto a dictionary after created A) Yes I am allowed to add onto a dictionary after creation. B) No, dictionaries are immutable after creation. C) All the above. D) None of the above. Show Answer Correct Answer: A) Yes I am allowed to add onto a dictionary after creation. 13. To evaluate an expression without any embedded function calls: A) A Turing machine is needed in the general case. B) One stack is enough. C) Two stacks are needed. D) As many stacks as the height of the expression tree are needed. Show Answer Correct Answer: B) One stack is enough. 14. What is the best case height of a B-tree of order n and which has k keys? A) Nk. B) Logn (k+1)-1. C) Klogn. D) Logk (n+1)-1. Show Answer Correct Answer: B) Logn (k+1)-1. 15. Which of the following properties is associated with a queue? A) First In First Out. B) Last In Last Out. C) First In Last Out. D) Last In First Out. Show Answer Correct Answer: A) First In First Out. 16. Which operation is problematic in an array? A) Insertion & Deletion. B) Updation. C) Searching. D) All of these. Show Answer Correct Answer: A) Insertion & Deletion. 17. How can you access 'Austria' from an array of countries? A) Using index 2. B) Using index 0. C) Using index 1. D) Using index 3. Show Answer Correct Answer: C) Using index 1. 18. While implementing Queue using list when we want to delete element we must use pop function as ..... A) List.pop(1). B) List.pop(). C) List.pop(0). D) List.pop(pos). Show Answer Correct Answer: C) List.pop(0). 19. Which is the type of an array? A) One dimensional. B) Two dimensional. C) Multi Dimensional. D) All of these. Show Answer Correct Answer: D) All of these. 20. The leaves of an expression tree always contain? A) Operators. B) Operands. C) Null. D) Expression. Show Answer Correct Answer: B) Operands. 21. Given the following preorder and inorder traversals of a binary tree:Preorder:M, N, O, P, Q, R, S, TInorder:O, P, Q, R, N, T, M, SReconstruct the binary tree and determine the number of values after the root node. A) 1. B) 5. C) 4. D) 2. Show Answer Correct Answer: A) 1. 22. Which Time and Space Complexity uses the O(n$^{2}$) notation? A) Exponential. B) Quadratic. C) Linear. D) Logarithmic. Show Answer Correct Answer: B) Quadratic. 23. Data Structure is a particular way of storing and organizing data in a computer so that it can be used efficiently. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 24. What is the maximum number of keys that a B+-tree of order 3 and of height 3 have? A) 3. 27. B) 1. 3. C) 4. 26. D) 2. 80. Show Answer Correct Answer: C) 4. 26. 25. Count = 0 while count < 3:print("Hello!") count += 1 A) Hello! (printed 3 times). B) Hello! (printed 2 times). C) Hello! (printed 1 time). D) Infinite Hello! (keeps printing without stopping). Show Answer Correct Answer: A) Hello! (printed 3 times). 26. What is a queue and how does it differ from a stack? A) A queue is a LIFO data structure, while a stack is a FIFO data structure. B) A queue is a FIFO data structure, while a stack is a LIFO data structure. C) A queue allows random access, while a stack does not. D) A queue is a data structure that only allows insertion at the front. Show Answer Correct Answer: B) A queue is a FIFO data structure, while a stack is a LIFO data structure. 27. A data structure in which elements can be inserted or deleted at/from both ends but not in the middle is? A) Queue. B) Circular Queue. C) Dequeue. D) Priority queue. Show Answer Correct Answer: C) Dequeue. 28. Which of the following is NOT a type of binary tree? A) Linear binary tree. B) Full binary tree. C) Complete binary tree. D) Balanced binary tree. Show Answer Correct Answer: A) Linear binary tree. 29. What is the result of the expression ' 7 // 2 ' in Python? A) 4. B) 3. C) 3.0. D) 3.5. Show Answer Correct Answer: B) 3. 30. What is the main difference between a list and a tuple? A) Lists are faster than tuples in terms of performance. B) The main difference is that lists are mutable and tuples are immutable. C) Tuples are created using square brackets, while lists use parentheses. D) Lists can contain only numbers, while tuples can contain any data type. Show Answer Correct Answer: B) The main difference is that lists are mutable and tuples are immutable. 31. The complexity of Bubble sort algorithm is A) O(log n). B) O(n log n). C) O(n2). D) O(n). Show Answer Correct Answer: C) O(n2). 32. What is the difference between a set and a dictionary? A) A set can have duplicate elements; a dictionary cannot. B) A set uses indexes; a dictionary uses lists. C) A set is ordered; a dictionary is unordered. D) A set contains unique elements; a dictionary contains key-value pairs. Show Answer Correct Answer: D) A set contains unique elements; a dictionary contains key-value pairs. 33. What is a stack and how does it operate? A) A stack is a FIFO data structure that allows enqueue and dequeue operations. B) A stack is a LIFO data structure that allows push and pop operations. C) A stack is a linear data structure that allows insertion at both ends. D) A stack is a data structure that only supports random access methods. Show Answer Correct Answer: B) A stack is a LIFO data structure that allows push and pop operations. 34. What would be the solution to the given prefix notation? A) 2. B) 10. C) 5. D) 7. Show Answer Correct Answer: A) 2. 35. Entries in a stack are "ordered" . What is the meaning of this statement? A) There is a Sequential entry that is one by one. B) The entries are stored in a linked list. C) A collection of stacks is sortable. D) Stack entries may be compared with the '<' operation. Show Answer Correct Answer: A) There is a Sequential entry that is one by one. 36. What is the role of a hash function in hash tables? A) The role of a hash function is to compress data for faster transmission. B) The role of a hash function is to sort data in ascending order. C) The role of a hash function in hash tables is to map keys to specific indices for efficient data storage and retrieval. D) The role of a hash function is to encrypt data for secure storage. Show Answer Correct Answer: C) The role of a hash function in hash tables is to map keys to specific indices for efficient data storage and retrieval. 37. Given a sequence of number below:50, 60, 40, 70, 45, 55, 30, 80, 65, 35, 25, 75, 85When creating a binary search tree, what is the height of the tree? A) 4. B) 5. C) 3. D) 6. Show Answer Correct Answer: A) 4. 38. Explain how a binary tree is a nonlinear data structure. A) A binary tree is a linear data structure with a single path. B) A binary tree organizes data in a flat structure without branches. C) A binary tree is a nonlinear data structure due to its hierarchical organization and branching nature. D) A binary tree is a simple list of elements arranged sequentially. Show Answer Correct Answer: C) A binary tree is a nonlinear data structure due to its hierarchical organization and branching nature. 39. Which is the most appropriate data structure for reversing a word? A) Tree. B) Stack. C) Hashing. D) Queue. Show Answer Correct Answer: B) Stack. 40. How do you access the second element of a tuple in Python? A) Tuple name[0]. B) Tuple name[-1]. C) Tuple name[1]. D) Tuple name[2]. Show Answer Correct Answer: C) Tuple name[1]. 41. Which of these best describes an array? A) Arrays are immutable once initialised. B) Container of objects of similar types. C) A data structure that shows a hierarchical behaviour. D) Array is not a data structure. Show Answer Correct Answer: B) Container of objects of similar types. 42. Can tuples be modified after creation? A) Yes, tuples can be modified after creation. B) Tuples can be resized after creation. C) No, tuples cannot be modified after creation. D) Tuples can have their elements changed after creation. Show Answer Correct Answer: C) No, tuples cannot be modified after creation. 43. What is the difference between lists and arrays in Python? A) There is no difference. B) Arrays are contiguous, but lists are not. C) Lists are contiguous, but arrays are not. D) Arrays are only used in Python 2. Show Answer Correct Answer: B) Arrays are contiguous, but lists are not. 44. What is a set in Python? A) A key-value store. B) A collection of unique, unordered elements. C) A fixed sequence. D) A collection of ordered, changeable elements. Show Answer Correct Answer: B) A collection of unique, unordered elements. 45. What are the advantages of using tuples over lists in Python? A) Tuples can be modified after creation. B) Advantages of using tuples over lists include immutability, lower memory usage, ability to be used as dictionary keys, and simpler syntax. C) Lists use less memory than tuples. D) Tuples cannot be used as keys in dictionaries. Show Answer Correct Answer: B) Advantages of using tuples over lists include immutability, lower memory usage, ability to be used as dictionary keys, and simpler syntax. 46. How do you implement a stack in Python? A) Stack = {}; stack.push(item); item = stack.remove(); is empty = stack.size() == 0;. B) Stack = []; stack.add(item); item = stack.delete(); is empty = stack.length() == 0;. C) Stack = []; stack.append(item); item = stack.pop(); is empty = len(stack) == 0;. D) Stack = []; item = stack.pop(); stack.append(item); is empty = not stack;. Show Answer Correct Answer: C) Stack = []; stack.append(item); item = stack.pop(); is empty = len(stack) == 0;. 47. If you have a function that calculates area and you want to reuse it in multiple projects, which programming principle does this demonstrate? A) Code compilation. B) Code encryption. C) Code modularity and reusability. D) Code optimization. Show Answer Correct Answer: C) Code modularity and reusability. 48. What is the main characteristic of a stack? A) It follows the First In First Out (FIFO) principle. B) It follows the Last In First Out (LIFO) principle. C) It is a dynamic data structure. D) It allows random access to elements. Show Answer Correct Answer: B) It follows the Last In First Out (LIFO) principle. 49. Linked lists are not suitable to for the implementation of? A) Insertion sort. B) Polynomial manipulation. C) Binary search. D) Radix sort. Show Answer Correct Answer: C) Binary search. 50. Select the non-linear data structure from the options below: A) Queue. B) Array. C) Linked list. D) Tree. Show Answer Correct Answer: D) Tree. 51. The data structure required to check whether an expression contains balanced parenthesis is? A) Queue. B) Array. C) Tree. D) Stack. Show Answer Correct Answer: D) Stack. 52. What method in Python is used to check if an element is present in a set? A) Contains(). B) Check(). C) In(). D) Exists(). Show Answer Correct Answer: C) In(). 53. Can I have duplicate keys in a python dictionary? A) No, keys are all unique. B) Yes, you can!. C) Idk. D) None of the above. Show Answer Correct Answer: A) No, keys are all unique. 54. How can you convert a list of strings to their lengths using map? A) List(map(len, your list)). B) Map(len, your list). C) List(map(str, your list)). D) List(map(length, your list)). Show Answer Correct Answer: A) List(map(len, your list)). 55. Which data structure follows LIFO System? A) Stack. B) Queue. C) Linked List. D) All. Show Answer Correct Answer: A) Stack. 56. The given array is arr = {1, 2, 4, 3}. Bubble sort is used to sort the array elements. How many iterations will be done to sort the array? A) 2. B) 1. C) 4. D) 0. Show Answer Correct Answer: C) 4. 57. What is a complete binary tree? A) Each node has exactly zero or two children. B) A binary tree, which is completely filled, with the possible exception of the bottom level, which is filled from right to left. C) A binary tree, which is completely filled, with the possible exception of the bottom level, which is filled from left to right. D) A tree In which all nodes have degree 2. Show Answer Correct Answer: C) A binary tree, which is completely filled, with the possible exception of the bottom level, which is filled from left to right. 58. Which is not a non-primitive data structure? A) Integer. B) Float / Real. C) Character. D) Array. Show Answer Correct Answer: D) Array. 59. A vertex of in-degree zero in a directed graph is called ..... A) Root vertex. B) Sink vertex. C) Source vertex. D) Articulation point. Show Answer Correct Answer: B) Sink vertex. 60. Any node is the path from the root to the node is called A) Successor node. B) Ancestor node. C) Internal node. D) None of the above. Show Answer Correct Answer: B) Ancestor node. ← 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 8Class 12 Computer Science Chapter 1 Data Structures Using Python Quiz 9 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books