DATA STRUCTURES IN
PROGRAMMING EXAM QUESTIONS
AND ANSWERS
Array - Correct Answers -Is a collection of items stored together in memory locations.
The idea is simply to store multiple items of the same type together.
Linked List - Correct Answers -Is a linear data structure, in which the elements are not
stored at contiguous memory locations. Simply, a linked list consists of nodes where
each node contains a data field and a reference to the next node in the list.
Binary Tree - Correct Answers -Is a tree whose elements have at most 2 children. Since
each element in a binary tree can have only 2 children, you would typically name them
the left and right child. The Binary Tree node also contains the data, pointer to the left
and pointer to the right.
Binary Search Tree - Correct Answers -Is a node-based binary tree data structure which
shows the left sub tree of a node and contains only nodes with keys lesser than the
node's key. The right sub tree of a node contains only nodes with keys greater than the
node's key and the left and right sub tree each must also be a binary search tree.
Heap - Correct Answers -Is a special Tree-based data structure in which the tree is a
complete binary tree. Generally, Heaps can be of two types: A Max Heap or a Min
Heap.
Stack - Correct Answers -Is a linear data structure which follows a particular order in
which the operations are performed. The order could be LIFO (Last In First Out) or FILO
(First In Last Out).
Queue - Correct Answers -Is a linear structure which follows a particular order in which
the operations are performed. The order is First In First Out (FIFO). A good example of
a queue is any queue of consumers for a resource where the consumer that came first
is served first. The difference between stacks and queues is in removing. In a stack we
remove the item the most recently added; in a queue, we remove the item the least
recently added.
Hashing - Correct Answers -Is an important Data Structure which is designed to use a
special function called the Hash function which is used to map a given value with a
PROGRAMMING EXAM QUESTIONS
AND ANSWERS
Array - Correct Answers -Is a collection of items stored together in memory locations.
The idea is simply to store multiple items of the same type together.
Linked List - Correct Answers -Is a linear data structure, in which the elements are not
stored at contiguous memory locations. Simply, a linked list consists of nodes where
each node contains a data field and a reference to the next node in the list.
Binary Tree - Correct Answers -Is a tree whose elements have at most 2 children. Since
each element in a binary tree can have only 2 children, you would typically name them
the left and right child. The Binary Tree node also contains the data, pointer to the left
and pointer to the right.
Binary Search Tree - Correct Answers -Is a node-based binary tree data structure which
shows the left sub tree of a node and contains only nodes with keys lesser than the
node's key. The right sub tree of a node contains only nodes with keys greater than the
node's key and the left and right sub tree each must also be a binary search tree.
Heap - Correct Answers -Is a special Tree-based data structure in which the tree is a
complete binary tree. Generally, Heaps can be of two types: A Max Heap or a Min
Heap.
Stack - Correct Answers -Is a linear data structure which follows a particular order in
which the operations are performed. The order could be LIFO (Last In First Out) or FILO
(First In Last Out).
Queue - Correct Answers -Is a linear structure which follows a particular order in which
the operations are performed. The order is First In First Out (FIFO). A good example of
a queue is any queue of consumers for a resource where the consumer that came first
is served first. The difference between stacks and queues is in removing. In a stack we
remove the item the most recently added; in a queue, we remove the item the least
recently added.
Hashing - Correct Answers -Is an important Data Structure which is designed to use a
special function called the Hash function which is used to map a given value with a