0% found this document useful (0 votes)
62 views9 pages

Viva Questions and Answers

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)
62 views9 pages

Viva Questions and Answers

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/ 9

VIVA QUESTIONS AND ANSWERS

1) What is data structure?

Data structures refers to the way data is organized and manipulated. It seeks to find ways to make
data access more efficient. When dealing with data structure, we not only focus on one piece of
data, but rather different set of data and how they can relate to one another in an organized manner.

2) Differentiate file structure from storage structure.

Basically, the key difference is the memory area that is being accessed. When dealing with the
structure that resides the main memory of the computer system, this is referred to as storage
structure. When dealing with an auxiliary structure, we refer to it as file structures.

3) When is a binary search best applied?

A binary search is an algorithm that is best applied to search a list when the elements are already
in order or sorted. The list is search starting in the middle, such that if that middle value is not the
target search key, it will check to see if it will continue the search on the lower half of the list or
the higher half. The split and search will then continue in the same manner.

4) What is a linked list?

A linked list is a sequence of nodes in which each node is connected to the node following it. This
forms a chain-like link of data storage.

5) How do you reference all the elements in a one-dimension array?

To do this, an indexed loop is used, such that the counter runs from 0 to the array size minus one.
In this manner, we are able to reference all the elements in sequence by using the loop counter as
the array subscript.

6) In what areas do data structures applied?

Data structures is important in almost every aspect where data is involved. In general, algorithms
that involve efficient data structure is applied in the following areas: numerical analysis, operating
system, A.I., compiler design, database management, graphics, and statistical analysis, to name a
few.

7) What is LIFO?

LIFO is short for Last In First Out, and refers to how data is accessed, stored and retrieved. Using
this scheme, data that was stored last , should be the one to be extracted first. 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 a balanced tree?

A binary tree is balanced if the depth of two subtrees of every node never differ by more than
one)

27). Which data structure is needed to convert infix notations to post fix notations?

Stack

27). What is data structure or how would you define data structure?

In programming the term data structure refers to a scheme for organizing related piece of
information. Data Structure = Organized Data + Allowed Operations.)

28. Which data structures we can implement using link list?

Queue and Stack

29. List different types of data structures?


Link list, queue, stack, trees, files, graphs

30) What is Hashing

Hashing is a technique to convert a range of key values into a range of indexes of an array.
31)What is Data Structure?

Data structure is a fundamental concept of any programming language, essential for algorithmic
design.

It is used for the efficient organization and modification of data.

DS is how data and the relationship amongst different data is represented, that aids in how
efficiently various functions or operations or algorithms can be applied

32)What is an array?

Arrays are the collection of similar types of data stored at contiguous memory locations.

It is the simplest data structure where the data element can be accessed randomly just by using its
index number.

What is a multidimensional array?

Multi-dimensional arrays are those data structures that span across more than one dimension.

This indicates that there will be more than one index variable for every point of storage. This type
of data structure is primarily used in cases where data cannot be represented or stored using only
one dimension. Most commonly used multidimensional arrays are 2D arrays.

2D arrays emulates the tabular form structure which provides ease of holding the bulk of data that
are accessed using row and column pointers.

What is a linked list?

A linked list is a data structure that has sequence of nodes where every node is connected to the
next node by means of a reference pointer. The elements are not stored in adjacent memory
locations. They are linked using pointers to form a chain. This forms a chain-like link for data
storage.

Each node element has two parts:

• a data field
• a reference (or pointer) to the next node.

The first node in a linked list is called the head and the last node in the list has the pointer to NULL.
Null in the reference field indicates that the node is the last node. When the list is empty, the head
is a null reference.
How are linked lists more efficient than arrays?

Insertion and Deletion

Insertion and deletion process is expensive in an array as the room has to be created for the new
elements and existing elements must be shifted.

But in a linked list, the same operation is an easier process, as we only update the address present
in the next pointer of a node.

Dynamic Data Structure

Linked list is a dynamic data structure that means there is no need to give an initial size at the time
of creation as it can grow and shrink at runtime by allocating and deallocating memory.

Whereas, the size of an array is limited as the number of items is statically stored in the main
memory.

No wastage of memory

As the size of a linked list can grow or shrink based on the needs of the program, there is no
memory wasted because it is allocated in runtime.

In arrays, if we declare an array of size 10 and store only 3 elements in it, then the space for 3
elements is wasted. Hence, chances of memory wastage is more in arrays.

What is a doubly-linked list (DLL)? What are its applications.

This is a complex type of a linked list wherein a node has two references:

One that connects to the next node in the sequence

Another that connects to the previous node.


This structure allows traversal of the data elements in both directions (left to right and vice versa).

Applications of DLL are:

A music playlist with next song and previous song navigation options.

The browser cache with BACK-FORWARD visited pages

The undo and redo functionality on platforms such as word, paint etc, where you can reverse the
node to get to the previous page.

What is a stack? What are the applications of stack?

Stack is a linear data structure that follows LIFO (Last In First Out) approach for accessing
elements.

Push, pop, and top (or peek) are the basic operations of a stack.

What is a queue? What are the applications of queue?

A queue is a linear data structure that follows the FIFO (First In First Out) approach for accessing
elements.

Dequeue from the queue, enqueue element to the queue, get front element of queue, and get rear
element of queue are basic operations that can be performed.
How is a stack different from a queue?

In a stack, the item that is most recently added is removed first whereas in queue, the item least
recently added is removed first.

What is a tree data structure?

 Tree is a recursive, non-linear data structure consisting of the set of one or more data nodes
where one node is designated as the root and the remaining nodes are called as the children
of the root.
 Tree organizes data into hierarchial manner.
 The most commonly used tree data structure is a binary tree and its variants.
 Some of the applications of trees are:
1. Filesystems —files inside folders that are inturn inside other folders.
2. Comments on social media — comments, replies to comments, replies to replies
etc form a tree representation.
3. Family trees — parents, grandparents, children, and grandchildren etc that
represents the family hierarchy.

What are Binary trees?

A binary Tree is a special type of tree where each node can have at most two children. Binary tree
is generally partitioned into three disjoint subsets, i.e. the root of the tree, left sub-tree and right
sub-tree.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy