Stack concept and operations using list PYQ part 2 — Lecture 42
CBSE | XII CS | Computational Thinking and Programming – 2 | 35 min
You are an expert CBSE XII CS Computer Science teacher, examiner, and study material creator. =========================================== SCOPE — READ BEFORE GENERATING ANYTHING =========================================== Today's lecture covers ONE topic only: "Stack concept and operations using list" Lecture number 42 of 91 | Duration: 35 minutes | Board: CBSE Chapter: Computational Thinking and Programming – 2 HARD RULE: Every piece of content you generate — notes, examples, questions, tips — must be directly relevant to "Stack concept and operations using list" only. DO NOT pull content, examples, or questions from any other topic or chapter. LECTURE MODE: SUBTOPIC PYQ PRACTICE - Scope: "Stack concept and operations using list" only. - Do not reteach the topic from scratch. Use a short recap only when a PYQ needs it. - Main output must be previous-year-question practice: question analysis, marking points, model answers, common mistakes, and timed strategy. - Use the 13 real PYQ record(s) provided below as the source of truth. Do not fabricate board years, marks, or questions. =========================================== SECTION 1: LECTURE INFORMATION =========================================== Class: XII CS | Subject: Computer Science | Board: CBSE Topic: Stack concept and operations using list PYQ part 2 Subtopics to cover today: - Stack concept and operations using list Student level: Class XII, CBSE Board, average to above-average students preparing for board exams =========================================== SECTION 2: TEACHER'S REFERENCE NOTES =========================================== Stack concept and operations using list PYQ part 2 PYQ PRACTICE SCOPE: Stack concept and operations using list. Concept ID: U1_STACK_LIST_OPS. Use only previous-year questions whose concept_ids include U1_STACK_LIST_OPS. Teaching ideas: Timed PYQ round, board solution, peer marking, and correction of recurring examiner traps. =========================================== SECTION 3: EXAM FREQUENCY DATA (Year-wise) =========================================== Teaching priority: HIGH High-yield concepts: Stack concept and operations using list | Year | Questions | Marks | |------|-----------|-------| | 2024 | 4 | 16 | | 2025 | 6 | 20 | | 2026 | 3 | 9 | | **Total** | **13** | **45** | =========================================== SECTION 4: ACTUAL PREVIOUS YEAR QUESTIONS (Scope: "Stack concept and operations using list" only — 13 questions from board papers) =========================================== PYQ LECTURE RULE: use these questions as the source pool for practice. - This pool has 13 questions: preserve and discuss ALL 13 actual PYQs in Section 7. - Do not compress, replace, paraphrase, or skip any actual PYQ. - Do not create substitute or newly framed questions for this small pool. - Do not fabricate board years, marks, sections, or questions. --- 2024 Board Exam (4 questions | 16 marks) --- Q1. [Short Answer] [3M] [Medium] Section-C A) You have a stack named BooksStack that contains records of books. Each book record is represented as a list containing book_title, author_name, and publication_year. Write the following user-defined functions in Python to perform the specified operations on the stack BooksStack: (I) push_book(BooksStack, new_book): This function takes the stack BooksStack and a new book record new_book as arguments and pushes the new book record onto the stack. (II) pop_book(BooksStack): This function pops the topmost book record from the stack and returns it. If the stack is already empty, the function should display "Underflow". (III) peep(BookStack): This function displays the topmost element of the stack without deleting it. If the stack is empty, the function should display 'None'. Q2. [Programming] [3M] [Medium] Section-C B) Write the definition of a user-defined function push_even(N) which accepts a list of integers in a parameter N and pushes all those integers which are even from the list N into a Stack named EvenNumbers. Write function pop_even() to pop the topmost number from the stack and returns it. If the stack is already empty, the function should display "Empty". Write function Disp_even() to display all elements of the stack without deleting them. If the stack is empty, the function should display 'None'. For example: If the integers input into the list VALUES are: [10, 5, 8, 3, 12] Then the stack EvenNumbers should store: [10, 8, 12] Q3. [Programming] [5M] [Hard] Section-D A list contains the details of Employees working in an organization. Write the following user defined functions in Python to perform the given operations: (i) Push_Employee(EmpList) : To push the details of the employees into the stack EmpStack who are working in Admin department. (ii) Pop_Employee() : To pop the elements from the stack and display. Also display "Empty" when there are no elements in the stack. For example: If the list contains the details as: ['EMP01','Raj','Admin'] ['EMP02','Shreya','HR'] ['EMP03','Rohan','Admin'] ['EMP04','Anita','Admin'] ['EMP05','Priya','HR'] The output should be: Anita Rohan Empty Q4. [Short Answer] [5M] [Hard] Section-D Write the following Python functions: (i) push_record(): To push the product details of the products whose price is more than 500 into the stack Record. (ii) pop_record(): To pop the elements from the stack and display. Also display "No Record" when there are no elements in the stack. --- 2025 Board Exam (6 questions | 20 marks) --- Q1. [Programming] [3M] [Medium] Section-C Write a user defined function in Python Push() which takes a list named DATA as an argument and pushes all elements which contain the substring 'books' (case insensitive) onto the list SBOOKS. Q2. [Programming] [3M] [Medium] Section-C Write a user defined function in Python Push() which takes a list named DATA as an argument and pushes all even numbers in the list on to the list EVENLIST. Q3. [Short Answer] [3M] [Medium] Section-C (a) A stack named KeyStack contains records of some computer keyboards. Each record is represented as a list containing Make, Keys, Connectivity. The Make and Connectivity are strings, and Keys is an integer. For example, a record in the stack may be ('Hitech', 105, 'USB'). Write the following user-defined functions in Python to perform the specified operations on KeyStack : (I) push_key(KeyStack, new_key) : This function takes the stack KeyStack and a new record as arguments new_key and pushes this new record onto the stack. (II) pop_key(KeyStack) : This function pops the topmost record from the stack and returns it. If the stack is already empty, the function should display the message "Underflow". (III) isEmpty(KeyStack) : This function checks whether the stack is empty. If the stack is empty, the function should return True, otherwise the function should return False. (II) pop_one(St) : The function should pop an element from the stack St, and return this element. If the stack is empty, then the function should display the message 'Stack Underflow', and return None. (III) display_all(St) : The function should display all the elements of the stack St, without deleting them. If the stack is empty, the function should display the message 'Empty Stack'. Q4. [Short Answer] [3M] [Medium] Section-C (b) Write the following user-defined functions in Python : (I) push_vowels(S,St) : Here S is a string and St is a list representing a stack. The function should push all the vowels of the string S onto the stack St. For example, if the string S is "Easy Concepts", then the function push_vowels() should push the elements 'E','a','o','e' onto the stack. (II) pop_one(St) : The function should pop an element from the stack St, and return this element. If the stack is empty, then the function should display the message 'Stack Underflow', and return None. (III) display_all(St) : The function should display all the elements of the stack St, without deleting them. If the stack is empty, the function should display the message 'Empty Stack'. Q5. [Programming] [3M] [Medium] Section-C A list containing records of products as L = [("Laptop", 90000), ("Mobile", 30000), ("Pen", 50), ("Headphones", 1500)] Write the following user-defined functions to perform operations on a stack named Product to: I. Push_element() – To push an item containing the product name and price of products costing more than 50 into the stack. Output: [('Laptop', 90000), ('Mobile', 30000), ('Headphones', 1500)] II. Pop_element() – To pop the items from the stack and display them. Also, display "Stack Empty" when there are no elements in the stack. Output: ('Headphones', 1500) ('Mobile', 30000) ('Laptop', 90000) Stack Empty Q6. [Programming] [5M] [Hard] Section-D A list contains the names of boys who participated in an inter school level swimming competition. Write the following user defined functions in Python to perform given operations: (i) Push_element(Boys) : To push the names of boys in the stack where the length of the name is more than 5 characters. (ii) Pop_element() : To pop the elements from the stack and display them. Also display "Stack Empty" when there are no elements in the stack. For example: If the list of boys who participated in the competition is : ['Rohit', 'Rahul', 'Rishabh', 'Virat', 'Hardik'] The stack should contain ['Rishabh', 'Hardik'] The output should be displayed as: Hardik Rishabh Stack Empty --- 2026 Board Exam (3 questions | 9 marks) --- Q1. [Short Answer] [3M] [Medium] Section-C (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 : {'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_fruit(FruitStack) : This function pops the topmost record from the stack and returns it. If the stack is already empty, the function should display "UNDERFLOW". (iii) display(FruitStack) : This function displays all the elements of the stack starting from the topmost element. If the stack is empty, the function should display 'EMPTY STACK'. Q2. [Short Answer] [3M] [Medium] Section-C (b) Write a Python program to accept 10 integers from the user. If the entered number is a three-digit even integer, push it onto a stack. After all inputs are taken, pop all the three-digit even integers from the stack and display them. For example, if the user enters 12, 31, 320, 457, 6, 92, 924, 220, 1, 218, then the stack should contain : 320, 924, 220, 218 and the output of the program should be : 218 220 924 320 Q3. [Output Prediction] [3M] [Medium] Section-C (a) Write the output of the following code : def Exam2026(given) : new=[] for ch in given[1:-1]: if ch.isupper(): new.reverse() elif ch not in new: new.append(ch) elif ch in new: new.pop() print(new) Exam2026("Gold-24Medals") =========================================== =========================================== QUESTION PATTERN BANK (What the board actually asks for THIS topic) =========================================== Scope: ONLY questions for today's lecture topic are listed below. DO NOT import questions from other topics or chapters. These are concept-pattern summaries (what TYPE the board asks), not copies of the actual questions — never reproduce full question text here. ### Concept: Stack concept and operations using list Pattern: Output Prediction=1, Programming=6, Short Answer=6 | Marks: 3M=10, 5M=3 | Total: 13 questions [Short Answer] [3M] [Medium] × 4 → Core concept of Stack concept and operations using list [Programming] [3M] [Medium] × 3 → Core concept of Stack concept and operations using list [Programming] [5M] [Hard] × 2 → Output/result interpretation for the current concept [Short Answer] [5M] [Hard] → Core concept of Stack concept and operations using list [Programming] [3M] [Medium] → Output/result interpretation for the current concept [Short Answer] [3M] [Medium] → Output/result interpretation for the current concept [Output Prediction] [3M] [Medium] → Output/result interpretation for the current concept =========================================== =========================================== IMPORTANCE ANALYSIS (allocate teaching time by this ranking) =========================================== | Rank | Concept | Score | Times Tested | Total Marks | Recent Years | Priority | |------|---------|-------|-------------|-------------|--------------|----------| | 1 | Stack concept and operations using list | 115 | 13 | 45M | 2026, 2025, 2024 | CRITICAL | CRITICAL concepts → full sub-section + comparison table + 2 worked examples HIGH concepts → 1 sub-section + 1 worked example MEDIUM concepts → definition + 1 quick example only =========================================== EXAMINER FINGERPRINT — TRAPS TO COVER INTERNALLY =========================================== Use the exam-frequency input and actual previous-year questions to identify traps, marking points, and common mistakes. In this PYQ Practice lecture, actual PYQs may be printed in Section 7 only. Do not print them randomly in concept notes, homework, or unrelated sections. For this lecture, the generated teaching material must strongly cover these traps: No static trap list exists yet for "Stack concept and operations using list". Self-generate 4–7 traps from: - actual question patterns for Stack concept and operations using list - common wrong assumptions students make about this concept - output-tracing traps - syntax-vs-runtime traps - comparison traps - order/sequence traps Important: this list should be treated as dynamic — for lectures with no static trap list, generate traps yourself from the categories above rather than leaving this section thin. =========================================== YOUR TASK — Generate a complete classroom-ready teaching package =========================================== Output format: FULL HTML (print-ready, A4, same format as CBSE study material). Use the CSS classes below. NO plain Markdown — use HTML elements only. HTML STRUCTURE TO GENERATE:
CBSE | XII CS | Computational Thinking and Programming – 2 | 35 min