Computer Science With C++ Chapter 8 Data Structure
  • Sponsor Area

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

    Data Structure Here is the CBSE Computer And Communication Technology Chapter 8 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 Data Structure Chapter 8 NCERT Solutions for Class 12 Computer And Communication Technology Data Structure Chapter 8 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
    CBSEENCO12011525

    T[25][30] is a two dimensional array, which is stored in the memory along the row with each of its element occupying 2 bytes, find the address of the element T[10][15], if the element T[5][10] is stored at the memory location 25000.

    Solution

    LOC(T[10][15]) = LOC(T[5][10]) + 2(30*(10-5) + (15-10))
                           = 25000 + 2(150 + 5)
                           = 25000 + 2(155)
                           = 25000 + 310
                           = 25310

    Question 3
    CBSEENCO12011619

    T[20][50] is a two dimensional array, which is stored in the memory along the row with each of its element occupying 4 bytes, find the address of the element T[15][5], if the element T[10][8] is stored at the memory location 52000.

    Solution

    Loc(T[I][J])
        =BaseAddress + W [( I – LBR)*C + (J – LBC)]
    (where
    W=size of each element = 4 bytes,
    R=Number of Rows=20, C=Number of Columns=50)
    Assuming LBR = LBC = 0
    LOC(T[10][8])
          52000 = BaseAddress + W[ I*C + J]
          52000 = BaseAddress + 4[10*50 + 8]
          52000 = BaseAddress + 4[500 + 8]
          52000 = BaseAddress + 4 x 508
                       BaseAddress = 52000 2032
    = 49968
    LOC(T[15][5])= BaseAddress + W[ I*C + J]
          = 49968 + 4[15*50 + 5]
          = 49968 + 4[750 + 5]
          = 49968 + 4 x 755
          = 49968 + 3020
          = 5298

    Question 6
    CBSEENCO12011671

    A two-dimensional array P[20] [50] is stored in the memory along the row with each of its element occupying 4 bytes, find the address of the element [10] [30], if the element P[5] [5] is stored at the memory location 15000.

    Solution

    LOC(P[10][30])
          = Loc(P[5][5])+ W[(I­LBR)*C+(J­LBC)]
          = 15000 + 4[(10­5)*50 + (30­5)]
          = 15000 + 4[ 5*50 + 25]
          = 15000 + 4 *275
          = 15000 + 1100
          = 16100

    Question 8
    CBSEENCO12011673
    Question 9
    CBSEENCO12011722

    Write a function ALTERNATE (int A[][3],int N,int M) in C++ to display all alternate element from two-dimensional array A (starting from A[0][0]).
    For example:
    If the array is containing:

    23 54 76
    37 19 28
    62 13 19

    The output will be:

    23 76 19 62 19

    Solution
    #include <iostream.h> 
    #include <conio.h>
    void process_Array(int Arr[][3],int x, int y); 
    void process_Array(int A[][3],int N, int M)
    {
    	clrscr();
    	for (int R = 0; R < N; R++)
    	{
    		if(R%2==0)
    		{
    			for (int C = 0; C < M; C=C+2)
    			{
    				cout<< A[R][C]<<' ';
    			}
    		}
    		else
    		{
    			for (int C = 1; C < M;C=C+2)
    			{
    				cout<< A[R][C]<<' ';
    			}
    		}
    	}
    	cout<<endl; 
    	cout<<endl;
    	for (int I = 0; I < N; I++)
    	{
    		for (int J = 0; J < M; J++)
    		{
    			cout << A[I][J]<<' ';
    		}
    		cout<<endl;
    	}
    }
    int main ()
    {
    	int arr[3][3] ={{23, 54, 76},
    	{37, 19, 28},
    	{62, 13, 19},
    };
    process_Array(arr,3,3); 
    return 0;
    }

    Mock Test Series

    Sponsor Area

    Sponsor Area

    NCERT Book Store

    NCERT Sample Papers

    Entrance Exams Preparation

    23