AI Prompt Builder

Generate a copy-paste ready prompt for ChatGPT, Claude, Gemini, or DeepSeek
Study Notes Prompt PPT Slides Prompt
Configure Prompt
Describe class, board, and ability level
Selected Lecture
Lecture #40
Stack concept and operations using list Theory
Stack concept and operations using list
PYQ reference preview 28 included 1 excluded

Review every matched question before generating. Flag a wrongly categorised question to quarantine it from both study and PPT prompts until it is corrected in CBSE Paper Analyzer.

Included in reference ID 6071 · 2022 · 2 mark(s)
"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.
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6268 · 2022 · 2 mark(s)
Differentiate between Push and Pop operations in the context of stacks.
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6079 · 2022 · 3 mark(s)
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 All. 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 All. Thereafter, pop each word from the list NoVowel and display the popped word. When the stack is empty display the message "EmptyStack". For example : If the Words accepted and pushed into the list All are ['DRY', 'LIKE', 'RHYTHM', 'WORK', 'GYM'] Then the stack NoVowel should store ['DRY', 'RHYTHM', 'GYM'] And the output should be displayed as GYM RHYTHM DRY EmptyStack
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6080 · 2022 · 3 mark(s)
Write the definition of a user defined function Push3_5(N) which accepts a list of integers in a parameter N and pushes all those integers which are divisible by 3 or divisible by 5 from the list N into a list named Only3_5. Write a program in Python to input 5 integers into a list named NUM. The program should then use the function Push3_5() to create the stack of the list Only3_5. Thereafter pop each integer from the list Only3_5 and display the popped value. When the list is empty, display the message "StackEmpty". For example : If the integers input into the list NUM are : [10, 6, 14, 18, 30] Then the stack Only3_5 should store [10, 6, 18, 30] And the output should be displayed as 30 18 6 10 StackEmpty
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6276 · 2022 · 3 mark(s)
(a) Write separate user defined functions for the following : (i) PUSH (N) — This function accepts a list of names, N as parameter. It then pushes only those names in the stack named OnlyA which contain the letter 'A'. (ii) POPA(OnlyA) — This function pops each name from the stack OnlyA and displays it. When the stack is empty, the message "EMPTY" is displayed. For example : If the names in the list N are ['ANKITA', 'NITISH', 'ANWAR', 'DIMPLE', 'HARKIRAT'] Then the stack OnlyA should store ['ANKITA', 'ANWAR', 'HARKIRAT'] And the output should be displayed as HARKIRAT ANWAR ANKITA EMPTY (ii) popEven(EVEN) — This function pops each integer from the stack EVEN and displays the popped value. When the stack is empty, the message "Stack Empty" is displayed. For example : If the list N contains [10,5,3,8,15,4] Then the stack, EVEN should store [10,8,4] And the output should be 4 8 10 Stack Empty
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6277 · 2022 · 3 mark(s)
(b) Write the following user defined functions : (i) pushEven(N) — This function accepts a list of integers named N as parameter. It then pushes only even numbers into the stack named EVEN. (ii) popEven(EVEN) — This function pops each integer from the stack EVEN and displays the popped value. When the stack is empty, the message "Stack Empty" is displayed. For example : If the list N contains [10,5,3,8,15,4] Then the stack, EVEN should store [10,8,4] And the output should be 4 8 10 Stack Empty
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6560 · 2022 · 3 mark(s)
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
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6561 · 2022 · 3 mark(s)
Write a function in Python, Push(SItem) where SItem is a dictionary containing the details of stationary 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 The output should be: The count of elements in the stack is 2
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6104 · 2023 · 1 mark(s)
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. (a) Both (A) and (R) are true and (R) is the correct explanation for (A). (b) Both (A) and (R) are true and (R) is not the correct explanation for (A). (c) (A) is true but (R) is false. (d) (A) is false but (R) is true.
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6300 · 2023 · 1 mark(s)
Assertion (A): In Python, a stack can be implemented using a list. Reasoning (R): A stack is an ordered linear list of elements that works on the principle of First In First Out (FIFO). (a) Both (A) and (R) are true and (R) is the correct explanation for (A). (b) Both (A) and (R) are true and (R) is not the correct explanation for (A). (c) (A) is true but (R) is false. (d) (A) is false but (R) is true.
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6120 · 2023 · 3 mark(s)
(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. (ii) 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 The output should be: Jerry Siddharth Underflow
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6121 · 2023 · 3 mark(s)
(b) Write a function in Python, Push(Vehicle) where, Vehicle is a dictionary containing details of vehicles — {Car Name: Maker}. The function should push the name of car manufactured by 'TATA' (including all the possible cases like Tata, TaTa, etc.) to the stack. For example: If the dictionary contains the following data: Vehicle={"Santro": "Hyundai", "Nexon": "TATA", "Safari": "Tata"} The stack should contain Safari Nexon
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6317 · 2023 · 3 mark(s)
A list contains following record of course details for a University : [Course name, Fees, Duration] Write the following user defined functions to perform given operations on the stack named 'Univ' : (i) Push_element() — To push an object containing the Course_name, Fees and Duration of a course, which has fees greater than 100000 to the stack. (ii) Pop_element() — To pop the object from the stack and display it. Also, display "Underflow" when there is no element in the stack. For example : If the lists of courses details are : ["MCA",200000,3] ["MBA",500000,2] ["BA",100000,3] The stack should contain : ["MBA",500000,2] ["MCA",200000,3]
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6603 · 2023 · 3 mark(s)
A list, NList contains following record as list elements: [City, Country, distance from Delhi] Each of these records are nested together to form a nested list. Write the following user defined functions in Python to perform the specified operations on the stack named travel. (i) Push_element(NList): It takes the nested list as an argument and pushes a list object containing name of the city and country, which are not in India and distance is less than 3500 km from Delhi. (ii) Pop_element(): It pops the objects from the stack and displays them. Also, the function should display "Stack Empty" when there are no elements in the stack. For example: If the nested list contains the following data: NList=[["New York", "U.S.A.", 11734], ["Naypyidaw", "Myanmar", 3219], ["Dubai", "UAE", 2194], ["London", "England", 6693], ["Gangtok", "India", 1580], ["Columbo", "Sri Lanka", 3405]] The stack should contain: ['Naypyidaw', 'Myanmar'] ['Dubai', 'UAE'] ['Columbo', 'Sri Lanka'] The output should be: ['Columbo', 'Sri Lanka'] ['Dubai', 'UAE'] ['Naypyidaw', 'Myanmar'] Stack Empty
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6361 · 2024 · 3 mark(s)
A dictionary, d_city contains the records in the following format : {state:city} Define the following functions with the given specifications : (i) push_city(d_city) : It takes the dictionary as an argument and pushes all the cities in the stack CITY whose states are of more than 4 characters. (ii) pop_city() : This function pops the cities and displays "Stack empty" when there are no more cities in the stack.
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6648 · 2024 · 3 mark(s)
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'.
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6649 · 2024 · 3 mark(s)
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]
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6165 · 2024 · 5 mark(s)
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
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Excluded — review required ID 6166 · 2024 · 5 mark(s)
Write a user defined function in Python named write_data() to write the data in a CSV file Stock.csv with field names Product_Name, Product_ID, Quantity, Price as shown below: | Product_Name | Product_ID | Quantity | Price | |--------------|------------|----------|-------| | Keyboard | P101 | 10 | 800 | | Mouse | P102 | 12 | 600 | | Monitor | P103 | 5 | 5000 | | CPU | P104 | 8 | 10000 | (ii) pop_record(): To pop the elements from the stack and display. Also display "No Record" when there are no elements in the stack.
Stack Data Structure → CSV file read write and search, Stack concept and operations using list · Concept U1_CSV_OPS;U1_STACK_LIST_OPS
Included in reference ID 6167 · 2024 · 5 mark(s)
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.
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6204 · 2025 · 3 mark(s)
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.
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6205 · 2025 · 3 mark(s)
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.
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6407 · 2025 · 3 mark(s)
(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'.
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6408 · 2025 · 3 mark(s)
(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'.
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6696 · 2025 · 3 mark(s)
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
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6212 · 2025 · 5 mark(s)
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
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6255 · 2026 · 3 mark(s)
(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'.
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6256 · 2026 · 3 mark(s)
(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
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Included in reference ID 6257 · 2026 · 3 mark(s)
(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")
Stack Data Structure → Stack concept and operations using list · Concept U1_STACK_LIST_OPS
Select a lecture and generate your AI prompt

Pick a lecture from the panel on the left, configure the board and student level, then click Generate Prompt. The result includes PYQ data, frequency analysis, exam trends, and a full 15-section teaching package request — ready to paste into any AI assistant.

ChatGPT Claude Gemini DeepSeek
PYQ Analysis
Frequency, marks & high-yield concepts
Lecture Flow
Exact time-allocation plan
15 Sections
From objectives to ranked exam questions
Export
Copy or download as .txt