Professional Documents
Culture Documents
Learn CBSE
CBSE Class 12 Support only
vidyamandir.com OPEN
CBSE Class 8 Support only
vidyamandir.com OPEN
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 1/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
ImportantCLASSQuestions
6 7 8 9 for11Class
10 12 HOW
12 NOTES Computer
ON PC OR LAPTOP Science
TO PLAY PUBG MOBILE
Topic – 1
CBSE SAMPLE PAPERS Linked
LAKHMIR SINGH List and below
Stack
Hi there! Click one of our representatives
and we will get back to you as soon as
Previous years Examination Questions
possible.
2 Marks Questions
Question 1: CBSE Class 12 Support only
Convert the following in x expression to its equivalent post x expression, showing the stack contents for
each step of conversion: CBSE Class 11 Support only
P/(Q-R)*S + T All India 2016
Аnswer:
CBSE Class 10 Support only
Question 2:
Convert the following in x expression to its equivalent post x expression, showing the stack contents for
each step of conversion.
A/(B + Q*D-E Delhi 2016
Аnswer:
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 2/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
Question 3:
Convert the following in x expression to its equivalent post x expression, showing the stack contents for
Chat with us on WhatsApp
each step of conversion.
P/(Q+(R-T)*U All India (C) 2016
Аnswer:
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 3/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
Question 4:
Convert the following in x expression to its equivalent post x expression, showing the stack contents for
each step of conversion:
(U* V+ R/ (S-T)) All India 2015
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 4/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
Question 5:
CBSE Class 8 Support only
Convert the following in x expression to its equivalent post x expression, showing the stack contents for
each step of conversion.
(X/Y+U*(V-W)) Delhi 2015 CBSE Class 7 Support only
Аnswer:
CBSE Class 6 Support only
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 5/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
Tata Sky
Hi there! Click one of our representatives
CBSE SAMPLE PAPERS LAKHMIR SINGH below and we will get back to you as soon as
Buypossible.
Now
Question 6:
CBSE
Evaluate the following post x expression. Show the. status of stack after Class 12 of
execution Support
each only
operation
separately:
F, T, NOT, AND, F, OR, T, AND Delhi 2014 CBSE Class 11 Support only
Аnswer:
Question 7:
Evaluate the following post x expression. Show the status of stack after execution of each operation
separately:
T, F, NOT, AND, T, OR, F, AND All India 2014
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 6/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
Buy Now
Question 8:
Evaluate the following post x expression: (show status of stack after each operation)
100,40,8,/,20,10,-,+,* All India (C) 2014
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 7/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
Question 10:
Evaluate the following post x expression. Show the status of stack after execution of each operation:
60, 6, /, 5, 2, *, 5, -, + Delhi 2013
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 8/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
Tata Sky
CBSE Class 8 Support only
Buy Now
CBSE Class 7 Support only
Question 11:
Evaluate the following post x expression using a stack and show the contents of stack after execution of
each operation: CBSE Class 6 Support only
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 9/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
Question 13:
Evaluate the following post x notation. Show status of stack after every step of evaluation (i.e. after each
operator): Chat with us on WhatsApp
True, False, NOT, AND, False, True, OR, AND All India 2012
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 10/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
Question 14:
Evaluate the following post x notation of expression: CBSE Class 7 Support only
Question 15:
Evaluate the following post x notation of expression:
True, False, NOT, AND, True, True, AND, OR All india 2011
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 11/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
Question 16:
Evaluate the following post x notation of expression:
Chat with us on WhatsApp
False, True, NOT, OR, True, False, AND, OR Delhi 2010
Аnswer:
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 12/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
Question 17:
Evaluate the following post x notation of expression. Show the status of stack after each operation:
True, False, NOT, OR, False, True, OR, AND All India 2010
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 13/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
Question 18:
Convert the following in x expression to its equivalent post x expression. Chat with us on WhatsApp
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 14/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
4 Marks Questions
Question 20:
Write the de nition 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: All India 2015
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 15/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
Аnswer:
CBSE Class 9 Support only
void STACK::PUSH()
{ CBSE Class 8 Support only
Question 21:
Write the de nition 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. Delhi 2015
struct TEXTBOOKS
{
char ISBN[20];
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 16/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
void STACK::Pop()
CBSE Class 9 Support only
{
if(Top! = NULL)
{ CBSE Class 8 Support only
Question 22:
Write a function POPBOOK( ) in C++ to perform delete operation from a dynamic stack, which contains Bno
and Title. Consider the following de nition of NODE, while writing your C++ code. Delhi 2014
struct NODE
{
int Bno;
char Title[20];
NODE *Link;
};
Аnswer:
struct NODE
{ CBSE Class 10 Support only
char Book_No;
char Book_Title[20]:
CBSE Class 9 Support only
NODE *Next:
};
CBSE Class 8 Support only
Аnswer:
Question 24:
Write a complete program in C++ to implement a dynamically allocated stack containing names of
Countries. Delhi 2010
Аnswer:
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 18/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
void Pop();
void Display(); CBSE Class 9 Support only
∼Stack();
};
CBSE Class 8 Support only
void Stack :: Push()
{
CBSE Class 7 Support only
Node *Temp = new Node;
gets(Temp->Country);
Temp->Link = Top; CBSE Class 6 Support only
Top = Temp;
}
void Stack :: Pop() Chat with us on WhatsApp
{
if(Top!=NULL)
{
Node *Temp = Top;
Top = Top->Link;
delete Temp;
}
else
cout<<"Stack empty";
}
void Stack :: Display()
{
Node *Temp = Top;
while(Temp!= NULL)
cout<<Temp->Country<<endl;
Temp = Temp->Link;
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 19/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
{
cout<<"Choose any one P/O/D/Q"; /* displaying choices P CBSE
- Push,0
Class 9 -Support
Pop, only
D-Display, Q-
Exit */
cin>>ch;
CBSE Class 8 Support only
switch(ch)
{
CBSE Class 7 Support only
case 'P':ST.Push();
break;
case '0':ST.Pop(); CBSE Class 6 Support only
break;
case 'D':ST.Display();
} Chat with us on WhatsApp
}
while(ch!='Q');
}
Topic – 2
Queue
Previous years Examination Questions
4 Marks Questions
Question 1:
Write the de nition of a member function DELETE( ) for a class QUEUE in C++, to remove a product from a
dynamically allocated Queue of products considering the following code is already written as a part of the
program. All India 2016
struct PRODUCT
{
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 20/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
{
PRODUCT *Temp=F; CBSE Class 7 Support only
cout<<F->data<<"deleted\n";
F=F->Next;
CBSE Class 6 Support only
delete Temp;
if(F==NULL)
R=NULL;
Chat with us on WhatsApp
}
else
cout<<"\n Queue is Empty":
}
Question 2:
Write the de nition of a member function INSERT( ) for a class QUEUE in C++, to insert an ITEM in a
dynamically allocated Queue of items considering the following code is already written as a part of the
program. Delhi 2016
struct ITEM
{
int INO;
char INAME[20];
ITEM *Link;
};
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 21/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
Аnswer:
CBSE Class 11 Support only
if(R==Null)
{ CBSE Class 7 Support only
R = temp;
F = temp;
CBSE Class 6 Support only
}
else
{
Chat with us on WhatsApp
R->Next = temp;
R = temp;
}
}
Question 3:
Write the de nition of a member function INSERT! ) in C++, to add a new passenger detail in a dynamic
queue of PASSENGERS considering the following code is already existing in the program. All India 2015
struct PASSENGERS
{
char PID[20]; NAME[80];
PASSENGERS *Next;
};
class QUEUE
{
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 22/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
Аnswer:
CBSE Class 12 Support only
{
Front = Rear = P; CBSE Class 7 Support only
}
else
CBSE Class 6 Support only
{
Rear->Next = P;
Rear = P;
Chat with us on WhatsApp
}
}
Question 4:
Write a function QDELETE( ) in C++ to perform delete operation in a Linked Queue, which contains
Passenger number and Passenger name. Consider the following de nition of node in the code. All India
2013
struct node
{
long int Pno;
char Pname[20];
node *Link;
};
Аnswer:
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 23/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
delete temp;
} CBSE Class 9 Support only
}
Write a function QINSERT( ) in C++ to perform insert operation on a linked queue, which contains client
number and client name. Consider the following de nition of NODE in the
CBSEcode of7QINSERT
Class ( ). Delhi 2013
Support only
struct NODE
CBSE Class 6 Support only
{
long int Cno; //Client number
char Cname[20]; //Client name
Chat with us on WhatsApp
NODE *Next;
};
Аnswer:
void QINSERT()
{
NODE *P = new Node;
cout<<"Enter the Client Number and Name:";
cin>>P- Cno;
gets(P->Cname) ;
P->Next=NULL;
if((front ~ NULL)&&(rear == NULL))
{
front=rear=P;
}
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 24/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
Question 6:
Given the necessary declaration of linked implemented Queue containing players information (as de ned in
CBSE Class 12 Support only
the following de nition of Node). Also, write a user de ned function in C++ to delete one Player’s
information from the Queue.
Delhi 2013C CBSE Class 11 Support only
Аnswer:
CBSE Class 7 Support only
void Delete_NODE()
CBSE Class 6 Support only
{
NODE *P;
if(front == Null)
Chat with us on WhatsApp
cout<<”Queue is empty";
else if(front == rear)
{
P = front;
cout<<"Deleted Node information is";
cout<<P->PlayerNo;
puts(p->PlayerName);
front = rear = NULL;
delete P;
}
else
{
P = front;
cout<<"Deleted Node information is";
cout<<P->PlayerNo;
puts(P->PlayerName);
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 25/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
char title[20];
DVD *Link; CBSE Class 10 Support only
};
Question 8:
Write a function in C++ to perform insert operation in a static circular queue containing book’s information
(represented with the help of an array of structure BOOK). All India 2012
struct BOOK
{
long AccNo; //Book account number
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 26/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
NCERT SOLUTIONS
Аnswer: RD SHARMA CLASS 12 CLASS 11 CLASS 10 CLASS 9
}
else CBSE Class 7 Support only
Rear = Rear+1;
cout<<"Enter book account number and title";
CBSE Class 6 Support only
cin>>B[Rear].AccNo;
gets(B[Rear].Title);
}
Chat with us on WhatsApp
Question 9:
Write a function in C++ to perform insert operation on a dynamically allocated queue containing passenger
details as given in the following de nition of NODE; Delhi 2011
struct NODE
{
long Pno; //Passenger Number
char Pname[20]; //Passenger Name
NODE *Link;
};
Аnswer:
void Enter()
{
NODE *nptr=new NODE;
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 27/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
Question 10:
CBSE Class 9 Support only
Write a function in C++ to perform delete operation on a dynamically allocated queue containing passenger
details as given in the following de nition of NODE: All India 2011
CBSE Class 8 Support only
struct NODE
{ CBSE Class 7 Support only
long Mno; //Member Number
char Mname[20]; //Member Name
CBSE Class 6 Support only
NODE *Link;
};
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 28/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
NCERT 11:
Question SOLUTIONS RD SHARMA CLASS 12 CLASS 11 CLASS 10 CLASS 9
Write a complete program in C++ to implement a dynamically allocated queue containing names of cities.
Hi there! Click one of our representatives
All CBSE
India SAMPLE
2010 PAPERS LAKHMIR SINGH below and we will get back to you as soon as
Аnswer: possible.
#include<iostream.h>
CBSE Class 12 Support only
#include<string.h>
struct Node
{ CBSE Class 11 Support only
char city[30];
Node *link; CBSE Class 10 Support only
};
class queue
CBSE Class 9 Support only
{
Node *front, *rear;
public: CBSE Class 8 Support only
queue() {front=rear=NULL;}
void add_Q(); //add queue CBSE Class 7 Support only
void del_Q(); //delete queue
void show_Q(); //show queue
CBSE Class 6 Support only
};
void queue :: add_Q()
{
Chat with us on WhatsApp
Node *temp = new Node;
char ct[30];
cout<<"Enter city";
gets(ct);
strcpy(temp->city,ct);
temp->link = NULL;
if(rear == NULL)
front = rear = temp;
else
{
rear->link = temp;
rear = temp;
}
}
void queue :: del_Q()
{
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 29/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
if(front == NULL)
rear = front; CBSE Class 9 Support only
}
void queue :: show_Q()
CBSE Class 8 Support only
{
Node *temp = front;
CBSE Class 7 Support only
cout<<"The queue elements are";
while(temp!=NULL)
{ CBSE Class 6 Support only
cout<<"\n"<<temp->city;
temp = temp->l ink;
} Chat with us on WhatsApp
}
void main()
{
int choice;
queue QUEUE;
char opt='Y';
do
{
cout<<"\nMain Menu";
cout<<"\nl.Insertion in queue";
cout<<"\n2.Deletion from queue";
cout<<"\n3.Traversal of queue";
cout<<"\n4.Exit from queue";
cout<<"\nEnter your choice from above(1,2,3,4)";
cin<<choice;
switch(choice)
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 30/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
exit(0);
}
} Chat with us on WhatsApp
while(choice!=4);
}
Question 12:
Write a function QUEINS( ) in C++ to insert an element in a dynamically allocated queue containing nodes of
the following given structure: Delhi 2009
struct Node
{
int Pid; //Product Id
char Pname[20]; //Product Name
Node *Next;
};
Аnswer:
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 31/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
void QUEINS(Node *rear, int val, char valid) HOW TO PLAY PUBG MOBILE
CLASS 6 7 8 9 10 11 12 NOTES
ON PC OR LAPTOP
{
Node *temp=new Node;
NCERT SOLUTIONS RD SHARMA CLASS 12 CLASS 11 CLASS 10 CLASS 9
temp->Pid = val;
strcpy(temp->Pname,val1); Hi there! Click one of our representatives
CBSE SAMPLE
temp->Next PAPERS
= NULL; LAKHMIR SINGH below and we will get back to you as soon as
possible.
if(rear == NULL)
rear = front = temp;
else CBSE Class 12 Support only
{
rear->Next = temp;
CBSE Class 11 Support only
rear = temp;
}
} CBSE Class 10 Support only
Question 13:
CBSE Class 9 Support only
Write a function QUEDEL( ) in C++ to display and delete an element in a dynamically allocated queue
containing nodes of the following given structure: All India 2009
CBSE Class 8 Support only
struct Node
{ CBSE Class 7 Support only
int Itemno;
char Itemname[30]; CBSE Class 6 Support only
Node *Link;
};
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 32/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 33/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 34/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
CBSE ClassClass
Metals and Nonmetals 9 Support
10 only
CBSE 10
Life Process Class Class 7 Support only
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 35/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
QUICK RESOURCES
Solutions Solutions
Problems
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 36/37
9/11/2019 Important Questions for Class 12 Computer Science (C++) - Linked List, Stack and Queue - Learn CBSE
https://www.learncbse.in/important-questions-class-12-computer-science-c-linked-list-stack-queue/ 37/37