[Year 12 SofDev] Re: SD VITTA exam 2, multichoice #1

Kevin Feely feely.kevin.k at edumail.vic.gov.au
Wed Oct 17 09:29:12 EST 2007


Hi Mark,
For i= 1 to ... will set i to 1 and you will get at least 1 loop. 
for-next cannot be written (and why would you) so that you do not get 
the loop at least once..
For next is an iteration construct
The other 2 are conditional branching constructs

So logically for-next is not a test but an iteration control - the other 
2 are branching controls DESIGNED for testing. One when you will need to 
loop at least once, and the other in cases when the loop may not need to 
not execute at all.
What do we have .......the 4 main programming constructs ...

    * Sequence .... a series of line of code
    * Repetition (aka iteration or Loops) - where you would use for next
      or whatever the program uses for iterations
    * Conditional Branching
    * Combined Branching and Repetition
          o Conditional test at start of the construct - the "while-do"
          o Conditional test at the end of the construct - the
            "repeat-until"

(taken from http://www.tutorials4u.com/c/loopsdecisions.htm)

Mark Kelly wrote:
> Ah, but FOR..NEXT does test whether the index is beyond the specified 
> boundaries.
>
> e.g. FOR i = 1 to 5
>
> is an implicit pre-test for i>5.
>
> Cheers
> Mark
>
> Kevin Feely wrote:
>> Hi All,
>> I would approach the question with - is their a value for which this 
>> loop would NOT execute?
>> If it is a pre test condition then you will not get any processing 
>> from the lines within the loop, if it is a post test condition then 
>> the loop will execute AT LEAST ONCE.
>> Also i (that is me myself I mwa) accept that the logic of a do-while 
>> loop is to test the condition before the loop starts, and the 
>> repeat-until loop tests at the end of the loop (the construct within 
>> a language will vary BUT in generic terms i accept this "standard"), 
>> even though  the ACTUAL  written algorithm on the question is not 
>> perfect ( I suppose thats hard to do unless you write it in 9 
>> diiferent languages, but then again it is supposed to be in pcode 
>> format and therefore language independent)
>> Also the for-next answer seems to be a bit of a distraction as it 
>> does not TEST for anything, it will simply loop as many times as you 
>> want, via a variable used as a counter,  and this could be from 0 
>> times to a big number.
>> So i would think the expected answer was A
>> regards
>> kev
>>
>>
>> Sonia Cotugno wrote:
>>> I agree with you Mark.
>>>  
>>> I answered with (C) For...Next because none of the others tested at 
>>> the top of the loop. I think it's actually incorrect to say 
>>> Do...While. I really do think it should have said While as an option.
>>>  
>>> Regards,
>>> Sonia Cotugno
>>>  
>>>  
>>> Brighton Grammar School
>>> 90 Outer Cres
>>> Brighton VIC 3186
>>> (03) 8591 2200
>>> www.brightongrammar.vic.edu.au <http://www.brightongrammar.vic.edu.au>
>>>  
>>>  
>>>
>>> ------------------------------------------------------------------------ 
>>>
>>> *From:* sofdev-bounces at edulists.com.au on behalf of 
>>> sofdev-request at edulists.com.au
>>> *Sent:* Fri 10/12/2007 12:00 PM
>>> *To:* sofdev at edulists.com.au
>>> *Subject:* sofdev Digest, Vol 32, Issue 8 [Scanned]
>>>
>>> Send sofdev mailing list submissions to
>>>         sofdev at edulists.com.au
>>>
>>> To subscribe or unsubscribe via the World Wide Web, visit
>>>         http://www.edulists.com.au/mailman/listinfo/sofdev
>>> or, via email, send a message with subject or body 'help' to
>>>         sofdev-request at edulists.com.au
>>>
>>> You can reach the person managing the list at
>>>         sofdev-owner at edulists.com.au
>>>
>>> When replying, please edit your Subject line so it is more specific
>>> than "Re: Contents of sofdev digest..."
>>>
>>>
>>> Today's Topics:
>>>
>>>    1. SD VITTA exam 2, multichoice #1 (Mark Kelly)
>>>
>>>
>>> ----------------------------------------------------------------------
>>>
>>> Message: 1
>>> Date: Fri, 12 Oct 2007 11:59:09 +1000
>>> From: Mark Kelly <kel at mckinnonsc.vic.edu.au>
>>> Subject: [Year 12 SofDev] SD VITTA exam 2, multichoice #1
>>> To: "Year 12 Software Development Teachers' Mailing List"
>>>         <sofdev at edulists.com.au>
>>> Message-ID: <470ED4ED.3020009 at mckinnonsc.vic.edu.au>
>>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>>
>>> I'm curious what others think...
>>>
>>> "Testing at the 'top of the loop' is performed by which syntax in
>>> pseudo-code?
>>>
>>> A. Do..While
>>> B. Do..Until
>>> C. For..Next
>>> D. EOF"
>>>
>>> The suggested answer given is A, with the explanation that 
>>> 'Do..Until is
>>> often referred to as testing at the bottom of the loop...'
>>>
>>> But surely both do..while and do..until both test at the bottom of 
>>> the loop.
>>>
>>> A While..Wend, on the other hand, tests at the top.
>>>
>>> -- 
>>>
>>> Mark Kelly
>>> Manager - Information Systems
>>> McKinnon Secondary College
>>> McKinnon Rd McKinnon 3204, Victoria, Australia
>>> Direct line / Voicemail: 8520 9085
>>> School Phone +613 8520 9000
>>> School Fax +613 95789253
>>> kel AT mckinnonsc.vic.edu.au
>>>
>>> Webmaster - http://www.mckinnonsc.vic.edu.au 
>>> <http://www.mckinnonsc.vic.edu.au/>
>>> IT Lecture notes: http://vceit.com <http://vceit.com/>
>>> Moderator: IT Applications Mailing List
>>>
>>> You'll know when we are officially a civilised race: our schools have
>>> all the money they need and the Air Force has to run a chook raffle to
>>> buy a new bomber.
>>>
>>>
>>>
>>> ------------------------------
>>>
>>> _______________________________________________
>>> sofdev mailing list
>>> sofdev at edulists.com.au
>>> http://www.edulists.com.au/mailman/listinfo/sofdev
>>>
>>>
>>> End of sofdev Digest, Vol 32, Issue 8
>>> *************************************
>>>
>>
>> Important - This email and any attachments may be confidential. If 
>> received in error, please contact us and delete all copies. Before 
>> opening or using attachments check them for viruses and defects. 
>> Regardless of any loss, damage or consequence, whether caused by the 
>> negligence of the sender or not, resulting directly or indirectly 
>> from the use of any attached files our liability is limited to 
>> resupplying any affected attachments. Any representations or opinions 
>> expressed are those of the individual sender, and not necessarily 
>> those of the Department of Education and Early Childhood Development.
>> _______________________________________________
>> http://www.edulists.com.au
>> IT Software Development Mailing List kindly supported by
>> http://www.vcaa.vic.edu.au - Victorian Curriculum and Assessment 
>> Authority and
>> http://www.vitta.org.au/vce/studies/infotech/softwaredevel3-4.html  - 
>> VITTA Victorian Information Technology Teachers Association Inc
>>
>>
>

Important - This email and any attachments may be confidential. If received in error, please contact us and delete all copies. Before opening or using attachments check them for viruses and defects. Regardless of any loss, damage or consequence, whether caused by the negligence of the sender or not, resulting directly or indirectly from the use of any attached files our liability is limited to resupplying any affected attachments. Any representations or opinions expressed are those of the individual sender, and not necessarily those of the Department of Education and Early Childhood Development.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.edulists.com.au/pipermail/sofdev/attachments/20071017/6440b93a/attachment-0001.html


More information about the sofdev mailing list