DSA VIVA QUESTIONS:-
UNIT – 1
1. What is Data structure?
Answer:- Data Structure can be defined as the group of data elements which provides an
efficient way of storing and organising data in the computer.
2. What is Data?
Answer:- The term ‘DATA’ simply referes to a a value or a set of values.
3. What is Group items and elementary items?
Answer:- Data items that can be divided into sub items are called group items where as those
who can not be divided in to sub items are called elementary items.
4. What are the applications of data structure?
Answer:-
5. What is linear data structure?
Answer:- A linear data structure is a structure in which the elements are stored sequentially, and
the elements are connected to the previous and the next element.
6. What are the examples of linear data structure?
Answer:- Array, Queue, Stack, Linked List.
7. What is non-linear data structure?
Answer:- A non-linear data structure is also another type of data structure in which the data
elements are not arranged in a contiguous manner.
8. What are the examples of non-linear data structure?
Answer:- Trees and Graphs.
9. What is asymptomatic notation?
Answer:- Asymptotic notations are mathematical tools to represent the time complexity of
algorithms for asymptotic analysis.
10. Name 3 popularly used asymptomatic notation.
Answer:- Theeta Notation, BIG-O notation, Omega Notation.
11. What do you mean by Theeta notation?
Answer:- The theta notation bounds a functions from above and below, so it defines exact
asymptotic behavior.
,12. What do you mean by BIG-O notation?
Answer:- The Big O notation defines an upper bound of an algorithm.
13. What do you mean by Omega Notation?
Answer:- The Omega notation defines the lower bound of an algorithm.
14. What is Complexity?
Answer:- The complexity of an algorithm is a function describing the efficiency of the algorithm
in terms of the amount of data the algorithm must process.
15. What is time complexity?
Answer:- Time complexity is a function describing the amount of time an algorithm takes in
terms of the amount of input to the algorithm.
16. What is worst-case time complexity?
Answer:- In the worst case analysis, we calculate upper bound on running time of an algorithm
17. What is average case time complexity?
Answer:- In average case analysis, we take all possible inputs and calculate computing time for
all of the inputs. Sum all the calculated values and divide the sum by total number of inputs.
18. What is best case time complexity?
Answer:- In the best case analysis, we calculate lower bound on running time of an algorithm.
19. What is space complexity?
Answer:- Space complexity is a function describing the amount of memory (space) an algorithm
takes in terms of the amount of input to the algorithm.
20. Name few operations available in Data Structure?
Answer:- Traversing, Searching, sorting, insertion, deletion, etc
21. What is traversing/searching/sorting/insertion/deletion ?
Answer:-
i.) Traversing:- Accessing each record exactly once so that certain items in the
record may be processed.
ii.) Searching:- Finding the location of a particular record with a given key value.
iii.) Inserting:- Adding a new record to the structure.
iv.) Deleting:- removing the record from the structure.
v.) Sorting:- Managing the data or record in some logical order
22. Name two Searching Method.
Answer:- Linear search and binary search
23. What is threaded list?
, Answer:- threaded list A list in which additional linkage structures, called threads, have been
added to provide for traversals in special orders.
24. Name few sorting methods.
Answer:- Bubble sort, Selection sort, insertion sort, merge sort, quick sort.
25. What is selection Sort and what we exactly do in it?
Answer:- Selection sort is a simple sorting algorithm. This sorting algorithm is an in-place
comparison-based algorithm in which the list is divided into two parts, the sorted part at the left
end and the unsorted part at the right end. Initially, the sorted part is empty and the unsorted
part is the entire list.
The smallest element is selected from the unsorted array and swapped with the leftmost
element, and that element becomes a part of the sorted array. This process continues moving
unsorted array boundary by one element to the right.
26. What is bubble sort and what we exactly do in it?
Answer:- Bubble sort is a simple sorting algorithm. This sorting algorithm is comparison-based
algorithm in which each pair of adjacent elements is compared and the elements are swapped if
they are not in order. This algorithm is not suitable for large data sets as its average and worst
case complexity are of Ο(n2) where n is the number of items.
27. What is insertion sort and what we exactly do in it?
Answer:- This is an in-place comparison-based sorting algorithm. Here, a sub-list is maintained
which is always sorted. For example, the lower part of an array is maintained to be sorted. An
element which is to be 'insert'ed in this sorted sub-list, has to find its appropriate place and then
it has to be inserted there. Hence the name, insertion sort.
28. What is merge sort and what we exactly do in it?
Answer:- Merge sort is a sorting technique based on divide and conquer technique. With worst-
case time complexity being Ο(n log n), it is one of the most respected algorithms. Merge sort
first divides the array into equal halves and then combines them in a sorted manner.
29. Name any stable sorting algorithm.
Answer:- Merge sort, Insertion sort, Bubble sort, count sort
30. Why is it called Stable?
Answer:- Because in this two objects with equal keys appear in the same order in sorted output
as they appear in the input array to be sorted.
31. What is binary search and what exactly we do in it?
Answer:- Binary search looks for a particular item by comparing the middle most item of the
collection. If a match occurs, then the index of item is returned. If the middle item is greater
than the item, then the item is searched in the sub-array to the left of the middle item.
Otherwise, the item is searched for in the sub-array to the right of the middle item. This process
continues on the sub-array as well until the size of the subarray reduces to zero.
UNIT – 1
1. What is Data structure?
Answer:- Data Structure can be defined as the group of data elements which provides an
efficient way of storing and organising data in the computer.
2. What is Data?
Answer:- The term ‘DATA’ simply referes to a a value or a set of values.
3. What is Group items and elementary items?
Answer:- Data items that can be divided into sub items are called group items where as those
who can not be divided in to sub items are called elementary items.
4. What are the applications of data structure?
Answer:-
5. What is linear data structure?
Answer:- A linear data structure is a structure in which the elements are stored sequentially, and
the elements are connected to the previous and the next element.
6. What are the examples of linear data structure?
Answer:- Array, Queue, Stack, Linked List.
7. What is non-linear data structure?
Answer:- A non-linear data structure is also another type of data structure in which the data
elements are not arranged in a contiguous manner.
8. What are the examples of non-linear data structure?
Answer:- Trees and Graphs.
9. What is asymptomatic notation?
Answer:- Asymptotic notations are mathematical tools to represent the time complexity of
algorithms for asymptotic analysis.
10. Name 3 popularly used asymptomatic notation.
Answer:- Theeta Notation, BIG-O notation, Omega Notation.
11. What do you mean by Theeta notation?
Answer:- The theta notation bounds a functions from above and below, so it defines exact
asymptotic behavior.
,12. What do you mean by BIG-O notation?
Answer:- The Big O notation defines an upper bound of an algorithm.
13. What do you mean by Omega Notation?
Answer:- The Omega notation defines the lower bound of an algorithm.
14. What is Complexity?
Answer:- The complexity of an algorithm is a function describing the efficiency of the algorithm
in terms of the amount of data the algorithm must process.
15. What is time complexity?
Answer:- Time complexity is a function describing the amount of time an algorithm takes in
terms of the amount of input to the algorithm.
16. What is worst-case time complexity?
Answer:- In the worst case analysis, we calculate upper bound on running time of an algorithm
17. What is average case time complexity?
Answer:- In average case analysis, we take all possible inputs and calculate computing time for
all of the inputs. Sum all the calculated values and divide the sum by total number of inputs.
18. What is best case time complexity?
Answer:- In the best case analysis, we calculate lower bound on running time of an algorithm.
19. What is space complexity?
Answer:- Space complexity is a function describing the amount of memory (space) an algorithm
takes in terms of the amount of input to the algorithm.
20. Name few operations available in Data Structure?
Answer:- Traversing, Searching, sorting, insertion, deletion, etc
21. What is traversing/searching/sorting/insertion/deletion ?
Answer:-
i.) Traversing:- Accessing each record exactly once so that certain items in the
record may be processed.
ii.) Searching:- Finding the location of a particular record with a given key value.
iii.) Inserting:- Adding a new record to the structure.
iv.) Deleting:- removing the record from the structure.
v.) Sorting:- Managing the data or record in some logical order
22. Name two Searching Method.
Answer:- Linear search and binary search
23. What is threaded list?
, Answer:- threaded list A list in which additional linkage structures, called threads, have been
added to provide for traversals in special orders.
24. Name few sorting methods.
Answer:- Bubble sort, Selection sort, insertion sort, merge sort, quick sort.
25. What is selection Sort and what we exactly do in it?
Answer:- Selection sort is a simple sorting algorithm. This sorting algorithm is an in-place
comparison-based algorithm in which the list is divided into two parts, the sorted part at the left
end and the unsorted part at the right end. Initially, the sorted part is empty and the unsorted
part is the entire list.
The smallest element is selected from the unsorted array and swapped with the leftmost
element, and that element becomes a part of the sorted array. This process continues moving
unsorted array boundary by one element to the right.
26. What is bubble sort and what we exactly do in it?
Answer:- Bubble sort is a simple sorting algorithm. This sorting algorithm is comparison-based
algorithm in which each pair of adjacent elements is compared and the elements are swapped if
they are not in order. This algorithm is not suitable for large data sets as its average and worst
case complexity are of Ο(n2) where n is the number of items.
27. What is insertion sort and what we exactly do in it?
Answer:- This is an in-place comparison-based sorting algorithm. Here, a sub-list is maintained
which is always sorted. For example, the lower part of an array is maintained to be sorted. An
element which is to be 'insert'ed in this sorted sub-list, has to find its appropriate place and then
it has to be inserted there. Hence the name, insertion sort.
28. What is merge sort and what we exactly do in it?
Answer:- Merge sort is a sorting technique based on divide and conquer technique. With worst-
case time complexity being Ο(n log n), it is one of the most respected algorithms. Merge sort
first divides the array into equal halves and then combines them in a sorted manner.
29. Name any stable sorting algorithm.
Answer:- Merge sort, Insertion sort, Bubble sort, count sort
30. Why is it called Stable?
Answer:- Because in this two objects with equal keys appear in the same order in sorted output
as they appear in the input array to be sorted.
31. What is binary search and what exactly we do in it?
Answer:- Binary search looks for a particular item by comparing the middle most item of the
collection. If a match occurs, then the index of item is returned. If the middle item is greater
than the item, then the item is searched in the sub-array to the left of the middle item.
Otherwise, the item is searched for in the sub-array to the right of the middle item. This process
continues on the sub-array as well until the size of the subarray reduces to zero.