In an array based implementationof a queue a possible solution to dealing with the full condition is to

A. All other answers

B. Check for frontIndex equal to backIndex

C.wait for an arrayFullException to be thrown

D. Maintain a count of queue items

Answer :

Answer:

D. Maintain a count of queue items.

Explanation:

For checking the full condition of a queue you have to  check whether the number of elements in the array are equal to the size of the array.If they are equal then we can that the queue is full.

Checking frontindex equal to backindex is for checking if the queue is empty.

In option C we have to check for arrayFullException but it will not be a good approach.

So we conclude by saying that the answer is option D.

Other Questions