Queue NCERT Textbook PDF

NCERT Solutions for Class 12 Computer Science Chapter 4 Queue‘ PDF Quick download link is given at the bottom of this article. You can see the PDF demo, size of the PDF, page numbers, and direct download Free PDF of ‘Ncert Class 12 Computer Science Chapter 4 Exercise Solution’ using the download button.

Queue NCERT Textbook With Solutions Book PDF Free Download


Chapter 4: Queue

In the previous chapter, we learned about a data structure called Stack, which works on Last-InFirst-Out (LIFO) principle.

In this chapter, we will learn about another data structure called Queue which works on First-In-First-Out (FIFO) principle. The queue is an ordered linear list of elements, having different ends for adding and removing elements in it.

Queue follows the principle of First In First Out (FIFO), since the element entering first in the queue will be the first one to come out of it. Thus, the element that has been the longest in the queue will be removed first.

It is also known as a First Come First Served (FCFS) approach. The queue is an arrangement in which new objects/items always get added at one end, usually called the REAR, and objects/items always get removed from the other end, usually called the FRONT of the queue. REAR is also known as TAIL and FRONT as HEAD of a queue.

4.1.2 Applications of Queue

(A) The concept of queue has many applications in real-life:
• If a train ticket is in the waiting list (such as W/L1),
it means the ticket is in a queue of tickets waiting to
get confirmed, as per the increasing order of waiting
numbers. If a confirmed ticket is cancelled, the W/
L1 numbered ticket is removed from the FRONT of
the waiting queue and confirmed.

• Sometimes on calling a customer service centre, the
Interactive Voice Response System (IVRS) tells us to
wait till a support person is available. Here the call is
put into a queue of customers waiting to be serviced.

• Imagine there is a single-lane one-way road, then the
vehicle that entered first will exit first, following the
concept of queue. Likewise, vehicles in a highway toll
tax booth are served following the principle of FIFO.

(B) Following are some examples of application of queue in computer science:
• Suppose there is a web-server hosting a web-site to
declare result(s). This server can handle a maximum
of 50 concurrent requests to view result(s). So, to
serve thousands of user requests, a Queue would be
the most appropriate data structure to use.

• Some Operating Systems (OS) are required to handle
multiple tasks called – jobs, seeking to use the
processor. But we know that a processor can handle
only one task at a time. Therefore, in a multitasking
operating system, jobs are lined up (queued) and then
given access to the processor according to some order.
The simplest way is to give access to the processor on
a FIFO basis, that is according to the order in which
the jobs arrive with a request for the processor.

• When we send print commands from multiple files
from the same computer or from different computers
using a shared printer. The OS puts these print
requests in a queue and sends them to the printer
one by one on a FIFO basis.

Language English
No. of Pages14
PDF Size1.6 MB
CategoryComputer Science

NCERT Solutions Class 12 Computer Science Chapter 4 Queue

Question 1:
Define member function delque() to perform delete operation on a linked queue where each node has the following structure :

struct node 
char name[20]
int marks; 
node *link;
class queue
node *front,‘rear; 
public :
queue() {front=rear=NULL;
void delque ( );
};    [CBSE Comptt., 2014]


void queue : : delque ()
if ( front != NULL)
node *Temp = front;
cout << Temp -> name << Temp
front = front->link;
delete Temp;
if(front == NULL)
rear = NULL;
cout << "Queue is empty";
(4 marks for correct program)

Question 2:
Give the necessary declaration of linked’ implemented Queue containing players information (as defined in the following definition of Node). Also write a user defined function in C++ to delete one Player’s information from the Queue.
[CBSE Comptt., 2013]

struct node   
int Player No ;
char PlayerName[20];

NODE *QUEUEDEL(Node * front, int val, char val2[ ])

Node *temp;
if (front ==NULL)    [1]
cout<<"Queue EMPTY";
temp=front ;
temp®PlayerNo=val;    [1]
strcpy (temp®PlayerName, val2); 
front=front®Link;    [1]
delete temp;
return (front);
}  [1]

Question 3:
Write a function QDELETE ( ) in C++ to perform delete operation on a Linked Queue, which contains Passenger no and Passenger name. Consider the following definition of Node in the code,

struct node
long int Pno; 
char Pname [20]; 
node *Link;
};    [O.D, 2013]

//Function to delete queue elements Node * QUEUE (Node * front, int val, char vail [])

Node *temp; 
if (front == NULL) 
cout <<"Queue Empty"; 
temp = front; 
strcpy (temp®Pname, vail); 
front = front®Link; 
delete temp;
return (front);
}    [4]

Question 4:
Write a function QINSERT() in C+ + to perform insert operation on a Linked Queue, which contains Client no and Client name. Consider the following definition of NODE in the code of . QINSERT ().    

struct Node
long int Cno; // Client No 
char Cname [20]; //
Client Name 
Node *Next ;

Function to Insert element
Node * QINSERT (Node *rear, int val),

char val []
Node *temp; 
temp = new Node;
temp®Cno = val; 
strcpy (temp®Cname, val); 
return (rear);
}    [4 ]

NCERT Class 12 Computer Science Textbook Chapter 4 Queue With Answer PDF Free Download

Leave a Comment

Your email address will not be published. Required fields are marked *

error: Content is protected !!