In: Computer Science
The following sequence of operations essentially leaves a queue unchanged.
Group of answer choices
enqueue followed by dequeue
dequeue followed by enqueue
two enqueues followed by two dequeues
two isEmptys followed by two isFulls
A standard linked list provides a good implementation of a "Deque".
Group of answer choices
True
False
The main thread of a Java program cannot generate additional threads.
Group of answer choices
True
False
The text's link-based queue is being used and holds an empty queue. We can say:
Group of answer choices
at this point in time an invocation of the enqueue method would throw an exception.
at this point in time an invocation of the dequeue method would throw an exception.
the value of front is -1.
Q)The following sequence of operations essentially leaves a queue unchanged.
Ans) Option d two isEmptys followed by two isFulls
Explanation: isEmptys() and isFulls are the checks that are performed to check whether the queue is empty or full and the queue is unchanged, option a,b and c are incorrect since enqueue() and dequeue() change the front and rear values of the queue.
Q)A standard linked list provides a good implementation of a "Deque".
Ans)False
Explanation: Standard linked list is not a good option for making a good implementation of double ended queue, instead circular doubly likned list would be a good option.
Q)The main thread of a Java program cannot generate additional threads.
Ans)False
Explanation: Any thread including the main thread can create additional threads in java, the thread creating the new thread is called as parent thread.
Q)The text's link-based queue is being used and holds an empty queue. We can say:
Ans)Option c at this point in time an invocation of the dequeue method would throw an exception.
Explanation: When the queue is empty the front holds zero and rear holds capacity-1 and when dequeu is performed on an empty queue, ideally it should throw queue underflow exception
NOTE:Please upvote if you liked my answer and comment if you need any modification or explanation.