Ds Viva Questions and Answers: AIT Chikkamagaluru
Ds Viva Questions and Answers: AIT Chikkamagaluru
This also means that in order to gain access to the first data, all the other data that was stored
before this first data must first be retrieved and extracted.
8 ) What is a queue?
A queue is a data structures that can simulates a list or stream of data. In this structure,
new elements are inserted at one end and existing elements are removed from the other end.
9) What are binary trees?
A binary tree is one type of data structure that has two nodes, a left node and a right node.
In programming, binary trees are actually an extension of the linked list structures.
10) Which data structures is applied when dealing with a recursive function?
Recursion, which is basically a function that calls itself based on a terminating condition,
makes use of the stack. Using LIFO, a call to a recursive function saves the return address so that
it knows how to return to the calling function after the call terminates.
11) What is a stack?
A stack is a data structure in which only the top element can be accessed. As data is
stored in the stack, each data is pushed downward, leaving the most recently added data on top.
12) Explain Binary Search Tree
A binary search tree stores data in such a way that they can be retrieved very efficiently.
The left subtree contains nodes whose keys are less than the node’s key value, while the right
subtree contains nodes whose keys are greater than or equal to the node’s key value. Moreover,
both subtrees are also binary search trees.
13) What are multidimensional arrays?
Multidimensional arrays make use of multiple indexes to store data. It is useful when
storing data that cannot be represented using a single dimensional indexing, such as data
representation in a board game, tables with data stored in more than one column.
14) Are linked lists considered linear or non-linear data structures?
It actually depends on where you intend to apply linked lists. If you based it on storage, a
linked list is considered non-linear. On the other hand, if you based it on access strategies, then a
linked list is considered linear.
15) How does dynamic memory allocation help in managing data?
Aside from being able to store simple structured data types, dynamic memory allocation
can combine separately allocated structured blocks to form composite structures that expand and
contract as needed.
16) What is FIFO?
FIFO is short for First-in, First-out, and is used to represent how data is accessed in a
queue. Data has been inserted into the queue list the longest is the one that is removed first.
17) What is an ordered list?
An ordered list is a list in which each node’s position in the list is determined by the
value of its key component, so that the key values form an increasing sequence, as the list is
traversed.
18) What is merge sort?
Merge sort takes a divide-and-conquer approach to sorting data. In a sequence of data,
adjacent ones are merged and sorted to create bigger sorted lists. These sorted lists are then
merged again to form an even bigger sorted list, which continuous until you have one single
sorted list.
19) Differentiate NULL and VOID.
Null is actually a value, whereas Void is a data type identifier. A variable that is given a
Null value simply indicates an empty value. Void is used to identify pointers as having no initial
size.
20) What is the primary advantage of a linked list?
A linked list is a very ideal data structure because it can be modified easily. This means
that modifying a linked list works regardless of how many elements are in the list.
21) What is the difference between a PUSH and a POP?
Pushing and popping applies to the way data is stored and retrieved in a stack. A push
denotes data being added to it, meaning data is being “pushed” into the stack. On the other hand,
a pop denotes data retrieval, and in particular refers to the topmost data being accessed.
22) What is a linear search?
A linear search refers to the way a target key is being searched in a sequential data
structure. Using this method, each element in the list is checked and compared against the target
key, and is repeated until found or if the end of the list has been reached.
23) How does variable declaration affect memory allocation?
The amount of memory to be allocated or reserved would depend on the data type of the
variable being declared. For example, if a variable is declared to be of integer type, then 32 bits
of memory storage will be reserved for that variable.
24) What is the advantage of the heap over a stack?
Basically, the heap is more flexible than the stack. That’s because memory space for the
heap can be dynamically allocated and de-allocated as needed. However, memory of the heap
can at times be slower when compared to that stack.
25) What is a postfix expression?
A postfix expression is an expression in which each operator follows its operands. The
advantage of this form is that there is no need to group sub-expressions in parentheses or to
consider operator precedence.
26) What is the difference between the HEAP and the STACK?
(Solution: HEAP is used to store dynamically allocated memory (malloc). STACK stores static
data (int, const).)
27) Where in memory are HEAP and the STACK located relative to the executing program?
(Solution: The STACK and HEAP are stored "below" the executing program. The HEAP
"grows" toward the program executable while the STACK grows away from it.)
28) Describe the data structures of a double-linked list.
(Solution: A double-linked list structure contains one pointer to the previous record in the list
and a pointer to the next record in the list plus the record data.)
29) How do you insert a record between two nodes in double-linked list?
(Solution: Previous R; Data R; Next R; To insert a record (B) between two others (A and C):
Previous.B = A; Next.B = C; Next.A = B; Previous.C = B;)
30) In which data structure, elements can be added or removed at either end, but not in the
middle?
(Solution: queue)
31) Which one is faster? A binary search of an orderd set of elements in an array or a
sequential search of the elements.
(Solution: binary search)
32) What is a balanced tree?
(Solution: A binary tree is balanced if the depth of two subtrees of every node never differ by
more than one)
33) Which data structure is needed to convert infix notations to post fix notations?
(Solution: stack)
34) What is data structure or how would you define data structure?
(Solution: In programming the term data structure refers to a scheme for organizing related piece
of information. Data Structure = Organized Data + Allowed Operations.)
35) Which data structures we can implement using link list?
(Solution: queue and stack)
36) List different types of data structures?
(Solution: Array, Link list, queue, stack, trees, files, graphs)
37) Define a linear and non linear data structure.
Linear data structure: A linear data structure traverses the data elements sequentially, in
which only one data element can directly be reached. Ex: Arrays, Linked Lists Non-Linear data
structure: Every data item is attached to several other data items in a way that is specific for
reflecting relationships. The data items are not arranged in a sequential structure. Ex: Trees,
Graphs