REVISION WORKSHEET GRADE:XII
1. A try statement have only one except block(T/F)
2. push() is a keyword(T/F)
3. Append is used for ……………….. and pop() will delete………………. From the stack.
4. In stack, all operations takes place at……………………….
5. When a Stack is empty, the TOP will reset to:
6. Sanya wants to remove an element from empty stack. Which of the following
term is related to this?
(a) Empty Stack (b) Overflow (c) Underflow (d) Clear Stack
7. What is meant by traversing?
8. Write a function in Python, Push(SItem) where , SItem is a dictionary containing
the details of stationery items– {Sname:price}.
• The function should push the names of those items in the stack who have
price greater than 75.
• Also display the count of elements pushed into the stack.
For example: If the dictionary contains the following data:
Ditem={"Pen":106,"Pencil":59,"Notebook":80,"Eraser":25}
The stack should contain:
Notebook
Pen
9. A list contains following record of a customer: [Customer_name, Phone_number, City]
Write the following user defined functions to perform given operations on the stack
named ‘status’:
(i) Push_element() - To Push an object containing name and Phone number of
customers who live in Goa to the stack
(ii) Pop_element() - To Pop the objects from the stack and display them. Also,
display “Stack Empty” when there are no elements in the stack.
For example: If the lists of customer details are:
[“Gurdas”, “99999999999”,”Goa”]
[“Julee”, “8888888888”,”Mumbai”]
[“Murugan”,”77777777777”,”Cochin”]
[“Ashmit”, “1010101010”,”Goa”]
The stack should contain
[“Ashmit”,”1010101010”]
[“Gurdas”,”9999999999”]
The output should be:
[“Ashmit”,”1010101010”]
[“Gurdas”,”9999999999”]
Stack Empty
[Link] a stack that stores dictionaries as elements. Each dictionary represents
a person's information ( name, age, city).
• Implement a `push_dict` method to push a dictionary onto the stack of
person above age 20
• Implement a `pop_dict` method to pop the top dictionary from the stack.