DataStructure&Pointers AddressCalculation ShortAnswerQuestions(3marks) FormulaeofRowMajor&ColumnMajorareusedinthe givenquestions.Kindlygothroughit. W=4, N =30, M =10, Base(x)RowMajorFormula: =4500 Loc(x[12][8])=Base(x)+W*(M*I+J) Loc(x[2][4]) =Base(x)+W*(M*I+J) =4500+4*(10 *12+8) =4500+4*(10*2+4) =4500+4*128 =4500+4*24 =4500+512 =4500+96 =5012 =4596 memorylocation5000. Ans:Given,W=4,N=20,M=30, Loc(P[2][20])=5000 ColumnMajorFormula: Loc(P[I][J])=Base(P)+W*(N*J+I) 4*(400+2) =5000–1608 =3392 :(i)Row wise (ii) Columnwise. Columnwise W=4, N=5,M : =25,Base(ARR)=1000 Given, W=4, N=5,M =25,Base(ARR)=1000 RowMajorFormula: Loc(ARR[5][7])=Base(ARR)+W*(M*I+J) ColumnMajorFormula: =1000+4*(25*5+7) Loc(ARR[5][7])=Base(ARR)+W*(N*J+I) =1000+4*132 =1000+4*(5*7+5) =1000+528 =1000+4*40 =1528 =1000+160 =1160
DataStructure&Pointers AddressCalculation ShortAnswerQuestions(3marks) FormulaeofRowMajor&ColumnMajorareusedinthe givenquestions.Kindlygothroughit. W=4, N =30, M =10, Base(x)RowMajorFormula: =4500 Loc(x[12][8])=Base(x)+W*(M*I+J) Loc(x[2][4]) =Base(x)+W*(M*I+J) =4500+4*(10 *12+8) =4500+4*128 =4500+512 =5012 =4500+4*(10*2+4) =4500+4*24 =4500+96 =4596 memorylocation5000. Ans:Given,W=4,N=20,M=30, Loc(P[2][20])=5000 ColumnMajorFormula: Loc(P[I][J])=Base(P)+W*(N*J+I) 4*(400+2) =5000–1608 =3392 :(i)Row wise (ii) Columnwise. W=4, N=5,M =25,Base(ARR)=1000 RowMajorFormula: Loc(ARR[5][7])=Base(ARR)+W*(M*I+J) =1000+4*(25*5+7) =1000+4*132 =1000+528 =1528 Columnwise Given, W=4, N=5,M =25,Base(ARR)=1000 ColumnMajorFormula: Loc(ARR[5][7])=Base(ARR)+W*(N*J+I) =1000+4*(5*7+5) =1000+4*40 =1000+160 =1160 :
1499140907master_card_and_practice_set_cs.docx