This article provides you with important Data Structure stack Class 12 Questions. We are going to cover objective type questions, case study based questions, short answer questions, and long answer questions. Read the article and enjoy it!
Topics Covered
Objective Type Questions -Data Structure stack Class 12 Questions
Objective type questions of Data Structure stack Class 12 Questions contain MCQs, 1-word answer questions, Fill in the blanks or true false.
[1] A ____________ is a way to store, organize, or manage data in efficient and productive manner.
Data Structure
[2] A stack is one of the following types of data structure?
a) Linear b) Dynamic c) Circular d) All of these
[3] Stack data structure is following ____________ principle.
LIFO
[4] In stack data can be inserted or deleted from ____________ only.
Top
[5] The insert operation in the stack is known as pop. (True/False)
[6] You can replace any element position in the stack. (True/False)
[7] The peek operation refers to accessing/inspecting the top element in the stack. (True/False)
[8] A condition raise due to the stack is full is known as ___________.
a) Underflow b) Overflow c) List is full d) Completely Filled
[9] While popping the element from the stack, a condition will be raised, this condition is known as ____________.
a) Underflow b) Overflow c) List is Empty d) Blank List
[10] Stack overflow condition is raised in ____________ operation where as Stack underflow condition is raised in _____________ operations.
Push, Pop
In the next section, you will get short answer questions or case study based Data Structure stack Class 12 Questions. You can find the answer at the following link.
Short answer questions (2 Marks – Questions) – Data Structure stack Class 12 Questions
So here we start the next section of Data Structure stack Class 12 Questions for 2 marks questions. Here we go!
[1] What do you mean by data structure? Explain your answer with a suitable example.
[2] What do you mean by the LIFO structure? Support your answer with real-life examples.
[3] Enlist a few of the fields where you feel a stack is used in real life.
[4] What are the basic operations that can be performed on the stack?
[5] What are the underflow and overflow conditions?
[6] Write steps on how you implement stack?
[7] Write a python function named is_underflow() to check a stack is an underflow.
def is_underflow(stk):
if stk==[]:
return True
else:
return False
[8] Write a function to push an element into the stack.
def push(stk,e):
stk.append(e)
top = len(stk)-1
[9] Write a python function to delete an element from the stack.
def pop_stack(stk):
if stk==[]:
return "UnderFlow"
else:
e = stk.pop()
if len(stk)==0:
top = None
else:
top = len(stk)-1
return e
[10] Write a function to display the stack elements.
def display(stk):
if stk==[]:
print("Stack is Empty")
else:
top = len(stk)-1
print(stk[top],"-Top")
for i in range(top-1,-1,-1):
print(stk[i])
[11] Write a function to inspect an element from the stack.
def peek(stk):
if stk==[]:
return "UnderFlow"
else:
top = len(stk)-1
return stk[top]
[12] Write functions AddPlayer(player) and DeletePlayer(player) in python to add and remove a player by considering them as push and pop operations in a stack.
def AddPlayer(player):
pn=input("enter player name:")
player.append(pn)
def DeletePlayer(player):
if player==[]:
print("No player found")
else:
return player.pop()
[13] Vedika has created a dictionary containing names and marks as key-value pairs of 5 students. Write a program, with separate user-defined functions to perform the following operations:
- Push the keys (name of the student) of the dictionary into a stack, where the corresponding value (marks) is greater than 70.
- Pop and display the content of the stack.
The dictionary should be as follows:
d={“Ramesh”:58, “Umesh”:78, “Vishal”:90, “Khushi”:60, “Ishika”:95}
Then the output will be: Umesh Vishal Ishika
def push(stk,item):
stk.append(item)
def Pop(stk):
if stk==[]:
return None
else:
return stk.pop()
stk=[]
d={"Ramesh":58, "Umesh":78, "Vishal":90, "Khushi":60, "Ishika":95}
for i in d:
if d[i]>70:
push(stk,i)
while True:
if stk!=[]:
print(Pop(stk),end=" ")
else:
break
More questions will be added in the future so keep visiting this article assignment questions Data Structure Class 12.
If you have more questions related to the topic and have queries related to that feel free to use our comment section for the same.
Thank you very much for visiting our blog.