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

Mark Kelly kel at mckinnonsc.vic.edu.au
Sun Oct 14 12:56:18 EST 2007


Timmer-Arends wrote:
> Hello Kevork and Mark
> 
> Pascals FOR loop syntax is:
>      FOR i:=1 TO MaxWords DO
>        BEGIN
>          WordList[i].Word:='';
>          WordList[i].Freq:=0;
>        END;
> 
> And the CASE statement in C executes all statements following the first
> match - and therefore I imagine all C-like languages do. Hence the need for
> a 'break' statement if you don't want that to
> happen. BASIC does not do this.

Thanks for that clarification.  I'll give a couple of kids an extra mark.

> Also, I'm not sure, but, unlike C, the FOR..NEXT in BASIC may actually be a
> POST test with the loop instructions being executed once even if the
> termination number is less than the start number.

BASIC tests at the top.  If you use...

FOR i = 10 to 9
   MSGBOX i
NEXT

nothing appears.

> 
> Also also, MS BASIC (and VB) is the only language I've come across that
> allows the keyword WHILE (and UNTIL I think) to be used at the top or 
> bottom
> of a loop.
> 
> All of this raises the interesting question of how one should represent 
> an 'algorithm' as opposed to a 'program'. Once upon a time Pascal syntax 
> was popular for this and then C. I suppose if we know that that is the 
> language being used to represent any given algorithm then there should 
> be no diificulty interpreting the action of a given construct. But if we 
> don't know the language then an algorithm is open to interpretation.

Agree fully.  The CASE statement on the exam would give different 
results depending on the language the student used during the year. 
It's one problem with pseudocode: if it refers to a real keyword in a 
real language, we have to decide how it behaves!

> De Marco and other advocated the use of 'structured English' - a 
> language independent tool. Perhaps we should be using this, or a 
> diagrammitc approach?

Stick to flowcharts or N-S perhaps?  It's less vague/ambiguous than 
pseudocode can be.

> Regards
> Robert T-A
> Brighton SC
> 
> 
> ----- Original Message ----- From: "Kevork Krozian" 
> <Kroset at novell1.fhc.vic.edu.au>
> To: "Year 12 Software Development Teachers' Mailing List"
> <sofdev at edulists.com.au>
> Sent: Friday, October 12, 2007 3:10 PM
> Subject: Re: [Year 12 SofDev] SD VITTA exam 2, multichoice #1
> 
> 
> Hi ,
> 
>  Pascal from memory had the
> 
> 1. Pre test in the form of    while ( condition is true )  do  begin
> ......end
> 2. Post test in the form of   repeat  ......         until ( condition is
> true )
> 3. For loop which has a pre test    -  for ( count =1; count <=10; count =
> count + 1)  begin.............end
> 
> I last taught pascal in 1996 ......
> 
> Kevork
> 
> 
>>>> Mark Kelly <kel at mckinnonsc.vic.edu.au> 12/10/2007 1:41 pm >>>
> I just did it in VB6, but the syntax requires the LOOP keyword as well...
> 
> A=3
> DO
> msgbox A
> A=A-1
> LOOP WHILE A>0
> 
> I haven't touched FORTRAN for 30 years, so it's a bit hard to remember,
> however I admit that after a quick Google, I couldn't find a DO..WHILE
> example with a post-test.
> 
> Frank Van Den Boom wrote:
>> I could be wrong but, I don't think Pascal or VB support a while
>> statement in which the test is at the end of the loop. I would also be
>> doubtful about Fortran77 i.e.
>>
>> Do
>> ..
>> ..
>> While count < 10
>>
>> I can't make this work in VB.NET.
>> Do you have a short procedure that demonstrates this working in VB?
>> To be honest, I still wonder if we are talking on the same wavelength
>> here?
>>
>> Frank
>>
>> -----Original Message-----
>> From: sofdev-bounces at edulists.com.au
>> [mailto:sofdev-bounces at edulists.com.au] On Behalf Of Mark Kelly
>> Sent: Friday, 12 October 2007 1:14 PM
>> To: Year 12 Software Development Teachers' Mailing List
>> Subject: Re: [Year 12 SofDev] SD VITTA exam 2, multichoice #1
>>
>> QBasic or Visual Basic
>> ActionScript
>> C or C++
>> Java
>> JavaScript
>> REALbasic
>> FORTRAN 77
>> Pascal
>> PHP
>>
>> http://en.wikipedia.org/wiki/Do_while_loop
>>
>> Frank Van Den Boom wrote:
>>> While I have only used about 5 different languages in my programming
>>> past, I have not seen an implementation of While which tests at bottom
>>
>>> of loop. Are there languages that offer this?
>>>
>>> -----Original Message-----
>>> From: sofdev-bounces at edulists.com.au
>>> [mailto:sofdev-bounces at edulists.com.au] On Behalf Of Mark Kelly
>>> Sent: Friday, 12 October 2007 12:53 PM
>>> To: Year 12 Software Development Teachers' Mailing List
>>> Subject: Re: [Year 12 SofDev] SD VITTA exam 2, multichoice #1
>>>
>>> I'm thinking of a different DO..WHILE syntax as in...
>>>
>>> DO
>>>     ...
>>> WHILE <condition>
>>>
>>> which means it always loops at least once.
>>>
>>> And I interpret the dots in "DO..WHILE" expressions to mean "loop
>>> contents go here" so the DO is at the top and the WHILE is in fact at
>>> the bottom.
>>>
>>> As in the classical FOR..NEXT, the FOR is at the top, the NEXT at the
>>> end.
>>>
>>> Frank Van Den Boom wrote:
>>>> Not sure if I clearly understand why you think Do..While tests at the
>>
>>>> bottom of the loop.
>>>> When option A states it as "Do..While", it is not meant to imply that
>>
>>>> the "Do" bit is at the top and the "While" bit at the bottom - both
>>>> of
>>>> these bits are in the statement at the top of the loop. Eg. As well
>>>> as
>>>> the old While/Wend, VB also offers the following
>>>>
>>>> Do While Count < 10
>>>> ..
>>>> ..
>>>> Loop
>>>>
>>>> In Pascal, it was done something like:
>>>> While Count < 10
>>>> Begin
>>>> ..
>>>> ..
>>>> End
>>>>
>>>> I remember reading years ago, that some classic programmers would
>>>> always use a while loop in place of a repeat loop as a matter of
>>>> principle to cover the possibility that you don't want the loop
>>> entered at all.
>>>> Frank
>>>> -----Original Message-----
>>>> From: sofdev-bounces at edulists.com.au
>>>> [mailto:sofdev-bounces at edulists.com.au] On Behalf Of Mark Kelly
>>>> Sent: Friday, 12 October 2007 11:59 AM
>>>> To: Year 12 Software Development Teachers' Mailing List
>>>> Subject: [Year 12 SofDev] SD VITTA exam 2, multichoice #1
>>>>
>>>> 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
>>>
>>> -- 
>>> Mark Kelly
>>
>>
>> -- 
>> Mark Kelly
> 
> 


-- 
Mark Kelly
Manager - Information Systems
McKinnon Secondary College
McKinnon Rd McKinnon 3204, Victoria, Australia
Direct line: 8520 9085
School Phone +613 8520 9000
School Fax   +613 9578 9253
kel AT mckinnonsc.vic.edu.au

Webmaster - http://www.mckinnonsc.vic.edu.au
IT Lecture notes: http://vceit.com
Moderator: ITA Mailing List

Some days you're the pigeon.  Some days you're the statue.




More information about the sofdev mailing list