Practice 30 C Programming Questions on Queue
Q1. Implement a basic queue using an array. Write functions to enqueue and dequeue an element, and display the queue contents.
Q2. Write a C program to check if a queue is empty or full. Use an array to represent the queue.
Q3. Implement a queue using an array and write a function to get the front element without removing it.
Q4. Create a circular queue implementation using an array. Implement functions to enqueue, dequeue, and display the elements.
Q5. Write a C program to count the number of elements in a queue represented by an array.
Q6. Write a C program to implement a queue using a linked list. Include functions to enqueue, dequeue, and display the elements.
Q7. Implement a function in C to find the size of a queue using a linked list.
Q8. Write a C program to get the rear element of a queue implemented using a linked list without removing it.
Q9. Implement a queue using two stacks. Write functions to enqueue and dequeue elements.
Q10. Implement a priority queue using an array. Insert elements with different priorities and display the queue in order of priority.
Q11. Implement a circular queue using a linked list. Include functions to enqueue, dequeue, and display elements in the circular queue.
Q12. Write a C program to reverse a queue using a stack. Use an array to represent the queue.
Q13. Write a program to implement a double-ended queue (deque) using an array. Allow adding and removing elements from both ends.
Q14. Write a program in C to implement a queue where each element is a string. Include functions to enqueue, dequeue, and display all elements.
Q15. Implement a C program that uses a queue to store even numbers only. Allow enqueue operations but reject any odd number.
Q16. Write a C program to count the number of elements in a queue. Implement the queue using an array and include functions to enqueue, dequeue, and count the elements.
Q17. Implement a program to clear (reset) a queue in C. Use an array and include enqueue, dequeue, and clear functions.
Q18. Write a C program that checks if a queue is empty or full using an array.
Q19. Implement a queue using an array and write a function to peek at the front element without removing it.
Q20. Write a C program to rotate a queue by moving the front element to the rear. Use an array to represent the queue.
Q21. Write a C program to implement a priority queue using an array, where lower numbers have higher priority. Include functions to enqueue elements with a given priority, dequeue the highest-priority element, and display the queue.
Q22. Write a C program to implement a queue using two stacks. Use two arrays to simulate the stacks, and provide functions to enqueue, dequeue, and display elements.
Q23. Implement a C program that allows users to input elements into a queue until a specific value (e.g., -1) is entered. Then, display all the elements in the queue.
Q24. Write a C program to find the maximum element in a queue. Implement the queue using an array.
Q25. Write a C program to copy elements from one queue to another. Use arrays to represent both queues.
Q26. Write a C program to reverse a queue using an auxiliary stack. Use an array to represent the queue, and include functions for enqueue, dequeue, and reverse.
Q27. Implement a circular queue in C using an array. Include functions to enqueue, dequeue, and display elements.
Q28. Write a C program to implement a double-ended queue (deque) using an array. Include functions to insert elements at both ends and delete elements from both ends.
Q29. Write a C program to check if a given sequence of operations (enqueue and dequeue) on a queue is possible.
Q30. Write a C program to implement a queue where the rear pointer moves to the beginning of the array when it reaches the end (circular queue behavior). Include enqueue, dequeue, and display functions.
Bikki Singh
Hi, I am the instructor of TechnoVlogs. I have a strong love for programming and enjoy teaching through practical examples. I made this site to help people improve their coding skills by solving real-world problems. With years of experience, my goal is to make learning programming easy and fun for everyone. Let's learn and grow together!