0% found this document useful (0 votes)
47 views1 page

Stack & Queue

The document outlines programming tasks involving the creation of stack and queue classes in Python, including operations for numbers and student details. It also includes exercises for converting infix expressions to postfix, evaluating postfix expressions, and demonstrating stack contents during evaluations. The document is prepared by Sooraj Rajmohan from Indian Excellent Pvt. School.

Uploaded by

Sooraj Rajmohan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views1 page

Stack & Queue

The document outlines programming tasks involving the creation of stack and queue classes in Python, including operations for numbers and student details. It also includes exercises for converting infix expressions to postfix, evaluating postfix expressions, and demonstrating stack contents during evaluations. The document is prepared by Sooraj Rajmohan from Indian Excellent Pvt. School.

Uploaded by

Sooraj Rajmohan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Program Based Questions

1. Define stack class in python to operate on stack of numbers.


2. Define queue class in python to operate on stack of numbers.
3. Define stack class in python to operate on stack of student details like rollno and name
4. Define queue class in python to operate on stack of student details like rollno and
name
5. Write a function for PUSH and POP operation in a stack
6. Write a function for INSERT and DELETE operations in Queue
7. Convert the following infix expressions to postfix expressions
1. (((x*y –a*b)-d/f)+a)*b
2. (a+(((b-(c*d-e)+f))/g))*(h-j)
3. A+B*(P+Q)^C/D
4. A+B-C*D+F-G
5. A^B-A/(B*(A-B-A*D)/B)
6. A+((B-C)*(D-E)+F/G)^(H-J)
7. (A+B) *(C^(D-E)+F-G
8. A*(B+(C+D)*(E+F)/G)*H
9. A*(B+C)/D-E-(F+G/H)
10. A + B * C ^ D – (E / F – G)
11. A – B + C * D ^ E * G / H
12. ((A+B)-((CD)*E/F)*G
13. (TRUE && FALSE) || ! (FALSE || TRUE)
14. (A + B * C ) / D + E / (F * G + H / I)
15. NOT A OR NOT B AND NOT C
8. Evaluate the following postfix expression E given below, show the contents of the stack
during the evaluation
16. E=2, 10,*,15,-,25,5,/,2, +, -
17. E= 7,6,2,^,*,18,+
18. E= 120,45,20,+,25,15,-,+,*
19. TRUE FALSE TRUE FALSE NOT OR TRUE OR AND OR
20. E= 30,5,2,^,12,6,/,+,-
21. 15, 3, 2, +, /, 7, + 2, *
22. 25, 8, 3, - , / 6, *, 10 +
23. AB – CD + E * + WHERE A = 5, B = 3, C = 5, D = 4 AND E = 2
24. 7,6, +, 8, * , 2, -, 3, * , 2, 4, * , -
25. 8, 7, +, 9, 8, +, -, 2, / , 3,4, *, 2, /, +
26. E= 5,20,15,-,*,25,2,*,+
27. E= 5,9,+,2,*,4,1,1,3,-,*,-. +

Prepared By: Sooraj Rajmohan (Indian Excellent Pvt. School PGT Computer Science) Mobile: 00971 55 44 77 670

You might also like