In queue we can acess only front but why in my code i also getting the output of front as well as back element as we only aceess front in case of queue please correct me

Hi @kailash_01

We can access last or newly inserted element in queue using .back() function but we can pop from the front of the queue only.

Hope it Helps.