In: Computer Science
1.Why is important to understand dynamic multi-dimension arrays as “arrays of arrays?”
a.Each dimension requires another “pointer layer” which we have to build as arrays of pointers which in turn possibly point to arrays of pointers which eventually point to an array of the data type. Each array is allocated ‘where it fits’ at the time of creation, each of these arrays can be uniquely sized as well.
b.It just helps us organize the data in our head, in reality all the information is sequential anyway
c.Each dynamically allocated array is placed in memory ‘where it fits’ at the time of creation, meaning each pointer points to a single array of the data type.
d.none of these
.
2.When passing by pointer ... the pointer itself is passed by value. The value in this method is that we can use the pointer to make changes in memory.
a.true
b.false
.
3.Which of the following describes Passing by Reference?
a. The actual variable memory is passed into the function and any activity done to the parameter is reflected outside the function as well.
b.The address is passed through and needs to be de-referenced to work with the value contained within. Activity done to the de-referenced value is reflected outside the function. NULL is a valid value to pass and should be handled.
c.The value is passed in as a copy. Any activity done to the parameter stays local to the function and is not reflected outside. NULL is not valid to be passed.
d.A literal is passed to the function and the parameter is treated as a constant. No activity can be done on the parameter and nothing is reflected outside the function.
<<<<<<<<<<<< Question 1 >>>>>>>>>>>>>>>
1.Why is important to understand dynamic multi-dimension arrays as “arrays of arrays?”
c.Each dynamically allocated array is placed in memory ‘where it fits’ at the time of creation, meaning each pointer points to a single array of the data type.
in dynamically allocated array each row gets a pointer of its own and it allocates memory to the pointer as it finds it fitting in memory whereever it can find
<<<<<<<<<<<< Question 2 >>>>>>>>>>>>>>>
2.When passing by pointer ... the pointer itself is passed by value. The value in this method is that we can use the pointer to make changes in memory.
b.false
as data is copied while passing so pointer data wont be changed
<<<<<<<<<<< Question 3 >>>>>>>>>>>>>>>>
3.Which of the following describes Passing by Reference?
a. The actual variable memory is passed into the function and any activity done to the parameter is reflected outside the function as well.
<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>