0% found this document useful (0 votes)
86 views3 pages

DS 1 Mark QA Stack Queue Tree Graph

The document contains a series of 1-mark questions and answers related to data structures, specifically focusing on stacks, queues, trees, and graphs. Key concepts include definitions, operations, and properties of each data structure, such as LIFO for stacks and FIFO for queues. It also covers traversal methods and representations like adjacency matrices and lists for graphs.

Uploaded by

shaikjaveed2240
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views3 pages

DS 1 Mark QA Stack Queue Tree Graph

The document contains a series of 1-mark questions and answers related to data structures, specifically focusing on stacks, queues, trees, and graphs. Key concepts include definitions, operations, and properties of each data structure, such as LIFO for stacks and FIFO for queues. It also covers traversal methods and representations like adjacency matrices and lists for graphs.

Uploaded by

shaikjaveed2240
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1-Mark Questions and Answers - Data Structures

STACK - 1 Mark Questions

Q: What is a stack?

A: A stack is a linear data structure that follows the LIFO (Last In First Out) principle.

Q: Which operations are performed on a stack?

A: Push, Pop, Peek (or Top).

Q: What is the time complexity of push and pop operations in a stack?

A: O(1) (constant time).

Q: Which data structure is used for implementing recursion?

A: Stack

Q: Give an example of a real-life application of a stack.

A: Undo feature in text editors.

Q: Which operation is not possible when the stack is empty?

A: Pop

Q: What is stack overflow?

A: Trying to push an element into a full stack.

QUEUE - 1 Mark Questions

Q: What is a queue?

A: A queue is a linear data structure that follows the FIFO (First In First Out) principle.

Q: Name the two main operations of a queue.

A: Enqueue and Dequeue.

Q: What is circular queue?

A: A queue where the last position is connected back to the first position to make a circle.

Q: What is the condition for queue overflow?

A: In a linear queue, when rear = size - 1.


Q: What is the front pointer in a queue used for?

A: To point to the first element in the queue.

Q: What is deque?

A: A Double Ended Queue where insertion and deletion can be done from both ends.

Q: Which queue allows insertion and deletion from both ends?

A: Deque

TREES - 1 Mark Questions

Q: What is a tree in data structure?

A: A tree is a non-linear hierarchical data structure with nodes connected by edges.

Q: What is the topmost node of a tree called?

A: Root

Q: What is a binary tree?

A: A tree where each node has at most two children.

Q: What is the degree of a node?

A: The number of children of that node.

Q: What is the height of a tree?

A: The length of the longest path from the root to a leaf.

Q: What is a leaf node?

A: A node with no children.

Q: Which traversal method is used to get the prefix expression of an expression tree?

A: Preorder traversal

Q: Which traversal method gives sorted output in BST?

A: Inorder traversal

GRAPHS - 1 Mark Questions

Q: What is a graph?

A: A graph is a set of vertices (nodes) connected by edges.


Q: What are the two main types of graphs?

A: Directed and Undirected graphs.

Q: What is an adjacency matrix?

A: A 2D array used to represent a graph where the cell (i, j) indicates the presence of an edge.

Q: What is an adjacency list?

A: A list where each node stores a list of its adjacent vertices.

Q: What is a connected graph?

A: A graph where there is a path between every pair of vertices.

Q: What is a cycle in a graph?

A: A path that starts and ends at the same vertex without repeating any edge.

Q: Which traversal uses a queue: BFS or DFS?

A: BFS (Breadth-First Search)

Q: Which data structure is used in DFS?

A: Stack (explicit or system call stack)

You might also like