NCERT Solutions Class 12 Computer Science Chapter 3 Stack

NCERT Solutions Class 12 Computer Science Chapter 3 Stack have been provided below and is also available in Pdf for free download. The NCERT solutions for Class 12 Computer Science have been prepared as per the latest syllabus, NCERT books and examination pattern suggested in Class 12 by CBSE, NCERT and KVS. Questions given in NCERT book for Class 12 Computer Science are an important part of exams for Class 12 Computer Science and if answered properly can help you to get higher marks. Refer to more Chapter-wise answers for NCERT Class 12 Computer Science and also download more latest study material for all subjects. Chapter 3 Stack is an important topic in Class 12, please refer to answers provided below to help you score better in exams

Chapter 3 Stack Class 12 Computer Science NCERT Solutions

Class 12 Computer Science students should refer to the following NCERT questions with answers for Chapter 3 Stack in Class 12. These NCERT Solutions with answers for Class 12 Computer Science will come in exams and help you to score good marks

Chapter 3 Stack NCERT Solutions Class 12 Computer Science


Class_12_Computer_Science_Stack

Question 2. Evaluate the following postfix expression: (show status of Stack after each operation)
100,40,8,/,20,10,-,+,*
Answer: 
NCERT-Solutions-Class-12-Computer-Science-Stack-1

Question 3. Evaluate the following postfix expression. Show the status of stack after execution of each
operation separately:
T, F, NOT, AND, T, OR, F, AND
Answer: 
Thus the stack will have False Value
NCERT-Solutions-Class-12-Computer-Science-Stack-2
NCERT-Solutions-Class-12-Computer-Science-Stack-3

Question 4. Evaluate the following postfix expression. Show the status of stack after execution of each operation separately:
F, T, NOT, AND, F, OR, T, AND
Answer: 

NCERT-Solutions-Class-12-Computer-Science-Stack-4
NCERT-Solutions-Class-12-Computer-Science-Stack-5

Question 5. Evaluate the following postfix expression using a stack and show the contents of stack after execution of each operation:
5,3,2, *, 4,2, /, -,*
Answer:

NCERT-Solutions-Class-12-Computer-Science-Stack-6

Question 6. Evaluate the following POSTFIX notation. Show status of Stack after every step of evaluation (i.e. after each operation)
False NOT, True, AND, True, False, OR, AND
Answer:

NCERT-Solutions-Class-12-Computer-Science-Stack-7

Question 7. Top is a pointer variable pointing to the top element of a stack, with each node having the following structure declaration:
struct Stack {int Data, Stack * Next};
Considering the above explanation, what will the following code do ?
int count = 0, Sum = 0;
Stack * Temp = Top;
while (Temp - > Next! = NULL)
{ count + +;
Sum + = Temp - > Data;
Temp Temp - > Next;
}
count < < Sum / count;
Answer:
It will calculate the average of stack values.

Question 8. Convert the expression ((x * 3 + y * 3 + z * 3) / (x + y + z)) into postfix expression. Show the content of the stack during the conversion.
Answer:
Given expression : ((x * 3 + y * 3 + z * 3) / (x + y + z))
((x * 3 + y * 3 + z * 3) / (x + y + z))

NCERT-Solutions-Class-12-Computer-Science-Stack-9

Question 9. Evaluate the following POSTFIX expression, show the status of Stack after execution of each operation separately:
45,45,+,32,20,10,/,-,*
Answer:

NCERT-Solutions-Class-12-Computer-Science-Stack-11

Question 10. Convert the following Infix expression to its equivalent Postfix expression, showing the stack contents for each step of conversion.
P/Q+(R-T)*U
Answer: P/Q+(R-T)*U = (P/Q+(R-T)*U)
NCERT-Solutions-Class-12-Computer-Science-Stack-12



Short Answer Type Questions-II

Question 1. Write the definition of a member function Pop ()
in C++, to delete a book from a dynamic stack of TEXTBOOKS considering the following code is already included in the program.
Struct TEXTBOOKS
{
Char ISBN [20]; Char TITLE [80]; TEXTBOOKS *Link;
};
class STACK
{
TEXTBOOKS *Top;
public :
STACK () {Top = NULL;}
void Push ();
. void pop );
-STACK ();
};
Answer:
void STACK : : POP ()
{
if (Top ! = NULL)
{
TEXTBOOKS *Temp;
Temp=Top;
cout<< TOP- >ISBN<<Top-
TITLE<<"delected"<<endl;
Top=Top-Link;
delete Temp;
}
else
cout<<"Stack Empty"<<endl;
}
OR
Any other correct equivalent function definition

Question 2. Write the defintion of a member function PUSH () in C+ +, to add a new book in a dynamic stack of BOOKS considering the following code is already included in the program:
struct BOOKS
{
Char ISBN [20]; TITLE[80];
BOOKS *Link;

};
class STACK
{
BOOKS *Top;
public :
STACK () {Top = NULL;}
void PUSH ();
Void POP ();
-STACK ();
};
Answer:
void STACK :: PUSH ()
{
BOOKS *Temp;
Temp=New BOOKS;
gets (Temp->ISBN);
gets (Temp->TITLE);
Temp->Link =Top;
Top=Temp;
}
OR
Any other correct equivalent function definition

Question 3. Convert the expression (A-5)*6+(10/B)/2 to corresponding postfix expression. Also show the status of operator stack after each step.
Answer: ((A-5)*6+(10/B)/2)
NCERT-Solutions-Class-12-Computer-Science-Stack-13
NCERT-Solutions-Class-12-Computer-Science-Stack-14


Long Answer Type Questions 

Question 1. Convert the following Infix expression to its equivalent Postfix expression, showing the stack contents for each step of conversion.
A/(B+C)*D-E
Answer:
A/ (B + C) *D-E
NCERT-Solutions-Class-12-Computer-Science-Stack-15

Question 2. Write definition for a function DISPMID (int A[][5], int R, int C) in C+ + to display the elements of middle row and middle column from a two dimensional array A having R number of rows and C number of columns.
For example, if the content of array is as follows:
NCERT-Solutions-Class-12-Computer-Science-Stack-16
 601 516 921 609
Answer:
void DISPMID (int A[] [5] , int R, int C)
{
int mid = (R+C)/2;
for (int i=0; i<c; i++)
{
Cout << A[mid] [i]<<"";
} cout<<endl;
for (int i=0; i<R; i++)
cout << A[i][mid]<<"";
}

Question 3. Convert the following Infix expression to its equivalent Postfix expression, showing the stack contents for each step of conversion.
P/(Q-R)*S+T
Answer:
P/(Q-R)*S+T
BODMAS : PQR-/S*T+
PQR-/S*T+
NCERT-Solutions-Class-12-Computer-Science-Stack-17

Question 4. Convert the following infix expression to its equivalent postfix expression, showing the stack contents for each step of conversion:
X/Y+U*(V-W)
Answer:
X / Y + U* (V – W) = ((X / Y) + (U * (V – W)))
NCERT-Solutions-Class-12-Computer-Science-Stack-18
NCERT-Solutions-Class-12-Computer-Science-Stack-19
NCERT-Solutions-Class-12-Computer-Science-Stack-20
NCERT-Solutions-Class-12-Computer-Science-Stack-21

Any other method or converting the given Infix expression to its equivalent Postfix expression showing stack contents

Question 5. Evaluate the following postfix expression using stack and show the contents after execution of each.
Answer: Operations : 470,5,4,∧,25,/,6,*
NCERT-Solutions-Class-12-Computer-Science-Stack-22
NCERT-Solutions-Class-12-Computer-Science-Stack-23

Question 6. Write member functions to perform POP and PUSH operations in a dynamically allocated stack containing the objects of the following structure:
struct Game
{ char Gamename[30];
int numofplayer;
Game *next; } ;
Answer:
struct Game
{
char Gamename[3 0] ;
int numofplayer;
Game *next;
};
class Stack { Game *Top;
public :
Stack ()
{
Top = NULL;
}
void Push();
void Pop();
void display();
-Stack();
} ;
void Stack::Push()
{
Game *temp = new Game;
cout<<"Enter Data : "; gets(temp->Gamename);
cin>>temp->numofplayer;
temp->next =Top;
Top = temp;
}
void Stack:: Pop()
{
if ( Top != NULL)
{
Game *temp = Top;
cout<Gamename<<" Deleted"; Top = Top->next;
delete temp;
}
else
cout<<"Stack is empty....";
}

Question 7. Write a function PUSHBOOK() in C++ to perform insert operation on Dynamic Stack, which contains Book_no and Book_Title. Consider the following definition of NODE, while writing your C+ + code,
struct NODE
{
int Book_No ;
char Book_Title [20];
NODE * Next;
};
Answer:
Void PUSHBOOK (NODE *TOP> int Book_No, char B Title [20])
{
NODE*temp;
temp=new NODE;
temp —> Book_No=Book_No;
Strcpy (temp —> Book_Title, B Title) ;
temp --> Next=NULL ;
if (Top==NULL)
Top=temp;
else
{
temp —> Next=top;
Top==temp;
}
}

Question 8. Write a function POPBOOK( ) in C++ to perform delete operation from a Dynamic Stack, which contains Bno and Title. Consider the following definition of NODE, while writing your C++code.
struct NODE
{
int Bno;
char Title[20] ;
NODE * Link;
 } ;
Answer:
node*PopBOOK(node*TOP int Bno, char B Title [20])
{
node*temp;
temp=new node;
temp —>Bno=Bno;
strcpy (temp —>Title, B Title);
temp ->link=NULL:
if (TOP==NULL)
Top=Temp;
else
{
temp —>link=Top;
TOP==temp;
}
}

Question 9. Write the definition of a member function push() for a class Library in C++ to insert a book information in a dynamically allocated stack of books considering the following code is already written as a part of the program struct book
{
int bookid;
char bookname[20];
book*next;
} ;
class Library
{
book*top;
public
Library()
{
top=NULL;
}
void push();
void pop();
void disp() ;
-Library();
};
Answer:
void Library: :push()
 {
book*nptr;
nptr=new book;
cout<<"Enter values for bookid and bookname"; cin> >nptr->bookid;
gets(nptr->bookname);
nptr->next =NULL;
if (top==NULL)
top=nptr;
else
{
nptr->next=top,
top=nptr;
}
}

Question 10. Convert the following Infix expression to its equivalent Postfix expression, showing the stack contents for each step of conversion:
U * V + R / (S-T)
Answer: U*V + R/(S-T)
Any other method for converting the given Infix expression to its equivalent Postfix expression showing stack contents.

NCERT-Solutions-Class-12-Computer-Science-Stack-24

NCERT-Solutions-Class-12-Computer-Science-Stack-25

More Study Material

NCERT Solutions Class 12 Computer Science Chapter 3 Stack

NCERT Solutions Class 12 Computer Science Chapter 3 Stack is available on our website www.studiestoday.com for free download in Pdf. You can read the solutions to all questions given in your Class 12 Computer Science textbook online or you can easily download them in pdf.

Chapter 3 Stack Class 12 Computer Science NCERT Solutions

The Class 12 Computer Science NCERT Solutions Chapter 3 Stack are designed in a way that will help to improve the overall understanding of students. The answers to each question in Chapter 3 Stack of Computer Science Class 12 has been designed based on the latest syllabus released for the current year. We have also provided detailed explanations for all difficult topics in Chapter 3 Stack Class 12 chapter of Computer Science so that it can be easier for students to understand all answers.

NCERT Solutions Chapter 3 Stack Class 12 Computer Science

Class 12 Computer Science NCERT Solutions Chapter 3 Stack is a really good source using which the students can get more marks in exams. The same questions will be coming in your Class 12 Computer Science exam. Learn the Chapter 3 Stack questions and answers daily to get a higher score. Chapter 3 Stack of your Computer Science textbook has a lot of questions at the end of chapter to test the students understanding of the concepts taught in the chapter. Students have to solve the questions and refer to the step-by-step solutions provided by Computer Science teachers on studiestoday to get better problem-solving skills.

Chapter 3 Stack Class 12 NCERT Solution Computer Science

These solutions of Chapter 3 Stack NCERT Questions given in your textbook for Class 12 Computer Science have been designed to help students understand the difficult topics of Computer Science in an easy manner. These will also help to build a strong foundation in the Computer Science. There is a combination of theoretical and practical questions relating to all chapters in Computer Science to check the overall learning of the students of Class 12.

Class 12 NCERT Solution Computer Science Chapter 3 Stack

NCERT Solutions Class 12 Computer Science Chapter 3 Stack detailed answers are given with the objective of helping students compare their answers with the example. NCERT solutions for Class 12 Computer Science provide a strong foundation for every chapter. They ensure a smooth and easy knowledge of Revision notes for Class 12 Computer Science. As suggested by the HRD ministry, they will perform a major role in JEE. Students can easily download these solutions and use them to prepare for upcoming exams and also go through the Question Papers for Class 12 Computer Science to clarify all doubts

Where can I download latest NCERT Solutions for Class 12 Computer Science Chapter 3 Stack

You can download the NCERT Solutions for Class 12 Computer Science Chapter 3 Stack for latest session from StudiesToday.com

Can I download the NCERT Solutions of Class 12 Computer Science Chapter 3 Stack in Pdf

Yes, you can click on the link above and download NCERT Solutions in PDFs for Class 12 for Computer Science Chapter 3 Stack

Are the Class 12 Computer Science Chapter 3 Stack NCERT Solutions available for the latest session

Yes, the NCERT Solutions issued for Class 12 Computer Science Chapter 3 Stack have been made available here for latest academic session

How can I download the Chapter 3 Stack Class 12 Computer Science NCERT Solutions

You can easily access the links above and download the Chapter 3 Stack Class 12 NCERT Solutions Computer Science for each chapter

Is there any charge for the NCERT Solutions for Class 12 Computer Science Chapter 3 Stack

There is no charge for the NCERT Solutions for Class 12 Computer Science Chapter 3 Stack you can download everything free

How can I improve my scores by reading NCERT Solutions in Class 12 Computer Science Chapter 3 Stack

Regular revision of NCERT Solutions given on studiestoday for Class 12 subject Computer Science Chapter 3 Stack can help you to score better marks in exams

Are there any websites that offer free NCERT solutions for Chapter 3 Stack Class 12 Computer Science

Yes, studiestoday.com provides all latest NCERT Chapter 3 Stack Class 12 Computer Science solutions based on the latest books for the current academic session

Can NCERT solutions for Class 12 Computer Science Chapter 3 Stack be accessed on mobile devices

Yes, studiestoday provides NCERT solutions for Chapter 3 Stack Class 12 Computer Science in mobile-friendly format and can be accessed on smartphones and tablets.

Are NCERT solutions for Class 12 Chapter 3 Stack Computer Science available in multiple languages

Yes, NCERT solutions for Class 12 Chapter 3 Stack Computer Science are available in multiple languages, including English, Hindi