# Data Structure and Algorithm Analysis Set 25

## Data Structure and Algorithm Analysis

### Questions 241 to 250

 241 Standard queue operations are (a)  empty(), fill(), place(), remove()                        (b)  enque(), dequeue(), isempty(), isfull() (c)  init(), delete(), add()                                         (d)  isempty(), isfull(), fill(), remove() (e)  isempty(), isfull(), init(), delete(), add(). 242 Assume that variable A is a sorted array of integers of length L. Consider the following code segment:        int k=1, flag=0;       for (   ;  k

#### Answers

 241 Answer : (b) Reason:  As fill( ), place( ), add( ),empty( )are not the standard operations on queue, while enque ( ), dequeue( ), isempty( ), isfull( ) are the standard one. 242 Answer : (d) Reason:  Because this is an array, and k is the index. So k, k-1 are the adjacent index values. 243 Answer : (c) Reason:  Because the precondition for binary search is, the array must be there in sorted order, should not contain duplicate values and may have positive or negative values. 244 Answer : (e) Reason:  To keep track of the planets a fixed size array is enough as the number of plants is finite value. In addition, to keep track of complex information as a single logical unit structure is the best suitable data structure. For predetermined list array is suitable. 245 Answer : (a) Reason:  As the circular queue is given, if the empty places are there at any place and rear pointer R is a rear index, then this is the best ever formula to increment R. All other are not valid or appropriate one. 246 Answer : (b) Reason:  Because, in  queue always the new entries are inserted at the end of queue, no matter the queue is implemented as array or linked list. 247 Answer : (e) Reason:  As all the other options are meaning less. 248 Answer : (a) Reason:  As the ‘next’ field of the node is holding NULL address, means it is the last node       . 249 Answer : (d) Reason:  As in lists only one data item of some type can only be stored. More data items can’t be stored in a list. 250 Answer : (a) Reason:  As using insert we are inserting the elements in queue are 1, 2, 3, 4, 5, 6, 7, 8, 9. Then using printf statement we are displaying the first element, then we are deleting the front element twice (i.e. 1, 2) then again we are displaying front element.

<< PrevNext >>

#### No comments :

What you think about these Questions and Answers ? Let me know in comments.