Data Structure Interview Questions and Answers, Exams of Computer Science

This overview covers essential data structure concepts like arrays, linked lists, stacks, and queues. It highlights the differences between linear and non-linear structures, explaining operations and array/linked list distinctions. Stack and queue implementations, infix/prefix/postfix notations, and singly/doubly/circular linked lists are detailed. It also addresses data structures for breadth-first search (bfs) and depth-first search (dfs) in graphs, plus methods to check if a binary tree is a binary search tree (bst). Valuable for students and professionals reinforcing data structure and algorithm understanding, it offers clear explanations and practical insights for interview preparation and academic study, providing a solid foundation in data structure principles.

Typology: Exams

2024/2025

Available from 07/29/2025

EXAMGUIDE
EXAMGUIDE 🇺🇸

4.4

(33)

32K documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
DATA STRUCTURE INTERVIEW
QUESTIONS AND ANSWERS
What is a Data Structure? - Correct Answers -A data structure is a way of organizing the
data so that the data can be used efficiently.
Non-Linear: A data structure is said to be non-linear if traversal of nodes is nonlinear in
nature. Example: Graph and Trees.
What are the various operations that can be performed on different Data Structures? -
Correct Answers -Insertion, Deletion, Traversal, Searching, Sorting
What are linear and non linear data Structures? - Correct Answers -Linear: A data
structure is said to be linear if its elements form a sequence or a linear list. Examples:
Array. Linked List, Stacks and Queues
How is an Array different from a Linked List - Correct Answers -array size is fixed,
Linked Lists size are Dynamic
insertion and deletion is easily done in Linked Lists, but for arrays is expensive
No Random access in Linked List
link lists need Extra memory space for a pointer
Arrays have better cache locality
What is Stack and where it can be used? - Correct Answers -Stack is a linear data
structure which the order LIFO(Last In First Out) for accessing elements.
Basic operations of stack are : Push, Pop , Peek
What is a Queue, how it is different from stack and how is it implemented? - Correct
Answers -Queue is a linear structure which follows the order is First In First Out (FIFO)
to access elements
queue is FIFO while stack is LIFO
implemented using Arrays or Linked Lists
pf2

Partial preview of the text

Download Data Structure Interview Questions and Answers and more Exams Computer Science in PDF only on Docsity!

DATA STRUCTURE INTERVIEW

QUESTIONS AND ANSWERS

What is a Data Structure? - Correct Answers -A data structure is a way of organizing the data so that the data can be used efficiently. Non-Linear: A data structure is said to be non-linear if traversal of nodes is nonlinear in nature. Example: Graph and Trees. What are the various operations that can be performed on different Data Structures? - Correct Answers -Insertion, Deletion, Traversal, Searching, Sorting What are linear and non linear data Structures? - Correct Answers -Linear: A data structure is said to be linear if its elements form a sequence or a linear list. Examples: Array. Linked List, Stacks and Queues How is an Array different from a Linked List - Correct Answers -array size is fixed, Linked Lists size are Dynamic insertion and deletion is easily done in Linked Lists, but for arrays is expensive No Random access in Linked List link lists need Extra memory space for a pointer Arrays have better cache locality What is Stack and where it can be used? - Correct Answers -Stack is a linear data structure which the order LIFO(Last In First Out) for accessing elements. Basic operations of stack are : Push, Pop , Peek What is a Queue, how it is different from stack and how is it implemented? - Correct Answers -Queue is a linear structure which follows the order is First In First Out (FIFO) to access elements queue is FIFO while stack is LIFO implemented using Arrays or Linked Lists

What are Infix, prefix, Postfix notations? - Correct Answers -Infix notation: X + Y Operators are written in-between their operands. Postfix notation: X Y + Operators are written after their operands. Prefix notation: + X Y Operators are written before their operands. What is a Linked List? - Correct Answers -A linked list is a linear data structure where each element is a separate object. Each node of a list is contains the data and a reference to the next node. What are the different types of linked list? - Correct Answers -Singly Linked List : every node stores address or reference of next node in list and the last node has next address as NULL. Doubly Linked List : One of the reference points to the next node and one to the previous node. Circular Linked List : all nodes are connected to form a circle, no NULL at the end, can be a singly circular linked list or doubly circular linked list. Which data structures are used for BFS and DFS of a graph? - Correct Answers -Queue is used for BFS Stack is used for DFS. DFS can also be implemented using recursion Can doubly linked be implemented using a single pointer variable in every node? - Correct Answers -Doubly linked list can be implemented using a single pointer. How to check if a given Binary Tree is BST or not? - Correct Answers -If inorder traversal of a binary tree is sorted, then the binary tree is BST.