Q. Consider the following code and show how internally the memory is assigned to these

List1 = [2, 3]
List2 = [3, 4, 5]
List3 = [List1, List2]

Assume that the numbers 1..10 are stored in the memory addresses 16000 onward s, each consuming 16 bytes of memory.



Answer :-


It says that the number from 1 to 10 will have memory allocation 16000 onwards

By using that line...

1 -- > 16000

2 -- > 16016

3 -- > 16032

4 -- > 16048

5 -- > 16064

6 -- > 16080

7 -- > 16096

8 -- > 16112

9 -- > 16128

10 -- > 16114

Using the chart mentioned above, memory allocation should be


List3 = [List1, List2]


List3 = [ [ 2 , 3 ] , [ 3 , 4 , 5 ] ]


List3 = [ [ 16016 , 16032 ] , [16032 , 16048 , 16064 ] ]


This is how the memory allocation will work.



         ----- 

Thanks SUMIT 

For giving question's answer.




3 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. It says that the number from 1 to 10 will have memory allocation 16000 onwards
    By using that line...
    1 -- > 16000
    2 -- > 16016
    3 -- > 16032
    4 -- > 16048
    5 -- > 16064
    6 -- > 16080
    7 -- > 16096
    8 -- > 16112
    9 -- > 16128
    10 -- > 16114
    Using the chart mentioned above, memory allocation should be

    List3 = [List1, List2]

    List3 = [ [ 2 , 3 ] , [ 3 , 4 , 5 ] ]

    List3 = [ [ 16016 , 16032 ] , [16032 , 16048 , 16064 ] ]

    This is how the memory allocation will work.

    Regards
    Sumit

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post