Stack NCERT Solution || Stack Class 12 Solution || Stack Python Class 12 CS Solution || Stack Computer Science Solution || NCERT Stack Solution || Stack in Python Class 12 CS || Stack in Python Solution


Note :-  Please Click on Question to get Solution of that Question !!


Q1.State TRUE or FALSE for the following cases:

a) Stack is a linear data structure
b) Stack does not follow LIFO rule
c) PUSH operation may result into underflow condition
d) In POSTFIX notation for expression, operators are
placed after operands




Q2. Find the output of the following code:

a)
result=0
numberList=[10,20,30]
numberList.append(40)
result=result+numberList.pop()
result=result+numberList.pop()
print("Result=",result)

b)
answer=[]; output=''
answer.append('T')
answer.append('A')
answer.append('M')
ch=answer.pop()
output=output+ch
ch=answer.pop()
output=output+ch
ch=answer.pop()
output=output+ch
print("Result=",output)




Q3. Write a program to reverse a string using stack.



Q4. For the following arithmetic expression:           
((2+3)*(4/2))+2
Show step-by-step process for matching parentheses using stack data structure.



Q5. Evaluate following postfix expressions while showing status of stack after each operation given A=3, B=5,
C=1, D=4
a) A B + C *
b) A B * C / D *

 

Q6. Convert the following infix notations to postfix notations, showing stack and string contents at each step.
a) A + B - C * D
b) A * (( C + D)/E)



Q7. Write a program to create a Stack for storing only odd numbers out of all the numbers entered by the user. Display the content of the Stack along with the largest odd number in the Stack.



Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post