Home › Class 12 papers › Computer Science (CS) › Data Structures (Stack)
Updated 01 December 2026 · Source: CBSE board papers and marking schemes
Free · Class 12 Computer Science (CS) · 9 questions

Data Structures (Stack): Class 12 Previous Year Questions

Every CBSE board exam question on Data Structures (Stack) (Class 12 Computer Science (CS)) from 2022 to 2026, with the years it was asked and the official marking-scheme answer in the free app.

Key facts

Data Structures (Stack) questions asked in CBSE board exams

CBSE has asked 7 board questions on Data Structures (Stack) in the 5 board years we track (2022–2026); the most common format is short answer.

Repeated questions first. MCQ and Assertion-Reason answers are from the official CBSE marking scheme. Open the free app to see each question exactly as printed, with the full marking scheme for written answers.

  1. (a) A stack named FruitStack, implemented using list, contains records of some fruits. Each record is represented as a dictionary with keys ‘Name’, ‘Origin’, ‘Price’, and ‘Expiry’. A sample record is given here : 3 {'Name':'Apple','Origin':'France','Price':120, 'Expiry':'12-08-2025'} Write the following user-defined functions in Python to perform the specified operations on FruitStack : (i) push_fruit(FruitStack, Fruit): This function takes the stack FruitStack and a new record Fruit as arguments and pushes the record stored in Fruit onto FruitStack if the Price is less than 100. (ii) pop_
    Board 20263 marksshort answer
  2. (a) Clrstack (stack) (tuple)i-ColorName·RED·GREEN·BLUE f I ColorName (string) RED· GREEN·BLUE quf (integers)1(stack)·"Yellow'·237, 250·68· 3×1=3 clrstack f operations f(Python)ff -f- q (user-defined functions) ff : () push_clr(clrstack· new_clr): q (function) stack clrstack new_clr3(Arguments) (stac) (ii) pop_clr(clrstack): (function) (stack) a (pop) (return) (stack) (ii)isEmpty(clrstack)·(function) stack If stack True (return) False (return) 1 91
    Board 20253 marksshort answer
  3. Consider a list named Nums which contains random integers. Write the following user defined functions in Python and perform the specified operations on a stack named BigNums. (i) PushBig () : It checks every number from the list Nums and pushes all such numbers which have 5 or more digits into the stack, BigNums. (ii) PopBig() : It pops the numbers from the stack, BigNums and displays them. The function should also display "stack Empty" when there are no more numbers left in the stack. For example: If the list Nums contains the following data : Nums = [213,10025,167,254923,14,1297653,31498
    Board 20243 marksshort answer
  4. (a) A list contains following record of customer: [Customer_name, Room Type] Write the following user defined functions to perform given operations on the stack named 'Hotel' : (i) Push_Cust ·) - To Push customers' names of those customers who are staying in 'Delux' Room Type. (i) Pop_Cust () - To Pop the names of customers from the stack and display them. Also, display ·Underflow" when there are no customers in the stack. For example : If the lists with customer details are as follows : ["siddarth","Delux"] ["Rahul","Standard"] ["Jerry","Delux"] The stack should contain Jerry Siddharth Th
    Board 20233 marksshort answer
  5. Assertion (A) : A stack is a LIFO structure. Reason (R) : Any new element pushed into the stack always gets positioned at the index after the last existing element in the stack. 91
    Answer (CBSE marking scheme): (C)
    Board 20231 markAssertion-Reason
  6. Write the definition of a user defined function PushNv(N) which accepts a list of strings in the parameter N and pushes all strings which have no vowels present in it, into a list named Novowel. Write a program in Python to input 5 words and push them one by one into a list named Ail. The program should then use the function Pushnv() to create a stack of words in the list Novowel so that it stores only those words which do not have any vowel present in it, from the list Ail. Thereafter, pop each word from the list Novowel and display the popped word. When the stack is empty display the mess
    Board 20221 markvery short
  7. ·Stack is a linear data structure which follows a particular order in which the operations are performed." What is the order in which the operations are performed in a Stack ? Name the List method/function available in Python which is used to remove the last element from a list implemented stack. Also write an example using Python statements for removing the last element of the list.
    Board 20221 markvery short
  8. Given a Dictionary Stu_dict containing marks of students for three test-series in the form Stu_ID:(TS1, TS2, TS3) as key-value pairs. Write a Python program with the following user-defined functions to perform the specified operations on a stack named Stu_Stk (i) Push_elements(Stu_Stk, Stu_dict) : It allows pushing IDs of those students, from the dictionary Stu_dict into the stack Stu_Stk, who have scored more than or equal to 80 marks in the TS3 Test. (ii) Pop_elements(Stu_Stk): It removes all elements present inside the stack in LIFO order and prints them. Also, the function displays 'Sta
    CBSE practice 2023-243 marksshort answer
  9. pp g 30 A list containing records of books is given as: B = [("Machine Learning Basics", 550), ("World Geography", 450), ("Wonder World", 140), ("AI Revolution", 750)] Write the following user-defined functions to perform operations on a stack named Books: I. Push_element(): Push only those books whose price is more than 250 into the stack. II. Pop_element(): Pop the items from the stack and display them. After all items are popped, display "Stack Empty". Expected Output: ('AI Revolution', 750) ('World Geography', 450) ('Machine Learning Basics', 550) Stack Empty
    Sample paper 2026-273 marksshort answer

Practise all 9 Data Structures (Stack) questions with answers →

Other Class 12 Computer Science (CS) chapters

Frequently asked questions

How many marks does Data Structures (Stack) carry in the CBSE Class 12 Computer Science (CS) board exam?

Across recent CBSE board papers, Data Structures (Stack) carried about 3.2 marks per paper on average, making it number 5 of 5 chapters by weightage.

Which years were Data Structures (Stack) questions asked in CBSE boards?

Questions from Data Structures (Stack) appeared in the 2022, 2023, 2024, 2025, 2026 CBSE Class 12 board exams.

Where can I practise Data Structures (Stack) previous year questions for free?

On BoardPrep: all 9 Data Structures (Stack) questions are free to practise online, with official CBSE marking-scheme answers where published.