Important Questions

CBSE Guess > Papers > Important Questions > Class XII > 2010 > Computer Science > Computer Science By Ravi Kiran

CBSE CLASS XII

OUTSIDE DELHI 2008

Q.3. Write a function in C++ to Delete an element into a dynamically allocated Queue where each node contains a real number as data. Assume the following definition of MYNODE for the same.
struct MYNODE
{
float NUM;
MYNODE * Link;
};

 

Solution:

struct MYNODE
{
float NUM;
MYNODE *Link;
};
class Queue
{
MYNODE *front,*rear;
public:
Queue( )
{ front=rear=NULL; }
void Insert( );
void Delete( );
void Display( );
};
void Queue::Delete( )
{
MYNODE *temp;
if(front= = NULL)
cout<<”Queue Underflow”;
else
{
cout<<”\nThe content of the element to delete: “<<frontNUM;
temp=front;
front=frontLink;
delete temp;
}
}

Q.4. Evaluate the following postfix notation of expression (Show status of stack after execution of each operations): 5, 20, 15, -, *,25, 2, *, + 2.

Ans:

Children, Try this answer as an assignment.

DELHI : 2007

Q.1. Write a function in C++ to delete a node containing Book’s information, from a dynamically allocated Stack of Books implemented with the help of the following structure.
struct Book
{ int BNo ;
char BName[20] ;
Book *Next ;
} ;

Paper By Mr. Ravi Kiran
Email Id : [email protected]