The greatest mistake you can make in life is to be continually fearing you will make one

Wednesday 10 February 2010

Problems based on Queue

Problem 1:
Suppose that a client performs an intermixed sequence of enqueue and dequeue operations in a queue.The enqueue operations put the integers o through 9 in order on to the queue, the dequeue operations print out the return value.Which of the following sequences could not occur?
  1. 0 1 2 3 4 5 6 7 8 9
  2. 4 6 8 7 5 3 2 9 0 1
  3. 2 5 6 7 4 8 9 3 1 0
  4. 4 3 2 1 0 5 6 7 8 9
Problem 2
In a queue, if rear=front then what will be the queue
a) Queue is empty
b) Queue is full
c) Queue has only one element
d) none of the above

Problem 3
In a queue,if rear=0,front=0 then what will be the queue
a) Queue is empty
b) Queue is full
c) Queue has only one element
d) none of the above

Problem 4
In a queue,if rear=0,front=1 then what will be the queue
a) Queue is empty
b) Queue is full
c) Queue has only one element
d) Queue is circular

Problem 5
In a queue,if rear=-1,front=-1 then what will be the queue
a) Queue is empty
b) Queue is full
c) Queue has only one element
d) none of the above

Problem 6
In a queue,if rear=max-1,front=0 then what will be the queue
a) Queue is empty
b) Queue is full
c) Queue has only one element
d) none of the above

1 comment:

  1. Hi there, I wish for to subscribe for this blog to
    get most up-to-date updates, so where can i do it please assist.


    Also visit my blog ... registry cleaner software
    My webpage > microsoft registry cleaner

    ReplyDelete