Computer Science With C++ Chapter 9 Linked List, Stack And Queue
  • Sponsor Area

    NCERT Solution For Class 12 Computer And Communication Technology Computer Science With C++

    Linked List, Stack And Queue Here is the CBSE Computer And Communication Technology Chapter 9 for Class 12 students. Summary and detailed explanation of the lesson, including the definitions of difficult words. All of the exercises and questions and answers from the lesson's back end have been completed. NCERT Solutions for Class 12 Computer And Communication Technology Linked List, Stack And Queue Chapter 9 NCERT Solutions for Class 12 Computer And Communication Technology Linked List, Stack And Queue Chapter 9 The following is a summary in Hindi and English for the academic year 2021-2022. You can save these solutions to your computer or use the Class 12 Computer And Communication Technology.

    Question 1
    CBSEENCO12011527

    Convert the following Infix expression to its equivalent Postfix expression, showing the stack contents for each step of conversion.
    P + ( Q - R ) * S / T

    Solution

    Conversion of  the given Infix expression to its equivalent Postfix expression
    (P+(((Q-R)*S)/T))

    INFIX STACK POSTFIX
    ( (  
    P ( P
    + (+ P
    ( (+( P
    Q (+( PQ
    - (+(- PQ
    R (+(- PQR
    ) (+ PQR-
    * (+* PQR-
    S (+* PQR-S
    / (+/ PQR-S*
    T (+/ PQR-S*T
    )   PQR-S*T/+
    Question 3
    CBSEENCO12011574

    Convert the following Infix expression to its equivalent Postfix expression, showing the stack contents for each step of conversion:
    X - ( Y + Z ) / U * V

    Solution
    ELEMENT STACK POSTFIX
    X   X
    - - X
    ( -( X
    Y -( XY
    + - ( + XY
    Z - ( + XYZ
    ) - XYZ+
    / -/ XYZ+
    U -/ XYZ + U
    * -* XYZ + U/
    V -* XYZ +U/V
        XYZ+U/V*-
    Question 4
    CBSEENCO12011622

    Convert the following Infix expression to its equivalent Postfix expression, showing the stack contents for each step of conversion.
    A/(B+C)*DE

    Solution

    A/(B+C)*DE
    = (A / (B+C) * D E)

    Element Stack of Operators Postfix Expression
    ( (  
    A ( A
    / (/ A
    ( (/( A
    B (/( AB
    + (/(+ AB
    C (/(+ ABC
    ) (/ ABC+
    * (* ABC+/
    D (* ABC+/D
    - (- ABC+/D*
    E (- ABC+/D*E
    )   ABC+/D*E-

    ABC+/D*E

    Question 5
    CBSEENCO12011674

    Convert the following infix expression to its equivalent postfix expression, showing the stack contents for each step of conversion.

    X / Y + U* (V­W)

    Solution

    X / Y + U* (V­W)=((X / Y)+(U*(V­W)))

    Element Stack Postfix
    X   X
    / / X
    Y / XY
    + + XY/
    U + XY/U
    * +* XY/U
    ( +*( XY/U
    V +*( XY/UV
    - +*(- XY/UV
    W +*(- XY/UVW
    ) +* XY/UVW-
      +* XY/UVW-*
        XY/UVW-*+

    Question 8
    CBSEENCO12011724

    Write a function in C++ to read the content of a text file “DELHI.TXT” and display all those lines on the screen, which are either starting with ‘D’ or starting with ‘M’.

    Solution
    #include<fstream.h> 
    #include<conio.h> 
    int main()
    {
    	ifstream fin; 
    	fin.open('out.txt');
    	char str[80]; 
    	int count=0; 
    	clrscr();
    	while(!fin.eof())
    	{
    		fin.getline(str,80); 
    		if(str[0]=='D' || str[0]=='M')
    		{
    			cout<<str<<endl;
    		}
    		count++;
    	}
    	cout<<'Number of lines in file is '<<count; fin.close();
    	getch(); 
    	return 0;
    }

    Mock Test Series

    Sponsor Area

    Sponsor Area

    NCERT Book Store

    NCERT Sample Papers

    Entrance Exams Preparation

    28