[Year 12 SofDev] Sample Exam Questions
Mike Brookes
mikebr at tpg.com.au
Thu Apr 21 16:41:26 EST 2011
oops forgot to fill in the Top of stack pointer in the table :-(
On 21/04/2011 2:45 PM, Mike Brookes wrote:
> Hi Mark et Al
>
> For the question to make sense one has to make the assumption that the
> stack positions start at the bottom with position zero and go up to
> position 4 which is the top of the stack. At the start the bottom two
> (in bold on the PDF) are valid, hence the top of stack pointer showing 1.
>
> Below is the completed table and the stack at the start and after each
> step:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Stack at start and after each step
> Step Function Top Output
>
>
> Start Step 1 Step 2 Step 3 Step 4 Step 5 Step 6
> 1 Push (23) 2 Item added (23)
> Stack position 4 92 92 92 92 92 92 92
> 2 Push (18) 3 Item added (18)
> 3 75 75 18 18 75 75 75
> 3 Pop 2 Item removed (18)
> 2 23 23 23 23 23 23 23
> 4 Push (75) 3 Item added (75)
> 1 83 83 83 83 83 83 83
> 5 Push (92) 4 Item added (92)
> 0 52 52 52 52 52 52 52
> 6 Push (47) 4 Stack full
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Top 1 2 3 2 3 4 4
>
>
> Mike Brookes
> Semi retired gentleman from Copperfield College
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.edulists.com.au/pipermail/sofdev/attachments/20110421/23094f54/attachment-0001.html
More information about the sofdev
mailing list