Data Structure Questions and Answers-Queue using Array

 

 Help authour, Buy PDF Ebook   >>>Click Here<<<

Data Structure Questions and Answers-Queue using Array

Question 1
Which of the following properties is associated with a queue?
A
First In Last Out
B
First In First Out
C
Last In First Out
D
None of the mentioned
Economics Questions answers
Question 1 Explanation: 
Queue follows First In First Out structure.

Question 2
In a circular queue, how do you increment the rear end of the queue?
A
rear++
B
(rear+1) % CAPACITY
C
(rear % CAPACITY)+1
D
rear-
Home science Questions answers
Question 2 Explanation: 
Ensures rear takes the values from 0 to (CAPACITY-1).

Question 3
What is the term for inserting into a full queue known as?
A
overflow
B
underflow
C
null pointer exception
D
all of the mentioned
English literature Questions answers
Question 3 Explanation: 
Just as stack, inserting into a full queue is termed overflow.

Question 4
What is the time complexity of enqueue operation?
A
O(logn)
B
O(nlogn)
C
O(n)
D
O(1)
ICT Questions answers
Question 4 Explanation: 
Enqueue operation is at the rear end, it takes O(1) time to insert a new item into the queue.

Question 5
What does the following piece of code do?

public Object function() { 	if(isEmpty()) 	return -999; 	else 	{ 		Object high; 		high = q[front]; 		return high; 	} }
A
Dequeue
B
Enqueue
C
Return the front element
D
None of the mentioned
Economics Questions answers
Question 5 Explanation: 
q[front] gives the element at the front of the queue, since we are not moving the 'front' to the next element,

it is not a dequeue operation.

There are 5 questions to complete.

 

 Help authour, Buy PDF Ebook   >>>Click Here<<<