Hsc 2003 (1 Viewer)

Premus

Member
Joined
May 21, 2004
Messages
216
Hi

Can u guys help me do question 22 , b) ii) in the 2003 HSC exam?
Is it just that the ENDWHILE statement in line 14 should be after line 21?

Thanks
 

Premus

Member
Joined
May 21, 2004
Messages
216
sorry...it says the file is too big!!
i think the only way is to goto board of studies!

thanks!!
 

Winston

Active Member
Joined
Aug 30, 2002
Messages
6,128
Gender
Undisclosed
HSC
2003
Heh i remember this, i still wasn't sure, we all argued that the while loop wouldn't even execute, since it's using a boolean variable that's not even definied.
 
Joined
May 27, 2004
Messages
107
Gender
Male
HSC
2004
no sorry remove that line all together the Validated=TRUE cause that is done in the AcceptAndValidatePassword
 

raymes

Member
Joined
Jan 21, 2004
Messages
116
Location
Sydney
Gender
Male
HSC
2004
dastonecutters said:
no sorry remove that line all together the Validated=TRUE cause that is done in the AcceptAndValidatePassword
which line do you want to remove? lines 15-19 seem perfectly logical, in fact they all do and it took me a while to see anything wrong with the code

Winston said:
Heh i remember this, i still wasn't sure, we all argued that the while loop wouldn't even execute, since it's using a boolean variable that's not even definied.
this is the same conclusion i came to though for slightly different reasons. i argued that the system_on variable was confused with switched_on but your reason is probably better. although variables do not strictly have to be defined in code, it seems this is what has been done in this code which i didnt pick up immediately so i agree now

IMO this would been a killer under exam conditions. im thinking the markers wouldve been leniant and taken responses that gave decent reasoning?
 

hornetfig

Member
Joined
Jun 27, 2004
Messages
65
Location
Sydney. oddly
Gender
Male
HSC
2003
I did not like this question. There was no obvious mistake because (1) they were asking for a logic error and (2) they did not offer a good description of how the routine was expected to operate.

My answer revolved around not actually being able to turn off the ATM due to the incorrect placement of the code that detects it/the closing loop statement. I know others looked at the discrepancy in variable names for the loop and the power off detection.
 
Joined
May 27, 2004
Messages
107
Gender
Male
HSC
2004
i say remove that line cause u dont want it to be sent through as true cause then it can bipass other things i think well i guess... lol ill tell u in couple of days when i can think properly
 
Joined
May 27, 2004
Messages
107
Gender
Male
HSC
2004
yes i got it..... i am god.... lol


line 4: WHILE Switched_On....

there is not variable called Switched_On... it should be System_on

lol validated has nothing to do with it....

and the effect is that it wont run....
 
Last edited:

Wild Dan Hibiki

teh sex0r
Joined
Feb 28, 2004
Messages
649
Gender
Undisclosed
HSC
2004
heh... i knew that.... =/ i'm seriously screwed for sdd, especially algorithm stuff
 

Winston

Active Member
Joined
Aug 30, 2002
Messages
6,128
Gender
Undisclosed
HSC
2003
dastonecutters said:
yes i got it..... i am god.... lol


line 4: WHILE Switched_On....

there is not variable called Switched_On... it should be System_on

lol validated has nothing to do with it....

and the effect is that it wont run....
Ummm i came to that conclusion already if you read my post...
 
Joined
May 27, 2004
Messages
107
Gender
Male
HSC
2004
im not sure which while loop u are talking about winston but the

WHILE Not CardinSlot

should be something like WHILE CardInSlot = False....

there are the two errors
 

raymes

Member
Joined
Jan 21, 2004
Messages
116
Location
Sydney
Gender
Male
HSC
2004
dastonecutters said:
im not sure which while loop u are talking about winston but the

WHILE Not CardinSlot

should be something like WHILE CardInSlot = False....

there are the two errors
actually your wrong

'not' is a common boolean operator and is used in most programming languages

Code:
if not booleanVar then...
is the same as
Code:
if booleanVar=false then...
 
Last edited:

SamD

Member
Joined
Jul 21, 2002
Messages
256
Gender
Male
HSC
N/A
I recall writing a complaint about this question.... I'll find and post it...
 

SamD

Member
Joined
Jul 21, 2002
Messages
256
Gender
Male
HSC
N/A
Here it is....

Hi everyone,

Some comments on 22(b)(ii) in the SDD HSC.

Exam committee members, please take these comments as constructive criticism. I just feel for the students who had to answer this question and for the poor buggers who've got to mark it!

Anyway here's my comments on it...

1. Firstly, just prior to part (ii) the question says "The system has a logic error", the "system" not necessarily the algorithm, although most would assume the logic error is in the algorithm. Then in part (ii) it says "Locate the error...", we assume "THE error" is the logic error previously referred to, but maybe not! I know this is somewhat pedantic, however maybe it means consideration should be given to awarding marks for locating/correcting any type of error?


2. Line 4 is an error (but is it in reality a typo?) still it should be WHILE System_on. There are two possible effects, either you never enter the loop at all (if Switched_on is false) or processing continues infinitely (if Switched_on is True). In either case it results in bodgy processing, so it is a logic error. If this is the intended error then it's pretty trivial for 4 marks, it's a shame it's in the question as many students will have spotted it and just waffled on about it. Surely students will get marks for it... as the question says locate THE error. (Also if you've gotta READ this value at the end of the loop then surely you'd need to READ it before the loop as a priming READ).

3. Line 21 is redundant, but this does not cause a logic error.

4. Line 5 has an extra space. This line is pointless anyway, as the CustomerNumber originates from the AcceptCardDetails call, so not a logic error. Also why is Validated and StoredPassword initialised? Both these originate from calls. When implemented in code you need to declare them but who cares what their intial values are?

5. The mainline does not implement the structure chart correctly. In the pseudocode AcceptMenuChoice is executed in response to a decision based on the value of Validated, yet no decision diamond appears on the structure chart. The structure chart indicates that the Validated control parameter is sent to the AcceptMenuChoice routine, which it is. The implication being that it is used within the AcceptMenuChoice routine to determine if menu choices can indeed be processed. Is this a logic error? It all still works as intended so I guess not, but there is redundant processing. However, the logic in the pseudocode does not match the logic in the structure chart, so in this sense it is a logic error (or at least some sort of error),its better than nothing so I'd hope some portion of the marks would be awarded.

6. I suspect this could just be 'THE logic error' the examiners were after, but I'm not a mind reader. Imagine the ATM is turned on (Switched_on or System_on, whatever), execution has now entered the outside loop. CardInSlot is set to FALSE, so we enter the inside loop. The only way you can ever get out of this 'WHILE NOT CardInSlot loop is to shove in a card. So the only way to get the thing to turn off is to switch it off (whatever that means!) then shove a card in the card slot, this gets you out of the 'WHILE NOT CardInSlot' loop, before System_on (or Switched_on) is read as false. This is weird stuff, as it seems logical to assume System_on or Switched_on refers to the power, if you turn the power off then surely everything stops regardless of the algorithm! (Maybe there's battery, so the current transaction can be completed, who knows!) If this is "THE error" then it's a bit obtuse, I can think of heaps of ways to include a logic error in the algorithm, and this wouldn't be one of them.

So how do kids fix all this mess? Here's one possible solution that, I think, fixes all of the above...

Code:
BEGIN ATM System
  READ System_on
  WHILE System_on
    IF Card is located in cardslot THEN
      AcceptCardDetails(CustomerNumber,StoredPassword)
      AcceptAndValidatePassword(StoredPassword,Validated)
      AcceptMenuChoice(Validated,CustomerNumber)
    ENDIF
    READ System_on
  ENDWHILE
END
Regards,

Sam
 
Last edited:

raymes

Member
Joined
Jan 21, 2004
Messages
116
Location
Sydney
Gender
Male
HSC
2004
its a bloody mouthful.
im just praying we dont get such an unthought-out question
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top