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 6 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 12 Computer Science Chapter 1 Data Structures Using Python Quiz 6 (60 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. If the front pointer in a circular queue is at index 0 and the rear pointer is at index n-1, what is the length of the queue? A) N. B) N + 1. C) 0. D) N-1. Show Answer Correct Answer: A) N. 2. Tree is a specific form of ..... A) 2. B+-tree. B) 1. B-tree. C) 3. AVL tree. D) 4. Heap. Show Answer Correct Answer: B) 1. B-tree. 3. If l=[23, 4, 56, 78] and top=len(l)-1 what would be l[top]? A) 46. B) 56. C) 23. D) 78. Show Answer Correct Answer: D) 78. 4. Undo/Redo is implemented using ..... A) Tree. B) Stack. C) Queue. D) Linked List. Show Answer Correct Answer: B) Stack. 5. What does the .values() function do in Python Dictionaries? A) Returns the number of items in the Dictionary. B) Prints out all the keys within the Dictionary. C) Removes a key with its value from the Dictionary. D) Prints out all the values within the Dictionary. Show Answer Correct Answer: D) Prints out all the values within the Dictionary. 6. Which of the following is not the type of queue? A) Linear queue. B) Priority queue. C) Circular queue. D) Single ended queue. Show Answer Correct Answer: D) Single ended queue. 7. If the size of the stack is 10 and we try to add the 11th element in the stack then the condition is known as ..... A) Underflow. B) Garbage collection. C) Overflow. D) None of the above. Show Answer Correct Answer: C) Overflow. 8. Which of the following operations is performed more efficiently by doubly linked list than by singly linked list? A) Searching of an unsorted list for a given item. B) Traversing a list to process each node. C) Inverting a node after the node with given location. D) Deleting a node whose location in given. Show Answer Correct Answer: D) Deleting a node whose location in given. 9. What will happen if you try to add a duplicate item to a set? A) The set will throw an error when adding a duplicate item. B) The duplicate item will not be added to the set. C) The duplicate item will be added as a new entry in the set. D) The duplicate item will replace the existing item in the set. Show Answer Correct Answer: B) The duplicate item will not be added to the set. 10. In stack insertion and deletion can take place only at one end call the ..... of the stack. A) Bottom. B) Top. C) Function. D) Path. Show Answer Correct Answer: B) Top. 11. What will be the output of the following code:if x > 10:print('High') else:print('Low')? A) Always 'High'. B) Always 'Low'. C) Depends on the value of x. D) Prints 'Error' if x is not a number. Show Answer Correct Answer: C) Depends on the value of x. 12. What method in Python is used to sort elements in a list in ascending order? A) Organize(). B) Arrange(). C) Sort(). D) Order(). Show Answer Correct Answer: C) Sort(). 13. Which of the following is true about the memory allocation for arrays? A) Arrays are always allocated on the stack. B) Arrays always use contiguous blocks of memory. C) Arrays are never contiguous; they use dynamic memory allocation. D) Arrays are not allocated memory until they are used. Show Answer Correct Answer: B) Arrays always use contiguous blocks of memory. 14. In a list l=[2, 5, 8, 1] after pop an element what would be len(l) A) 2. B) 4. C) 1. D) 3. Show Answer Correct Answer: D) 3. 15. Consider a job scheduling problem with 4 jobs J$_{1}$, J$_{2}$, J$_{3}$, J$_{4}$ and with corresponding deadlines:( d$_{1}$, d$_{2}$, d$_{3}$, d$_{4}$) = (4, 2, 4, 2). Which of the following is not a feasible schedule without violating any job schedule? A) J$_{2}$, J$_{4}$, J$_{1}$, J$_{3}$. B) J$_{4}$, J$_{1}$, J$_{2}$, J$_{3}$. C) J$_{4}$, J$_{2}$, J$_{3}$, J$_{1}$. D) J$_{4}$, J$_{2}$, J$_{1}$, J$_{3}$. Show Answer Correct Answer: B) J$_{4}$, J$_{1}$, J$_{2}$, J$_{3}$. 16. Which statement determine whether a map contains the value "Pre-final" with the PF identifier? A) ThisMap.containsKey("Pre-final");. B) ThisMap.containsValue("Prefinal");. C) ThisMap.containsKey("PF");. D) ThisMap.containsValue("PF");. Show Answer Correct Answer: B) ThisMap.containsValue("Prefinal");. 17. Which of the following data structures can be used for parentheses matching? A) Stack. B) Priority queue. C) Queue. D) N-ary tree. Show Answer Correct Answer: A) Stack. 18. Colours = ['red', 'blue', 'yellow', 'green', 'purple']Which instruction illustrates mutability? A) Colours.remove('pink'). B) Colours[2] = 'pink'. C) Colours.append('pink'). D) Colours.insert(2, 'pink'). Show Answer Correct Answer: B) Colours[2] = 'pink'. 19. Why do we use data structure in programming language? A) For data organization. B) For stabilized mathematical and logical relationship in between the data item. C) A & B both. D) First only. Show Answer Correct Answer: C) A & B both. 20. Data in the data structures are processed by operations like insertion, deletion, sorting, merging and A) Traversing. B) Searching. C) Retrieval. D) Both A and B. Show Answer Correct Answer: D) Both A and B. 21. When does the ArrayIndexOutOfBoundsException occur? A) Compile-time. B) Run-time. C) Not an error. D) Not an exception at all. Show Answer Correct Answer: B) Run-time. 22. User perform following operations on stack of size 5 then-push(1);pop();push(2);push(3);pop();push(2);pop();pop();push(4);pop();pop();push(5); A) Overflow Occurs. B) Stack Operations will be performed Smoothly. C) Underflow Occurs. D) None of these. Show Answer Correct Answer: C) Underflow Occurs. 23. In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is (GATE CS 2002) A) N/2. B) Log(2*n)-1. C) N. D) Log(2*n). Show Answer Correct Answer: C) N. 24. The operation of processing each element in the list is known as A) Inserting. B) Merging. C) Traversal. D) Sorting. Show Answer Correct Answer: C) Traversal. 25. When should you use a dictionary? A) When you need labeled data with named fields. B) When you must preserve sorted order. C) When all values must be unique. D) When values must never change. Show Answer Correct Answer: A) When you need labeled data with named fields. 26. In Python, which operator is used for exponentiation? A) -. B) *. C) +. D) **. Show Answer Correct Answer: D) **. 27. What are the main characteristics of a set? A) A set is unordered, contains unique elements, and supports mathematical operations. B) A set is a collection of elements that can be modified. C) A set is ordered and can contain duplicate elements. D) A set only contains numeric values and no other types. Show Answer Correct Answer: A) A set is unordered, contains unique elements, and supports mathematical operations. 28. TREE[1]=NULL indicates is ..... A) Underflow. B) Full. C) Overflow. D) Empty. Show Answer Correct Answer: D) Empty. 29. Explain how to loop through a dictionary in Python. A) Dictionaries cannot be looped through in Python. B) You can loop through a dictionary using for key in my dict, for value in my dict.values(), or for key, value in my dict.items(). C) You can only loop through a dictionary using list comprehensions. D) You can loop through a dictionary using while loops. Show Answer Correct Answer: B) You can loop through a dictionary using for key in my dict, for value in my dict.values(), or for key, value in my dict.items(). 30. ..... is a way to represent data in memory. A) Data Handling. B) Data Structure. C) Data Dumping. D) Data Collection. Show Answer Correct Answer: B) Data Structure. 31. In which situation is a queue most commonly used? A) Storing elements of a tree. B) Storing elements for future processing in a first-come, first-served manner. C) Accessing elements randomly by index. D) Storing data in an unsorted manner. Show Answer Correct Answer: B) Storing elements for future processing in a first-come, first-served manner. 32. ..... operation changes the value of element given by user of the stack. A) Peep. B) Update. C) Pop. D) Push. Show Answer Correct Answer: B) Update. 33. A queue follows ..... A) FIFO (First In First Out) principle. B) Ordered array. C) Linear tree. D) LIFO (Last In First Out) principle. Show Answer Correct Answer: A) FIFO (First In First Out) principle. 34. Which is an attribute? A) Employee. B) Student. C) Teacher. D) Salary. Show Answer Correct Answer: D) Salary. 35. In the context of the activity 'Checking Even Numbers', what logical structure would most likely be implemented within the function? A) A try-except block. B) An if-else conditional statement. C) A for loop only. D) A while loop only. Show Answer Correct Answer: B) An if-else conditional statement. 36. Algorithm is a ..... procedure. A) Reverse. B) Shortcut. C) Step by step. D) Function. Show Answer Correct Answer: C) Step by step. 37. Insertion in Queue is done at ..... end, and deletion is at ..... end A) Begin, stop. B) Front, rear. C) Rear, front. D) Start, last. Show Answer Correct Answer: C) Rear, front. 38. The decision tree structure begins at a node called the ..... A) Root. B) Span. C) Top. D) Branch. Show Answer Correct Answer: A) Root. 39. Evaluate and write the result for the following postfix expressionabc*+de*f+g*+ where a=1, b=2, c=3, d=4, e=5, f=6, g=2. A) 60. B) 61. C) 55. D) 59. Show Answer Correct Answer: D) 59. 40. A data structure whose elements form a sequence is known as A) Non-Linear data structures. B) Heterogeneous data structure. C) Homogeneous data structure. D) Linear data structures. Show Answer Correct Answer: D) Linear data structures. 41. Which data structure in Python does not allow duplicate elements? A) List. B) Tuple. C) Dictionary. D) Set. Show Answer Correct Answer: D) Set. 42. How do you access values in a dictionary using keys? A) Use dictionary name[key] to access values. B) Use dictionary name.key to find values. C) Access values by calling dictionary name[key](). D) Use dictionary name.get(key) to retrieve values. Show Answer Correct Answer: A) Use dictionary name[key] to access values. 43. How do you access elements in a two-dimensional list? A) Access elements with list[index] in a single dimension. B) Elements can be accessed using list[row index] only. C) Use list[row index][column index] to access elements. D) Use list[column index][row index] to access elements. Show Answer Correct Answer: C) Use list[row index][column index] to access elements. 44. Which method adds a new key-value pair? A) Student.add("major", "CIS"). B) Student.insert("major"). C) Student.append("major"). D) Student["major"] = "CIS". Show Answer Correct Answer: D) Student["major"] = "CIS". 45. Data is a collection of A) Facts. B) Raw material. C) Observation. D) All of the above. Show Answer Correct Answer: D) All of the above. 46. Consider the following statements in a Queue:enqueue(8); enqueue(2); enqueue(6); enqueue(4); dequeue();enqueue(5);What is the current size of the queue? A) 6. B) 5. C) 4. D) 3. Show Answer Correct Answer: C) 4. 47. If for an algorithm time complexity is given by O(n) then complexityof it is: A) Constant. B) Linear. C) Exponential. D) None of the mentioned. Show Answer Correct Answer: B) Linear. 48. Which of the following is an incorrect array declaration? A) Int arr[] = int [5] new. B) Int arr[] = new int[5]. C) Int [] arr = new int[5]. D) Int arr[] = new int[5]. Show Answer Correct Answer: A) Int arr[] = int [5] new. 49. What does the following piece of code do?public void func(Tree root) { func(root.left()); func(root.right()); System.out.println(root.data()); } A) Postorder traversal. B) Level order traversal. C) Inorder traversal. D) Preorder traversal. Show Answer Correct Answer: A) Postorder traversal. 50. Suppose the numbers 7, 5, 1, 8, 3, 6, 0, 9, 4, 2 are inserted in that order into an initially empty binary search tree. The binary search tree uses the usual ordering on natural numbers. What is the in-order traversal sequence of the resultant tree? A) 0 2 4 3 1 6 5 9 8 7. B) 9 8 6 4 2 3 0 1 5 7. C) 7 5 1 0 3 2 4 6 8 9. D) 0 1 2 3 4 5 6 7 8 9. Show Answer Correct Answer: D) 0 1 2 3 4 5 6 7 8 9. 51. What is the significance of immutability in tuples? A) Immutability ensures data integrity, allows tuples to be hashable, and enables performance optimizations. B) Immutability reduces memory usage and increases data redundancy. C) Immutability allows for dynamic data changes and flexibility. D) Immutability prevents tuples from being used in sets or dictionaries. Show Answer Correct Answer: A) Immutability ensures data integrity, allows tuples to be hashable, and enables performance optimizations. 52. The process of Visiting each element in any Data structure is termed as ..... A) Traversing. B) Movement. C) Visiting. D) Searching. Show Answer Correct Answer: A) Traversing. 53. Which one of the below mentioned is linear data structure? A) Queue. B) Stack. C) Arrays. D) All of the above. Show Answer Correct Answer: D) All of the above. 54. Rotating a linked list by some places clockwise will take a time complexity of? A) O(n). B) O(n log n). C) O(1). D) O(log n). Show Answer Correct Answer: A) O(n). 55. (A):Array is collection of homogenous elements.(B):Array 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. 56. A graph is a collection of nodes, called ..... And line segments called arcs or ..... that connect pair of nodes. A) Vertices, paths. B) Vertices, edges. C) Edges, vertices. D) Graph node, edges. Show Answer Correct Answer: B) Vertices, edges. 57. In a list l=[1, 2, 3, 6], what would be the output of val =l.pop() A) 1. B) 3. C) 6. D) 2. Show Answer Correct Answer: C) 6. 58. State the meaning of "void" keyword: A) No statement. B) No function. C) No program. D) No value. Show Answer Correct Answer: D) No value. 59. If the insertion and deletion happens from both the ends then the queue is called a ..... Queue A) Circular Queue. B) Header. C) Deque. D) Queue. Show Answer Correct Answer: C) Deque. 60. Deletion from a stack is A) Remove. B) Del. C) Pop. D) Cancel. Show Answer Correct Answer: C) Pop. ← 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 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