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 3 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 12 Computer Science Chapter 1 Data Structures Using Python Quiz 3 (60 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What are hash tables and how do they work? A) Hash tables are data structures that use a hash function to map keys to values for efficient data retrieval. B) Hash tables are a type of linked list that organizes data sequentially. C) Hash tables are used for storing images and videos in databases. D) Hash tables are primarily designed for sorting large datasets efficiently. Show Answer Correct Answer: A) Hash tables are data structures that use a hash function to map keys to values for efficient data retrieval. 2. What is the advantage of a hash table as a data structure? A) Exhibit good locality of reference. B) Very efficient for less number of entries. C) Easy to implement. D) Faster access of data. Show Answer Correct Answer: D) Faster access of data. 3. The result of evaluating the postfix expression 5, 4, 6, +, *, 4, 9, 3, /, +, * is A) 350. B) 250. C) 400. D) 600. Show Answer Correct Answer: A) 350. 4. What is a data structure? A) A type of software. B) A programming language. C) A computer hardware component. D) A specialized format for organizing and storing data. Show Answer Correct Answer: D) A specialized format for organizing and storing data. 5. Linked list is considered as an example of ..... type of memory allocation. A) Dynamic. B) Static. C) Compile time. D) None of the mentioned. Show Answer Correct Answer: A) Dynamic. 6. In linked list implementation of a queue, where does a new element be inserted? A) At the head of link list. B) At the tail of the link list. C) At the centre position in the link list. D) None. Show Answer Correct Answer: B) At the tail of the link list. 7. Which of the following is useful in traversing a given graph by breadth first search? A) Op 1:stack. B) Op 2:set. C) Op 3:list. D) Op 4:queue. Show Answer Correct Answer: D) Op 4:queue. 8. What will the output of the following code snippet?void solve() { int a[] = {1, 2, 3, 4, 5}; int sum = 0; for(int i = 0; i < 5; i++) { if(i % 2 == 0) { sum += *(a + i); } else { sum-= *(a + i); } } cout << sum << endl;} A) 3. B) 15. C) 2. D) Syntax error. Show Answer Correct Answer: A) 3. 9. Which of the following is an example of a constant in Python? A) Pi = 3.14159. B) X = 5. C) My string = "Hello, World!". D) None of the above. Show Answer Correct Answer: D) None of the above. 10. How may index numbers are used in accessing a 2D array? A) 1. B) 4. C) 3. D) 2. Show Answer Correct Answer: D) 2. 11. N elements of a Queue are to be reversed using another queue. The number of "ADD" and "REMOVE"operations required to do so is: A) The task cannot be accomplished. B) N. C) 2*n. D) 4*n. Show Answer Correct Answer: A) The task cannot be accomplished. 12. Which of these tree traversal methods is used to output the contents of a binary tree in ascending order? A) Pre-Order. B) Post-Order. C) In-Order. D) Monastic Orders. Show Answer Correct Answer: C) In-Order. 13. With what data structure can a priority queue be implemented? A) List. B) Array. C) Tree. D) Heap. Show Answer Correct Answer: D) Heap. 14. In this type of search, a sequential search is made over all items one by one. A) Search. B) Binary Search. C) Linear Search. D) None of the above. Show Answer Correct Answer: C) Linear Search. 15. What do you call a collection of items stored at contiguous memory locations? A) Data Structure. B) Linked List. C) Array. D) Linear List. Show Answer Correct Answer: C) Array. 16. How do you implement a queue using two stacks? A) By using one stack for enqueue operations and another for dequeue operations, transferring elements as needed. B) By using both stacks for enqueue operations and only one for dequeue operations. C) By using a single stack and reversing the order of elements for dequeue operations. D) By using a circular linked list to simulate the behavior of a queue. Show Answer Correct Answer: A) By using one stack for enqueue operations and another for dequeue operations, transferring elements as needed. 17. Heap can be used as ..... A) Normal Array. B) A decreasing order array. C) Priority queue. D) Stack. Show Answer Correct Answer: C) Priority queue. 18. 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); A) 3. B) 2. C) 1. D) 4. Show Answer Correct Answer: C) 1. 19. For the 'Calculating Distance' activity that uses 'input() function', what data type conversion is most likely needed? A) Convert input to boolean for logical operations. B) Convert input to list for iteration. C) No conversion is needed. D) Convert input to integer or float for mathematical operations. Show Answer Correct Answer: D) Convert input to integer or float for mathematical operations. 20. The no of external nodes in a full binary tree with n internal nodes is? A) 2n. B) 2n+1. C) N. D) N+1. Show Answer Correct Answer: D) N+1. 21. How can you check if a key exists in a dictionary? A) Use 'dictionary.contains(key)'. B) Use 'dictionary.has key(key)'. C) Check 'key in list'. D) Use 'key in dictionary' or 'dictionary.get(key)'. Show Answer Correct Answer: D) Use 'key in dictionary' or 'dictionary.get(key)'. 22. Can I remove a element from a tuple once created? A) No, tuples are immutable once created. B) Idk you tell me. C) Yes, tuples have mutable values. D) Why is tulip spelled weird?. Show Answer Correct Answer: A) No, tuples are immutable once created. 23. Which data structure is best for storing matrices? A) Queue. B) Array. C) Stack. D) Tree. Show Answer Correct Answer: B) Array. 24. Below is a stack operationint x = a[top ..... ]; return x;if top becomes zero, then what is that condition called? A) Underflow. B) Overflow. C) Push. D) Pop. Show Answer Correct Answer: A) Underflow. 25. Which of the following is NOT a Type of Data Structures? A) Stacks. B) Trees. C) Tables. D) Arrays. Show Answer Correct Answer: C) Tables. 26. Which of the following options is not true about the Binary Search tree? A) The value of the right child should be greater than the root node. B) The value of the left child should be less than the root node. C) The left and right subtrees should also be a binary search tree. D) None of the above. Show Answer Correct Answer: D) None of the above. 27. What is the output of the expression len({1, 2, 3})? A) 5. B) 4. C) 3. D) 2. Show Answer Correct Answer: C) 3. 28. Stack Operations always performs A) Top Position. B) Bottom Position. C) Center Position. D) None of the above. Show Answer Correct Answer: A) Top Position. 29. ..... operation adds an element to the top of the stack. A) Pop. B) Push. C) Peep. D) All of the above. Show Answer Correct Answer: B) Push. 30. What is a python set? A) A data structure that is a collection of unique values. B) A data structure that is a ordered. C) Idk. D) A data structure that is a collection of key-value pairs. Show Answer Correct Answer: A) A data structure that is a collection of unique values. 31. Each key can map to several values. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: B) False. 32. Discuss the concept of nested lists in Python with an example. A) Nested lists in Python are used for defining functions. B) Nested lists in Python are used for creating dictionaries. C) Nested lists in Python allow for creating a list of lists, for example:nested list = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]. D) Nested lists in Python are used for mathematical calculations. Show Answer Correct Answer: C) Nested lists in Python allow for creating a list of lists, for example:nested list = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]. 33. Which one of the following is the overflow condition if a circular queue is implemented using array having size MAX? A) Rear= MAX-1. B) Rear=MAX. C) Front=(rear+1) mod max. D) None of the above. Show Answer Correct Answer: C) Front=(rear+1) mod max. 34. Which of the following is NOT a valid use case for a priority queue? A) Sorting a list of elements. B) Reversing a string. C) Implementing Dijkstra's shortest path algorithm. D) Job scheduling in an operating system. Show Answer Correct Answer: B) Reversing a string. 35. What kind of data structure is user ..... data in the following declaration? user ..... data = ["TJ", 24, "artLover123"] A) Tuple. B) String. C) 2d List. D) List. Show Answer Correct Answer: D) List. 36. How do you iterate over the keys of a dictionary using a for loop? A) For key in range(len(my dict)):. B) For key in my dict.keys():. C) For key in my dict.items():. D) For key in my dict.values():. Show Answer Correct Answer: B) For key in my dict.keys():. 37. In the following scenarios, when will you use selection sort? A) The input is already sorted. B) A large file has to be sorted. C) Large values need to be sorted with small keys. D) Small values need to be sorted with large keys. Show Answer Correct Answer: C) Large values need to be sorted with small keys. 38. What is the value of the postfix expression 6 3 2 4 +-*: A) 74. B) 1. C) 14. D) -18. Show Answer Correct Answer: D) -18. 39. What is the data structure used to perform recursion? A) Stack. B) Queue. C) Linked list. D) Array. Show Answer Correct Answer: A) Stack. 40. A graph is a tree if and only if graph is A) Contains no cycles. B) Planar. C) Directed graph. D) Completely connected. Show Answer Correct Answer: A) Contains no cycles. 41. Which of the following statements about arrays is true? A) Arrays can store only elements of the same data type. B) Arrays cannot have elements of more than one dimension. C) Arrays are dynamic in nature. D) Arrays can store elements of different data types. Show Answer Correct Answer: A) Arrays can store only elements of the same data type. 42. In dynamic programming, the technique of storing the previously calculated values is called ..... A) Saving value property. B) Memorization. C) Mapping. D) Storing value property. Show Answer Correct Answer: B) Memorization. 43. What is the base case in a recursive function? A) The base case is the first function call in recursion. B) The base case is the maximum depth of recursion allowed. C) The base case is the part of the function that handles all inputs. D) The base case is the condition that terminates the recursion. Show Answer Correct Answer: D) The base case is the condition that terminates the recursion. 44. ..... the condition indicate the queue is empty. A) Front=Rear. B) Front=Null. C) Null=Front. D) Rear=Null. Show Answer Correct Answer: B) Front=Null. 45. This stores its elements in a hash table without a guaranteed order upon iteration. A) Set. B) TreeSet. C) HashSet. D) LinkedHashSet. Show Answer Correct Answer: C) HashSet. 46. ..... is an example of non linear data structure A) Tree. B) Sorting. C) Queue. D) Stack. Show Answer Correct Answer: A) Tree. 47. Set A = { 1, 3, 5, 7 }Set B = { 2, 3, 4, 5 }The difference of sets A and B (A-B) is ..... ? A) { 3}. B) { 5 }. C) { 3, 5}. D) { 1, 7 }. Show Answer Correct Answer: D) { 1, 7 }. 48. What is the purpose of the 'in' keyword in Python? A) The 'in' keyword is used to import modules in Python. B) The 'in' keyword is for creating loops in Python. C) The 'in' keyword checks if a value is present in a sequence or collection. D) The 'in' keyword is used to define a function in Python. Show Answer Correct Answer: C) The 'in' keyword checks if a value is present in a sequence or collection. 49. What is the purpose of the reduce function? A) To reduce an iterable to a single cumulative value by applying a function. B) To sort an iterable in ascending order using a function. C) To filter elements from an iterable based on a condition. D) To map each element of an iterable to a new value using a function. Show Answer Correct Answer: A) To reduce an iterable to a single cumulative value by applying a function. 50. In java, array elements are stored in ..... memory locations A) Random. B) Sequential. C) Sequential & Random. D) Binary search. Show Answer Correct Answer: B) Sequential. 51. What is the purpose of the reduce function in Python? A) To reduce an iterable to a single cumulative value using a specified function. B) To filter elements from an iterable based on a condition. C) To sort an iterable in ascending order. D) To create a new iterable from an existing one. Show Answer Correct Answer: A) To reduce an iterable to a single cumulative value using a specified function. 52. Act of adding values into a stack is called A) Popping. B) Polling. C) Pushing. D) None. Show Answer Correct Answer: C) Pushing. 53. Explain the concept of recursion in programming. A) Recursion is a method where a function calls itself to solve smaller instances of a problem. B) Recursion is a method of storing data in a database. C) Recursion is when a function is executed multiple times without any conditions. D) Recursion is a technique where a function runs in a loop until a condition is met. Show Answer Correct Answer: A) Recursion is a method where a function calls itself to solve smaller instances of a problem. 54. What should be the value of rear (end) if the queue is full (elements are completely occupied )? A) MAX-1. B) MAX + 1. C) 1. D) -1. Show Answer Correct Answer: A) MAX-1. 55. Minimum nodes possible height for a AVL tree with 16 nodes A) Either 3 or 4. B) 3. C) 2. D) 4. Show Answer Correct Answer: D) 4. 56. Which of the following is the most widely used external memory data structure? A) AVL tree. B) B-tree. C) Red-black tree. D) Both AVL tree and Red-black tree. Show Answer Correct Answer: B) B-tree. 57. Can dictionary keys be of any data type? A) All data types can be used as dictionary keys. B) Only strings can be used as dictionary keys. C) Dictionary keys must be numeric types only. D) Yes, but only immutable data types can be used as dictionary keys. Show Answer Correct Answer: D) Yes, but only immutable data types can be used as dictionary keys. 58. In which algorithm takes less time or space is called A) Best case. B) Worst case. C) Average case. D) None of the above. Show Answer Correct Answer: A) Best case. 59. Which situation is best for using a tuple? A) Holding temporary inputs. B) Storing fixed values that should not change. C) Saving key-value pairs. D) Storing values that will be updated frequently. Show Answer Correct Answer: B) Storing fixed values that should not change. 60. How can you check if an item exists in a tuple in Python? A) Using the 'in' keyword. B) Using the .exist() method. C) Using the .remove() method. D) Using the .add() method. Show Answer Correct Answer: A) Using the 'in' keyword. ← 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 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 8Class 12 Computer Science Chapter 1 Data Structures Using Python Quiz 9 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books