Which of the following data structures is most commonly used in implementing a graph?
A Linked List
B Stack
C Queue
D Adjacency List
The adjacency list is the most common data structure for representing graphs. It stores a list of all vertices and their adjacent vertices. It is space efficient for sparse graphs compared to an adjacency matrix.
Which memory allocation technique allows memory to be allocated in fixed sized blocks?
A Paging
B Segmentation
C Dynamic Memory Allocation
D Heap Memory
Paging is a memory allocation technique that divides memory into fixed sized blocks or pages. This allows non contiguous memory allocation, making it easier to manage memory and avoid fragmentation.
Which data structure is used in AI for representing hierarchical structures?
A Linked List
B Tree
C Queue
D Stack
Trees are widely used in AI to represent hierarchical structures, such as decision trees, which are used for classification, and search trees, which are used in algorithms like minimax for game AI.
Which of the following is a key application of a stack in real world systems?
A Task scheduling
B Undo operations
C Database indexing
D Sorting
A stack is ideal for implementing undo operations in software because it works on a Last In First Out (LIFO) principle. When a user performs an action, the previous state is pushed onto the stack, allowing for easy reversal of actions.
What is the primary use of a hash table in applications?
A Storing large datasets
B Efficient searching
C Sorting elements
D Representing graphs
Hash tables are used primarily for efficient searching and retrieval of data. By using a hash function, they map keys to array indices, allowing for average O(1) time complexity for insertions, deletions, and lookups.
Which of the following data structures is used for fast text search in natural language processing (NLP)?
A Queue
B Trie
C Binary Search Tree
D Stack
A Trie is widely used in NLP for fast text search and prefix matching. It allows efficient lookup and autocomplete features by storing strings in a tree like structure, where each node represents a character.
In memory management, what is the main advantage of segmentation?
A It allows contiguous allocation
B It simplifies memory allocation
C It supports dynamic memory allocation
D It eliminates fragmentation
Segmentation divides the memory into segments of varying sizes, such as code, data, and stack segments. This allows for dynamic memory allocation, where each segment can grow or shrink independently, offering flexibility in memory management.
Which data structure is used to implement the depth first search (DFS) algorithm?
A Stack
B Queue
C Array
D Linked List
Depth First Search (DFS) uses a stack to explore a graph or tree. The algorithm starts at the root and explores as far as possible along each branch before backtracking, which is efficiently managed using a stack data structure.
Which technique is often used to reduce memory usage in large datasets in AI?
A Sparse matrices
B Hash tables
C Linked lists
D Arrays
Sparse matrices are used to represent large datasets where most of the elements are zero. They store only the non zero elements, significantly reducing memory usage and making matrix operations more efficient, especially in machine learning applications.
Which of the following data structures is most suitable for implementing a priority queue?
A Stack
B Queue
C Binary Heap
D Array
A Binary Heap is the most efficient data structure for implementing a priority queue. It allows insertion and deletion of the highest or lowest priority element in O(log n) time, making it ideal for scheduling algorithms and task management systems.
In artificial intelligence, which data structure is commonly used in decision making algorithms?
A Queue
B Graph
C Tree
D Stack
Decision making algorithms, such as those used in game AI, often rely on trees like the minimax tree. A tree structure allows for hierarchical decision making, where each node represents a decision, and the leaves represent possible outcomes.
Which of the following algorithms uses dynamic programming for optimization?
A Quick Sort
B Merge Sort
C Dijkstraโs Algorithm
D Fibonacci Sequence
The Fibonacci sequence can be optimized using dynamic programming by storing previously computed values (memoization). This eliminates redundant calculations, reducing the time complexity from O(2^n) to O(n).
What is the time complexity of inserting an element in a balanced binary search tree (BST)?
A O(1)
B O(log n)
C O(n)
D O(n log n)
In a balanced binary search tree, such as an AVL or Red Black Tree, the insertion operation takes O(log n) time, as the tree remains balanced, ensuring that the height of the tree is logarithmic with respect to the number of nodes.
Which memory allocation technique requires breaking the memory into fixed sized blocks?
A Paging
B Segmentation
C Stack allocation
D Dynamic allocation
Paging is a memory management technique that divides memory into fixed sized blocks called pages. This helps in avoiding external fragmentation, allows efficient memory usage, and simplifies memory management in operating systems.
Which data structure is used in the implementation of a union find algorithm for network connectivity?
A Linked List
B Array
C Disjoint Set Union (DSU)
D Stack
The Disjoint Set Union (DSU) is the primary data structure used in the union find algorithm. It efficiently handles the merging of sets and finding the root of each set, which is crucial for problems related to network connectivity and dynamic connectivity in graphs.