Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Instructions Questions Arrays are incredibly useful, and really important to understand. Hand execution can really help you understand these more fully List the actions the
Instructions Questions Arrays are incredibly useful, and really important to understand. Hand execution can really help you understand these more fully List the actions the computer executes when it runs the following code for i : oto 3 do begin To represent an array draw a box divided into sections for each value. This represent the an ray's location in memory, providing you with access to the array as a whole and to the individ- ual elements. endi The following is an example of how to represent an array in your Hand Execution List the actions the computer executes when it runs the following code dt 6 2 3 81 for 1 ;= 3 downt* 0 do begin WriteLn'i is ', i, end; Tip: It can also be useful to add the indexes above the data. This will help make it easily to lookup the values in the array Assume that names is an array of three names. Names array Demonstrate how the following code is executed in the computer Index Value function ??7(const data: array of Integer): Integer; : Integeri result ;= 0; for i-Low (data) to High (data) do 0 Jasper 1 Sam 2 Milly begin List the actions the computer executes when it runs the following code begin result- result+ datal il; end writeln( 'Array of ' , Length (names } , ' values' ); end; for i :-0 to High(names) do begin WriteLn (names [i]) Hand Execute the program with the following parameter values to see if you can work out what t does end: data [7, -2, 2, 6, 1 13, 5, -3, 2] Assume that a Score record contains a name and a score, and that the scores variable is an array of three Score record values Scores array Result Index Value 0 Name: Jasper Score: 5 Provide a name for this on your hand execution images 1 Name: Sam Score: 10 The following code performs a useful task with an array of Integer values. What does it do? 2 Name: Milly Score: 12 function ??? (const data: array of Integeri Assume you also have the following procedure val: Integer): Boolean; var procedure WriteScore (const towrite: Score) begin i: Integer: resultFa1se for i ;= Low (data) to High {data) do begin WriteLn (towrite.name,'scoredtoWrite.score) end; begin What will be output when the computer runs the following code if datai]val then begin result :- True; exiti 1 end the function Writeln 'Message ' WriteLn ( scores [1] , Name ); riteLn end end: riteLn'Message 1' for i:-0 to High scores) do begin writeln( scores [i]Name ); Han d execute the functio n with the following parameter values. end; val data 1, 4, -3, 2, 5] -3, 7, 6, -2, 11 esu riteLn nriteLn 'Message 2' for i-0 to High (scores) do begin Writescore (scores [i]) end; Provide a suitable name for this function on your hand execution image you submit
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started