Evaluate the following Postfix notation of expression:
4,2,*,22,5,6,+,/,-
Element | Stack Contents |
4 | 4 |
2 | 4,2 |
* | 8 |
22 | 8, 22 |
5 | 8, 22, 5 |
6 | 8, 22, 5, 6 |
+ | 8, 22, 11 |
/ | 8, 2 |
- | 6 |
Sponsor Area
Evaluate the following Postfix notation of expression:
4,2,*,22,5,6,+,/,-
Element | Stack Contents |
4 | 4 |
2 | 4,2 |
* | 8 |
22 | 8, 22 |
5 | 8, 22, 5 |
6 | 8, 22, 5, 6 |
+ | 8, 22, 11 |
/ | 8, 2 |
- | 6 |
Sponsor Area
Differentiate between file modes r+ and rb+ with respect to Python.
Difference b/w r+ and rb+ with respect to Python
r+ | rb+ |
r+ Opens a file for both reading and writing. The file pointer placed at the beginning of the file. | rb+ Opens a file for both reading and writing in binary format. The file pointer placed at the beginning of the file. |
Evaluate the following postfix notation of expression. Show status of the stack after every operation.
22,11,/,14,10,,+,5,2
Element | Stack |
22 | 22 |
11 | 22, 11 |
/ | 2 |
14 | 2,14 |
10 | 2,14,10 |
- | 2,4 |
+ | 6 |
5 | 6,5 |
- | 1 |
Write a statement in Python to perform the following operations:
f1 = open('BOOK.TXT','r')
f2 = open('BOOK.TXT','w')
Sponsor Area
Mock Test Series