# Data Structure Questions and Answers-Queue using Array

## 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
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-
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
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)
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