Test Index

CBSE Class 12 Computer Science 2023 Paper Compartment Get it on Google PlayDownload on the App Store

© examsnet.com
Question : 30 of 35
Marks: +1, -0
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]
Advertisements
Go to Question: