answers - external Fri:10:30 2011 = MT4112 Exam January...

Info icon This 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
Image of page 1

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern