SV
StudyVirus
Get our free app!Download Free

Data Structures — Set 1

Computers · डेटा संरचनाएं · Questions 110 of 50

00
0/10
1

Which data structure operates on the LIFO (Last-In-First-Out) principle?

💡

Correct Answer: A. Stack

A Stack is a linear data structure where the last element added is the first one to be removed. This principle is commonly used in function calls and undo mechanisms in software. It supports two primary operations known as push and pop.

2

In a database, which data structure is primarily used to speed up data retrieval operations through indexing?

💡

Correct Answer: A. B-Tree

B-Trees are balanced tree data structures that maintain sorted data and allow for efficient searches and insertions. They are the standard structure for implementing indexes in most relational database management systems. Their design minimizes disk I/O operations by keeping the tree height low.

3

Which of the following is a non-linear data structure used to represent hierarchical relationships?

💡

Correct Answer: D. Tree

A Tree consists of nodes connected by edges, starting from a single root node. It is ideal for representing folder structures in operating systems or organizational charts. Binary trees are a specific type where each node has at most two children.

4

Which data structure follows the FIFO (First-In-First-Out) principle?

💡

Correct Answer: A. Queue

In a Queue, the element that is added first is the one that gets processed or removed first. This is similar to a real-world waiting line at a ticket counter. It is widely used in CPU scheduling and asynchronous data transfer.

5

What is the primary advantage of using a Linked List over a standard Array?

💡

Correct Answer: D. Dynamic memory allocation

Linked Lists allow for the size of the data structure to grow or shrink during runtime without moving existing elements. Unlike arrays, elements in a linked list are not stored in contiguous memory locations. Each node contains a data field and a reference to the next node.

6

Which data structure consists of a set of vertices and edges used to represent network connections?

💡

Correct Answer: A. Graph

A Graph is a versatile data structure used to model complex relationships such as social networks or transit routes. It can be directed or undirected depending on the nature of the connections. Graphs are fundamental to algorithms like Google Maps for pathfinding.

7

Which data structure uses a technique to map keys to specific indices in an array for near-instant data retrieval?

💡

Correct Answer: D. Hash Table

A Hash Table uses a mathematical hash function to compute an index into an array of buckets. This allows for very fast search, insertion, and deletion operations on average. It is frequently used for implementing associative arrays and database caches.

8

In a circular queue, what happens after the last position of the array is reached during insertion?

💡

Correct Answer: A. The pointer wraps around to the first position

A circular queue connects the end back to the beginning to avoid wasting space in the array. This allows for more efficient memory utilization compared to a standard linear queue. It is commonly used in buffering applications and traffic light control systems.

9

Which tree traversal method visits the root node after visiting both the left and right subtrees?

💡

Correct Answer: D. Post-order

Post-order traversal follows the Left-Right-Root sequence for visiting nodes. This method is particularly useful for deleting a tree or evaluating mathematical expressions in postfix notation. It ensures that child nodes are processed before their parents.

10

Which data structure is best suited for implementing a recursive algorithm like the Factorial calculation?

💡

Correct Answer: A. Stack

A Stack is used by the computer's memory management to keep track of active function calls during recursion. Each recursive call pushes a new frame onto the system stack. When the base case is reached, the results are popped off in reverse order.