CS 12 Data Structures (Stack)
CS 12 Data Structures (Stack)
Sessi Gist of Expected Learning Teaching Learning activities Suggested Assessment strategies Worksheets
on Lesson Outcomes/ELO planned material / planned/Assignments/
Resources Practical
1 Data- Student will be able At least 15-20 minutes talk Students Link for Online Worksheet 1
structures to understand the on the topic should be Quiz 1
: Lists as Concept of Stack advised to
https://
covered in Understand: see these (MCQ Based
forms.gle/
Class XI, INTRODUCTION: videos worksheet)
9XxU2Wk5g2rNhG
Stacks –
• Stack is a linear data fW6
Push, Pop Overflow
using a structure.
Underflow https:// Worksheet 2
list. Top youtu.be/
• Stack is a list of elements CBSE Based
PUSH in which an element may be n1FGwF8dm Problem
POP inserted or deleted only at ns Link for Online
Applications of one Quiz 2
Stack
(This section
end, called the TOP of the https://
should contain
stack. forms.gle/
at least 5 solved
Mind Map yG5sS2EFqutWQh
• It follows the principle Last question based
d6A
In First Out (LIFO). on CBSE exam)
Q4. Pushing an element into stack already having five elements and stack size of 5,
then stack becomes
a) Overflow b) Crash c) Underflow d) User flow
Q5. Entries in a stack are “ordered”. What is the meaning of this statement?
a) A collection of stacks is sortable
b) Stack entries may be compared with the ‘<‘ operation
c) The entries are stored in a linked list
d) There is a Sequential entry that is one by one
Q6. Which of the following applications may use a stack?
a) A parentheses balancing program
b) Tracking of local variables at run time
c) Compiler Syntax Analyzer
d) Data Transfer between two asynchronous process
Q7. The type of expression in which operator succeeds its operands is?
a) Infix Expression
b) pre fix Expression
c) postfix Expression
d) None
Q10 The type of expression in which operator succeeds its operands is?
. a) Infix Expression b) Prefix Expression
c) Postfix Expression d) Both Prefix and Postfix Expressions
Q11 Which data structure is needed to convert infix notation to postfix notation?
. a) Branch b) Tree c) Queue d) Stack
def MakePush(Package):
a=int(input("enter package title : "))
Package.append(a)
def MakePop(Package):
if (Package==[]):
print( "Stack empty")
else:
print ("Deleted element:",Package.pop())
Marking Scheme: {(½ mark for MakePush() header)+ ( ½ mark for accepting a value from
user)+( ½ mark for adding value in list)+( ½ mark for MakePop() header)+( ½ mark for
checking empty list condition)+( ½ mark for displaying “Stack empty”)+( ½ mark for
displaying the value to be deleted)+( ½ mark for deleting value from list)}
Q2 Write a function in python, Push(Stu) and MakePop(Stu) to add a new studnet and delete
studnet from a List of Stu contain rollno, Sname and Class as list, considering them to
act as push and pop operations of the Stack data structure (CBSE Sample Paper-2019)
def Push(Stu):
rollno=int(input("enter package title : "))
Sname=int(input("enter package title : "))
Class=int(input("enter package title : "))
info=[rollno,Sname,Class]
Stu.append(info)
def Pop(Stu):
if (Stu==[]):
print( "Stack empty")
else:
print ("Deleted element:",Stu.pop())
stack=[ ]
def push (stack):
rollno=int(input(“Enter rollno of student”))
name =input(“Enter Name of student”)
item=(rollno, name) \\ [rollno, name] \\ {rollno : “name”} \\ as per the problem
stack.append(item)
WORKSHEET-3
Name of the Vidyalaya: ___________________________________________
Name of Student: ____________Class & Section: ________Roll No____
Worksheet/Assessment:
Q1. Write PushOn(Book) and Pop(Book) methods/functions in Python to add a new Book
and delete a Book from a list of Book titles, considering them to act as push and pop
operations of the Stack data structure.
Q2. Write a program to implement a stack for these book-details (book no, book name). That
is, now each item node of the stack contains two types of information –a book no and its
name. Just implemented push and display operations.
Q3. Write PushOn(Book) and Pop(Book) methods/functions in Python to add a new Book
and delete a Book from a List of Book titles, considering them to act as push and pop
operations of the Stack data structure.
Q4. Write PushOn(Book) and Pop(Book) methods/functions in Python to add a new Book
and delete a Book from a List of Book titles, considering them to act as push and pop
operations of the Stack data structure
Q5. Write the functions in Python push (stk, item ) and pop(stk) to check whether the stack
is empty, to add a new item, to delete an item and display the stack respectively.