Home

Designed for school students & undergraduate entrance aspirants preparing for board exams, NEET, JEE and more.

JEE (Mains & Adv)NEET (UG)CBSE BoardISC BoardUP BoardCUET

Built for graduates & professionals targeting competitive exams — UPSC, CAT, GMAT, GRE, IELTS, banking & more.

GREGMATCATUPSCIBPSIELTSTOEFLSATACT

Core school & undergraduate subjects aligned with CBSE, ISC, UP Board, NEET and JEE syllabi.

PracticeMock TestsResources

Computer Science > Computational Thinking And Programming 2 > Data Structures

Success Rate: 0%
Single Question

A stack, named

ClrStack
, contains records of some colors. Each record is represented as a tuple containing four elements –
ColorName
,
RED
,
GREEN
,
BLUE
.
ColorName
is a string, and
RED
,
GREEN
,
BLUE
are integers. For example, a record in the stack may be
('Yellow', 237, 250, 68)
.

Write the following user-defined functions in Python to perform the specified operations on

ClrStack
:

(i)

push_Clr(ClrStack, new_Clr)
: This function takes the stack
ClrStack
and a new record
new_Clr
as arguments and pushes this new record onto the stack.

(ii)

pop_Clr(ClrStack)
: 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(ClrStack)
: This function checks whether the stack is empty. If the stack is empty, the function should return
True
, otherwise the function should return
False
.

Current Question

Attempts0/3
StatusNot Answered
Ready to Answer! 🚀

Community Stats

Active Learners30
Questions Attempted597
Community Success Rate70%

Track Your Progress

Sign up to save your practice progress, add favorites, and get personalized insights.

Edvaya Target App Icon

Edvaya Target

Practice Questions & Mock Tests

Improve your problem-solving skills with our extensive collection of practice questions including PYQs, NCERT Textbooks, NCERT Exemplars and Mock Tests. Get instant feedback and detailed solutions to enhance your preparation.

Get it on Google Play

We Value Your Privacy

Edvaya uses cookies to enhance your learning experience, analyze platform usage, and provide personalized content. You can customize your preferences or accept all cookies to continue.

By continuing, you agree to our Cookie Policy and Privacy Policy