Monday, 27 November 2017

Short Answer types Questions of Data Structure

1. What is the difference between a queue and a stack?
A queue is typically First In First Out (FIFO), while a stack is Last In First Out (LIFO). In queue the elements get inserted at one end and retrieved from the other end, while in stack the insertion and removal operations are done at the same end.

2. What is the difference between storing data on the heap vs. on the stack?
The stack is smaller, but quicker for creating variables, while the heap is limited in size only by how much memory can be allocated. Stack would include most compile time variables, while heap would include anything created with malloc or new. 

3. What are priority queues?
Priority queue is a collection of elements such that each element has been assigned a priority.

4. What is the condition to be checked for the multiplication of two matrices?
If matrices are to be multiplied, the number of columns of first matrix should be equal to the number of rows of second matrix.

5. What is a string?
A sequential array of characters is called a string.

6. What is use terminating null character?
Null character is used to check the end of string.

7. What is an empty string?
A string with zero character is called an empty string.

8. What are the operations that can be performed on a string?
The following are the operations that can be performed on a string: finding the length of string, copying string, string comparison, string concatenation, finding substring etc.

9. What is Brute Force algorithm?
Algorithm used to search the contents by comparing each element of array is called Brute Force algorithm.

10. What are the limitations of arrays?
a. Arrays are of fixed size.
b. Data elements are stored in continuous memory locations which may not be available always.
c. Adding and removing of elements is problematic because of shifting the locations.

11. How can you overcome the limitations of arrays?
Limitations of arrays can be solved by using the linked list.

12. What is a linked list?
Linked list is a data structure which store same kind of data elements but not in continuous memory locations and size is not fixed. The linked lists are related logically.


Thanks
Mukesh Rajput

No comments:

Post a Comment

Thanks
Mukesh Rajput