answers - external.txt Fri Dec 16 12:10:30 2011 = MT4112...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
external.txt Fri Dec 16 12:10:30 2011 1 ============================= MT4112 Exam January 2010 ============================= %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% QUESTION ONE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ============ Part (a) ============ Call by reference : A variable being passed through an argument list, from the calling unit, is NOT copied into a new variable of the same data type inside the procedure. Instead a reference to the location in memory where the argument is stored is passed instead.The address is then used to create a dummy variable which in turn can directly access the value or make changes to the original variable it is associated with from the calling procedure. Call by value : The procedure make a new "copy" of the argument at a new memory location. Fortran uses ‘Call by Reference’. Fortran is designed for numerical computation. This demands speed and efficiency. ‘Call by Reference’ is very much faster than ‘Call by Value’ especially when using massive multi dimensional arrays. ‘Call by Reference’ also uses far less memory, this is because the code is not creating a new copy of every variable being passed through the argument list. ============ Part (b) ============ The assumed-shape array is recommended for all arrays passed to procedures (dummy arrays). For each rank in the "DIMENSION" attribute, instead of explicitly specifying a size for that dimension a colon is explicitly written instead. This means the rank is given but the actual shape is assumed from that of the corresponding actual argument. An automatic array is a "local" array in a procedure which has its size set inside the procedure when the procedure is called. The array sizes are specified using information passed through the argument list. The dimension bounds may be integer expressions involving any variables accessible at that point: normally this means other items in the argument list. They are local to a procedure so and cannot have the SAVE attribute. ============ Part (c)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/13/2012 for the course MATH 5806 taught by Professor Brooks during the Fall '10 term at Minnesota.

Page1 / 5

answers - external.txt Fri Dec 16 12:10:30 2011 = MT4112...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online