0% found this document useful (0 votes)
432 views

CS 12 Data Structures (Stack)

1. The document discusses a lesson plan for teaching the concept of stacks in a Computer Science class for Grade 12. 2. The lesson involves discussing the basic concepts of stacks like LIFO principle and push/pop operations. Students will solve worksheets and online quizzes to assess their understanding. 3. Resources like videos, presentations, notes and worksheets are listed to aid the teaching and learning process. The session aims to help students understand the concept, properties and applications of stacks.

Uploaded by

Harsh
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
432 views

CS 12 Data Structures (Stack)

1. The document discusses a lesson plan for teaching the concept of stacks in a Computer Science class for Grade 12. 2. The lesson involves discussing the basic concepts of stacks like LIFO principle and push/pop operations. Students will solve worksheets and online quizzes to assess their understanding. 3. Resources like videos, presentations, notes and worksheets are listed to aid the teaching and learning process. The session aims to help students understand the concept, properties and applications of stacks.

Uploaded by

Harsh
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

CLASS: XII SUBJECT: Computer Science

UNIT:1 LESSON: Stack No of session required: 1

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)

• There are two basic https://


operations associated with drive.google.c Notes: Teacher will
stack: om/file/d/ Worksheet 3
provide a common
1FNNhsASU_ email address to all
Push: Insert the element in
HpxT- students for the quiz to
stack (At least 5
EMgIXHtO3C receive score or can
Pop: Delete the element from qrLQkclx/ design their own quiz’s Unsolved CBSE
stack view? in google form Question)
usp=sharing
Link for How to
create your own
Explanation of about Stack
google form quiz
Link for Practical

Link of PPT https:// https://


youtu.be/p8C- youtu.be/
https://drive.google.com/
MFmqmhQ e0kAeoUBcSI
open?
id=1Vpm00YEFA1kVlZlpBY0
CMHWtMX8EjeYB

Teacher will take this


session Using Lifesize
App / Google Duo /
Google Meet etc
WORKSHEET-1

MCQ on Basic Concept of Stack


Name of the Vidyalaya: ___________________________________________
Name of Student: ____________Class & Section: ________Roll No____
Q1. Process of inserting an element in stack is called ____________
a) Create b) Push c) Evaluation d) Pop

Q2. Process of removing an element from stack is called __________


a) Create b) Push c) Evaluation d) Pop
Q3. In a stack, if a user tries to remove an element from empty stack it is called _____
a) Underflow b) Empty collection c) Overflow d) Garbage Collection

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

Q8. Consider the following operation performed on a stack of size 5.


Push(1);
Pop();
Push(2);
Push(3);
Pop();
Push(4);
Pop();
Pop();
Push(5);
After the completion of all operation, the number of elements present in stack are
a) 1 b) 2 c) 3 d) 4

Q9. Which of the following is not an inherent application of stack?


a) Reversing a string b) Evaluation of postfix expression
c) Implementation of recursion d) Job scheduling

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

Q12 Which data structure is used for implementing recursion?


. a) Queue b) Stack c) Array d) List

Q13 What does ‘stack underflow’ refer to?


. a) accessing item from an undefined stack b) adding items to a full stack
c) removing items from an empty stack d) index out of bounds exception

Q14 The stack is a data structure that follows:


. a) LILO b) LIFO c) FILO d) FIFO

Q15 What will be the output of this code?


.

a) Java b) cobol c) Syntax Error d) c++


WORKSHEET-2
Name of the Vidyalaya: ___________________________________________
Name of Student: ____________Class & Section: ________Roll No____

Solved CBSE Based Problem (4 Marks)


Q1 Write a function in python, MakePush(Package) and MakePop(Package) to add a new
Package and delete a Package from a List of Package Description, considering them to
act as push and pop operations of the Stack data structure (CBSE Sample Paper-2019)

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())

Q3 Write a function in python, Push(Package) and Pop(Package) to add details of employee


contain information (Empid, Ename and Salary) in the form of tuple in Package and
delete a Package from a List of Package Description, considering them to act as push
and pop operations of the Stack data structure
def Push(Package):
Empid=int(input(“Enter Id of Employee: "))
Ename=input(“Enter Name of employee”)
Salary= int(input(“Enter Salary of an employee”))
T=(Empid, Ename ,Salary)
Package.append(T)
def Pop(Package):
if (Package==[]):
print( "Stack empty")
else:
print ("Deleted element:",Package.pop())

Q4 PUSH OPERATION ON STACK


// function to push an item of integer type into stack
stack=[ ]
def push (stack):
item=int(input(“Enter the values of item”))
stack.append(item)
// function to push information of student include rollno and name in the form of list,
tuple, dictionary

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)

Q5 POP OPERATION ON STACK

// function to pop an item from stack


Stack=[ ]
def Pop (stack):
if(stack==[ ]):
print(“No element for pop”)
else:
ele=stack.pop()
print(“ Element to be poped”, ele)

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.

You might also like