
Practice 30 C Programming Questions on Stack
Q1. Write a program to implement a stack using arrays. Implement the basic operations: push, pop, and display.
Q2. Write a program to implement the peek operation to view the top element of a stack.
Q3. Modify the stack implementation to include checks for overflow and underflow.
Q4. Write a program that checks if the stack is empty.
Q5. Write a program that checks if the stack is full.
Q6. Write a program to reverse a string using a stack.
Q7. Write a program to check if an expression has balanced parentheses using a stack.
Q8. Write a program to convert a decimal number to binary using a stack.
Q9. Write a program to convert an infix expression to postfix using a stack.
Q10. Write a program to check if a given string is a palindrome using a stack.
Q11. Write a program to evaluate a postfix expression using a stack.
Q12. Modify the display function to print the stack elements from bottom to top.
Q13. Implement a stack using a linked list. Include push, pop, and display functions.
Q14. Write a program to sort a stack using a temporary stack.
Q15. Write a program to implement a stack with a dynamic size using malloc.
Q16. Write a program to reverse a stack using recursion.
Q17. Write a program to check if two stacks are equal.
Q18. Write a program to convert an infix expression to postfix using a stack.
Q19. Write a function to find the maximum element in a stack without modifying the stack.
Q20. Write a function to find the minimum element in a stack without modifying the stack.
Q21 . Write a function to count the number of elements in a stack without modifying the stack.
Q22. Write a program to calculate the sum of all elements in a stack.
Q23. Write a function to clone a stack, copying all elements to a new stack.
Q24. Write a function to check if the stack is full.
Q25. Write a function to check if the stack is empty.
Q26. Write a peek function to return the top element of the stack without removing it.
Q27. Write a program to check if parentheses in an expression are balanced.
Q28. Write a function to print alternate elements of a stack.
Q29. Write a program to implement a stack using two queues.
Q30. Write a program to sort a stack using recursion.