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 8 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 12 Computer Science Chapter 1 Data Structures Using Python Quiz 8 (60 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What happens when you add a duplicate to a set? A) An error occurs. B) The set sorts itself. C) The set becomes a list. D) The duplicate is ignored. Show Answer Correct Answer: D) The duplicate is ignored. 2. Five node splitting operations occurred when an entry is inserted into a B-tree. Then how many nodes are written? A) 11. B) 5. C) 7. D) 14. Show Answer Correct Answer: A) 11. 3. A graph in which all vertices have equal degree is known as ..... A) Multi graph. B) Simple graph. C) Complete graph. D) Regular graph. Show Answer Correct Answer: C) Complete graph. 4. ..... is the data structure that has collection of nodes two fields named data and link. A) Queue. B) Linked List. C) Circular queue. D) Stack. Show Answer Correct Answer: B) Linked List. 5. ..... is the method used by card sorter? A) Heap. B) Insertion. C) Radix sort. D) Quick. Show Answer Correct Answer: C) Radix sort. 6. What is the maximum height of any AVL-tree with 7 nodes? Assume that the height of a tree with a single node is 0. A) 4. B) 5. C) 2. D) 3. Show Answer Correct Answer: D) 3. 7. How is an array initialized in C language? A) Int a = {1, 2, 3};. B) Int a(3) = [1, 2, 3];. C) Int a[] = new int[3]. D) Int a[3] = {1, 2, 3};. Show Answer Correct Answer: D) Int a[3] = {1, 2, 3};. 8. For an int of size 4 bites what is the size of arr[15] A) 11. B) 60. C) 15. D) A. 19. Show Answer Correct Answer: B) 60. 9. What is a linked list in Python? A) A built-in data type for storing key-value pairs. B) A sequence of nodes where each node contains data and a reference to the next node. C) A collection of elements stored in contiguous memory locations. D) A data structure that allows random access to elements. Show Answer Correct Answer: B) A sequence of nodes where each node contains data and a reference to the next node. 10. How do you add an element to a set? A) Use the 'insert' method. B) Use the 'push' method. C) Use the 'add' method. D) Use the 'append' method. Show Answer Correct Answer: C) Use the 'add' method. 11. What is a python dictionary? A) A data structure that is a collection of unique values. B) A data structure that is a collection of idk. C) A data structure that is a collection of tulips. D) A data structure that is a collection of key-value pairs. Show Answer Correct Answer: D) A data structure that is a collection of key-value pairs. 12. Evaluate postfix expression2 3 1 * + 9- A) -4. B) 6. C) 8. D) 4. Show Answer Correct Answer: A) -4. 13. Which of the following is the most appropriate data structure for reversing a string? A) Linked list. B) Array. C) Queue. D) Stack. Show Answer Correct Answer: D) Stack. 14. Void is ..... data type. A) Primary. B) Derived. C) User defined. D) None of above. Show Answer Correct Answer: A) Primary. 15. Complexity of Binary Search for an array of n numbers is A) Nlog$_{2n}$. B) N$^{2}$. C) Log$_{2}$n. D) N. Show Answer Correct Answer: C) Log$_{2}$n. 16. Consider the usual algorithm for determining whether a sequence of parentheses is balanced.The maximum number of parentheses that appear on the stack AT ANY ONE TIME when the algorithm analyzes:(()(())(())) are: A) 1. B) 4. C) 2. D) 3. Show Answer Correct Answer: D) 3. 17. How do you access the third element in a list named 'my ..... list' in Python? A) My list(2). B) My list.index(3). C) My list[2]. D) My list[3]. Show Answer Correct Answer: C) My list[2]. 18. Which of the following properties are obeyed by all three tree-traversals? A) Root node is visited before left subtree. B) Root node is visited before right subtree. C) Left subtrees are visited before right subtrees. D) Right subtrees are visited before left subtrees. Show Answer Correct Answer: C) Left subtrees are visited before right subtrees. 19. Which value does the command 'list[3]' find? A) The third value of 'List'. B) The fourth value of 'List'. C) The fifth value of 'List'. D) The second value of 'List'. Show Answer Correct Answer: B) The fourth value of 'List'. 20. Which data structure allows deleting data elements from and inserting at rear? A) Binary search tree. B) Queues. C) Dequeues. D) Stacks. Show Answer Correct Answer: B) Queues. 21. What a field does? A) Represents attribute of a entity. B) Represents properties of entity. C) A & B Both. D) None of these. Show Answer Correct Answer: C) A & B Both. 22. For the array:float stats[3];What is the range of the index? A) 0 to 4. B) 0 to 2. C) 0 to 3. D) 1 to 3. Show Answer Correct Answer: B) 0 to 2. 23. List of data in which element can be inserted and removed at the same end is called as ..... A) Stack. B) Array. C) Linked list. D) Queue. Show Answer Correct Answer: A) Stack. 24. In algorithm several statements appear in the same step A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 25. How do you create a class in Python and instantiate an object from it? A) MyClass obj = new MyClass();. B) Class MyClass() {}. C) Def MyClass():pass. D) Class MyClass:def init (self):passobj = MyClass(). Show Answer Correct Answer: D) Class MyClass:def init (self):passobj = MyClass(). 26. Which feature makes tuples useful as dictionary keys? A) They are immutable. B) They store key-value pairs. C) They are always unique. D) They can be resized. Show Answer Correct Answer: A) They are immutable. 27. Consider the following definition in c programming language. struct node { int data; struct node next; } typedef struct node NODE; NODE *ptr; Which of the following c code is used to create new node? A) Ptr = (NODE*)malloc(sizeof(NODE));. B) Ptr = (NODE*)malloc(NODE);. C) Ptr = (NODE*)malloc(sizeof(NODE*));. D) Ptr = (NODE)malloc(sizeof(NODE));. Show Answer Correct Answer: A) Ptr = (NODE*)malloc(sizeof(NODE));. 28. How can you convert a list to a set in Python? A) Array(my list). B) Set(my list). C) Convert(my list). D) List(my list). Show Answer Correct Answer: B) Set(my list). 29. How many edges will a tree consisting of N nodes have? A) N-1. B) Log(N). C) N+1. D) N. Show Answer Correct Answer: A) N-1. 30. Which of the following is/are property/properties of a dynamic programming problem? A) Optimal substructure. B) Overlapping subproblems. C) Greedy approach. D) Both optimal substructure and overlapping subproblems. Show Answer Correct Answer: D) Both optimal substructure and overlapping subproblems. 31. What is the difference between a set and a frozenset in Python? A) A set is mutable and can be modified, while a frozenset is immutable and cannot be changed after creation. B) Both sets and frozensets are mutable and can be modified. C) A frozenset is a type of list that maintains order, while a set does not. D) Sets can contain only integers, while frozensets can contain any data type. Show Answer Correct Answer: A) A set is mutable and can be modified, while a frozenset is immutable and cannot be changed after creation. 32. A set of ordered pairs where elements are known as keys or identifiers and values or content. A) Map. B) Priority Queue. C) Array List. D) Set. Show Answer Correct Answer: A) Map. 33. Which of the following is a correct way to declare a multidimensional array in Java? A) Int[][]arr;. B) Int[[]] arr;. C) Int[] arr;. D) Int arr[[]];. Show Answer Correct Answer: A) Int[][]arr;. 34. Which one of these is correct about a set? A) X = {1, 2, 3, 4}. B) X = [1, 2, 3, 4]. C) X = {"a":1, "b":2, "c":3, "d":4}. D) X = (1, 2, 3, 4). Show Answer Correct Answer: A) X = {1, 2, 3, 4}. 35. Pointer is ..... data type A) Derived. B) Primary. C) User defined. D) None of above. Show Answer Correct Answer: A) Derived. 36. How do you create a button in Tkinter that performs an action when clicked?Criterion 2:Apply reasoning to solve real-world problems in various contexts A) Button = Button(root). B) Button = Button(root, text="Click Me"). C) Button = Button(root, text="Click Me", command=action). D) Button = Button("Click Me", action). Show Answer Correct Answer: C) Button = Button(root, text="Click Me", command=action). 37. What is a binary search and when is it used? A) A binary search is a method for searching in a linked list. B) A binary search is used to sort an unsorted array. C) A binary search is used to find an element in a sorted array efficiently. D) A binary search can find the maximum element in an array. Show Answer Correct Answer: C) A binary search is used to find an element in a sorted array efficiently. 38. Storage for data defined in terms of set of operations to be performed on the data A) Arrays. B) Variables. C) Algorithms. D) Abstract Data Types. Show Answer Correct Answer: D) Abstract Data Types. 39. Statement 1:When a node is split during insertion, the middle key is promoted to the parent as well as retained in right half-node.Statement 2:When a key is deleted from the leaf, it is also deleted from the non-leaf nodes of the tree. A) 1. Statement 1 is true but statement 2 is false. B) 2. Statement 2 is true but statement 1 is false. C) 3. Both the statements are true. D) 4. Both the statements are false. Show Answer Correct Answer: A) 1. Statement 1 is true but statement 2 is false. 40. Convert the following Infix expression to Postfix form using a stackx + y * z + (p * q + r) * s, Follow usual precedence rule and assume that the expression is legal. A) Xyz*+pq*r+s*+. B) Xyz*+pq*r+s+*. C) Xyzp+**qr+s*+. D) Xyz+*pq*r+s*+. Show Answer Correct Answer: A) Xyz*+pq*r+s*+. 41. Array is ..... data type. A) User defined. B) Primary. C) Derived. D) All of above. Show Answer Correct Answer: C) Derived. 42. Which of the following is the correct operator to compare two variables? A) =. B) ==. C) :=. D) Equal. Show Answer Correct Answer: B) ==. 43. What is the significance of the 'self' parameter in Python class methods? A) 'self' refers to the instance of the class and is used to access variables that belong to the class. B) 'self' is a keyword that indicates a static method in a class. C) 'self' is used to define class-level variables. D) 'self' is optional and can be omitted in class method definitions. Show Answer Correct Answer: A) 'self' refers to the instance of the class and is used to access variables that belong to the class. 44. What are the built-in data types in Python? A) Int, float, str, list, tuple, dict, set, bool. B) Float, string, object. C) Char, array, complex. D) Number, text, list. Show Answer Correct Answer: A) Int, float, str, list, tuple, dict, set, bool. 45. What is the difference between a list comprehension and a generator expression in Python? A) A list comprehension creates a list, while a generator expression creates an iterator. B) Both create lists, but a generator expression is faster. C) A list comprehension can only be used with lists, while a generator expression can be used with any iterable. D) There is no difference; they are interchangeable. Show Answer Correct Answer: A) A list comprehension creates a list, while a generator expression creates an iterator. 46. Which of the following application makes use of a circular linked list? A) Recursive function calls. B) Undo operation in a text editor. C) Implement Hash Tables. D) Allocating CPU to resources. Show Answer Correct Answer: D) Allocating CPU to resources. 47. People have used the word ..... to mean computer information that is transmitted or stored. A) Beta. B) Data. C) Database. D) None of above. Show Answer Correct Answer: B) Data. 48. Assertion(A):A stack is a LIFO data structureReason (R):Addition and deletion of items takes place at same end A) A is true and R is correct explanation. B) A is false and R is correct explanation. C) A is true and R is false. D) A is false and R is also false. Show Answer Correct Answer: A) A is true and R is correct explanation. 49. Which of the following is true about a circular queue? A) It does not allow any elements to be dequeued. B) It does not require additional memory compared to a regular queue. C) It allows for efficient use of space by reusing empty slots. D) It allows access to elements in random order. Show Answer Correct Answer: C) It allows for efficient use of space by reusing empty slots. 50. One can convert a binary tree to its mirror image by traversing it in A) Inorder. B) Preorder. C) Postorder. D) None of the above. Show Answer Correct Answer: C) Postorder. 51. What is the time complexity of a program to reverse a linked list? A) O(n). B) O(log n). C) O(n log n). D) O(1). Show Answer Correct Answer: D) O(1). 52. Which of the following highly uses the concept of an array? A) Caching. B) Scheduling of Processes. C) Spatial locality. D) Binary Search tree. Show Answer Correct Answer: C) Spatial locality. 53. Describe how to use filter to remove even numbers from a list. A) Filtered list = list(filter(lambda x:x % 2 != 0, original list)). B) Filtered list = filter(lambda x:x % 2 == 0, original list). C) Filtered list = list(filter(lambda x:x % 2 == 0, original list)). D) Filtered list = [x for x in original list if x % 2 == 1]. Show Answer Correct Answer: A) Filtered list = list(filter(lambda x:x % 2 != 0, original list)). 54. Maps in Python are known as dictionaries. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 55. Which of the following is NOT a basic data structure? A) Lists. B) Integers. C) Arrays. D) Graphs. Show Answer Correct Answer: D) Graphs. 56. What is a set in Python and how does it differ from a list? A) A set can contain duplicates, whereas a list cannot. B) A set is a collection of unique elements, while a list is an ordered collection that can contain duplicates. C) A set is an ordered collection of elements, while a list is a collection of unique items. D) A set is a mutable collection, while a list is immutable. Show Answer Correct Answer: B) A set is a collection of unique elements, while a list is an ordered collection that can contain duplicates. 57. What data structure can be used to check if a syntax has balanced paranthesis? A) Queue. B) Stack. C) List. D) Union. Show Answer Correct Answer: B) Stack. 58. In ..... data structure data items are not in sequence. A) Non linear. B) Linear. C) Non-homogeneous. D) All of above. Show Answer Correct Answer: A) Non linear. 59. After performing these set of operations, what does the final list look contain? InsertFront(10); InsertFront(20); InsertRear(30); DeleteFront(); InsertRear(40); InsertRear(10); DeleteRear(); InsertRear(15); display(); A) 20 30 40 15. B) 20 30 40 15. C) 20 30 40 15. D) 10 30 10 15. Show Answer Correct Answer: A) 20 30 40 15. 60. Which of the following is true about linked list implementation of stack? A) In push operation, if new nodes are inserted at the beginning of linked list, then in pop operation, nodes must be removed from end. B) In push operation, if new nodes are inserted at the end, then in pop operation, nodes must be removed from the beginning. C) Both of the above. D) None of the above. Show Answer Correct Answer: D) None of the above. ← 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 9 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books