[Year 12 SofDev] loops and trace tables

Esther ANDREWS ANDREWS.Esther at BSSC.EDU.AU
Tue Feb 28 10:32:08 AEDT 2017


Hi John,

the sign <= is used for conditions and means "Is less than or equal to"

eg

     IF x <= 5 THEN

          DISPLAY "x is less than or equal to 5"

     END IF


I think in your example below you are assigning a value, in which case you would use <- (an arrow).

ie

       x <- 1


The line

             Print time(x)

seems to suggest you have an array called "time" and it contains values. Is that provided as part of the question? It is not possible to do a trace table for the question without that information.


The line

         x+1

is possiblly meant to increment x but as there is no indication that the incremented value is stored anywhere it is not valid.

You need something like

         x <- x+1

or

        increment x by 1


But even after all of that I am not clear what the purpose of the algorithm is?


I think it needs rewording like this:


time is an array ...<insert description/diagram showing the values the array contains here>


BEGIN

   x <- 1

   arrlength <-4

   while x < arrlength

      Print “Time” + x

      Print time(x)

      x <- x + 1

   End while

END



I have attached the work we did during stepup - with answers. You need do delete the contents of the tables to allow students to fill them in.


Hope that helps.

Esther.

Esther Andrews | Admin Systems Developer, IT and Maths Teacher
Bendigo Senior Secondary College
Box 545 | BENDIGO | Victoria  3552   Australia
B +61 3 5443 1222 | F  +61 3 5441 4548
andrews.esther at bssc.edu.au<mailto:andrews.esther at bssc.edu.au>
www.bssc.edu.au<https://mail.bssc.edu.au/OWA/redir.aspx?C=a72c4d4a10f746eea69b0ae04394b999&URL=http%3a%2f%2fwww.bssc.edu.au%2f>
Our ROLE is to empower learners for individual, community and global leadership. We value Respect, Optimism, Learning and Environment.


________________________________
From: sofdev-bounces at edulists.com.au <sofdev-bounces at edulists.com.au> on behalf of WILKIE. John <wilkjoh1 at lavalla.vic.edu.au>
Sent: 28 February 2017 10:09
To: sofdev at edulists.com.au
Subject: [Year 12 SofDev] loops and trace tables


Hi All!



Hope you are all good. First time Soft Dev teacher here.



I’m looking at loops and trace tables at the moment. I’d like to confirm the Pseudocode you could use for a loop? And then how the trace table would look. At the moment I have:



x < = 1

arrlength <= 4

while x < arrlength

Print “Time” + x

Print time(x)

x + 1

End while



x


arrlength


output


1


4


Time1 time1


2


4


Time2 time2


3


4


Time3 time3


4


4


-






















(time is an array where x will be the position in array ie. time1, time2 etc.)



I think the logic is there, but another pair of eyes will help my tired brain. Any major issues?



Also, are there any good Pseudocode examples (possibly with trace tables) that anyone is happy to share?



Regards,



John Wilkie





[http://www.lavalla.vic.edu.au/Images/lavalla-logo.jpg] <http://www.lavalla.vic.edu.au>

John Wilkie


T (03) 5174 8111

John.Wilkie at lavalla.vic.edu.au<mailto:John.Wilkie at lavalla.vic.edu.au>
www.lavalla.vic.edu.au


________________________________

This message may contain confidential and/or privileged information. If you have received this message in error, please notify the sender immediately by replying to this email and then delete the email from your system. Any views expressed in this message are those of the individual sender and not necessarily those of Lavalla Catholic College. Thank you for your cooperation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.edulists.com.au/pipermail/sofdev/attachments/20170227/07a8abca/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Trace Table algorithms solutions.doc
Type: application/msword
Size: 57856 bytes
Desc: Trace Table algorithms solutions.doc
Url : http://www.edulists.com.au/pipermail/sofdev/attachments/20170227/07a8abca/TraceTablealgorithmssolutions-0001.doc 


More information about the sofdev mailing list