• Best of luck to the class of 2024 for their HSC exams. You got this!
    Let us know your thoughts on the HSC exams here
  • YOU can help the next generation of students in the community!
    Share your trial papers and notes on our Notes & Resources page
MedVision ad

Question 22 exam thoughts (1 Viewer)

Ragerunner

Your friendly HSC guide
Joined
Apr 12, 2003
Messages
5,472
Location
UNSW
Gender
Male
HSC
2003
What was the error in the algorithm?

Is it the Customer Number = 0 ?
 

honky tonk

in Miracle World
Joined
Dec 26, 2002
Messages
1,032
Location
Newcastle
Gender
Male
HSC
2003
I said it was in line 4.

The variable name is called Switched_on but is not declared anywhere, so I assumed it would autmatically be false.. with that, I said that the loop would never be entered.

Dunno if it's right..
 

andy jay

New Member
Joined
Aug 9, 2003
Messages
18
also i put that in lines 4 and 9 there is no condition after the variable, causing the logic error
 

Inhuman

Member
Joined
Oct 14, 2003
Messages
132
Location
In the CSE labs at unsw
Gender
Female
HSC
2003
finish rest of exam. stare at algorithm for 20 minutes. Perform deskcheck. Start writing complicated answer about how I couldn't find anything wrong, and THEN i saw the f*cking thing!

It was definitely the switched_on variable
 

Winston

Active Member
Joined
Aug 30, 2002
Messages
6,128
Gender
Undisclosed
HSC
2003
Originally posted by honky tonk
I said it was in line 4.

The variable name is called Switched_on but is not declared anywhere, so I assumed it would autmatically be false.. with that, I said that the loop would never be entered.

Dunno if it's right..

Hmmmm yeah i sort of said that, i said for one the variable doesnt exist and then i said it should of been System_on, and also even if the Switched_on is defined else where there is absolutely no condition to notify that loop of it stopping, it needed to be assigned a boolean value.
 

Adam

Member
Joined
Oct 21, 2003
Messages
391
Location
Sydney
Gender
Male
HSC
2003
That was crap, that algorithm was flawless, disregarding little nigglies such as not declaring. WTF was that, they are supposed to put errors in it aren't they?

My one was that it would still go through and get the card number and all if the system was off, my solution - check the system status every line :p

Yeah, its probably not going to be a mark magnet, but that was bullshit.
 

Fiona

Member
Joined
Apr 28, 2003
Messages
135
Location
Sydney
Oh crap.

I thought it was later on when the thing checked to see if the card was there, and then after the IF thing to see if there was a card, there was instructions for what to do.

I thought the error was that in even if there was no card, it was doing the instructions for if there was a card eg. checking the password and stuff.

Hmm... :confused:
 

enak

Limbo
Joined
Oct 18, 2002
Messages
1,046
Location
Sydney
Gender
Undisclosed
HSC
N/A
I talked about the switched_on thingo

Other than that, i thought it was an easy test :(
 

rad

New Member
Joined
Sep 7, 2003
Messages
9
Is it the Customer Number = 0 ?
i put this too. my reasoning was because when it is passed as a parameter between modules, there is no space, hence when the WHILE loop is intitiated the second time, the customernumber will not be reset. although the other error (line 4) seems better.....
 

JRasnier

Member
Joined
Apr 24, 2003
Messages
416
i actually said line 21 was wrong, validated = true, cause i said that the door would always be validated as true as long as it was switched on....dayum it dayum it...
 

-X-

Member
Joined
Aug 10, 2003
Messages
481
Gender
Undisclosed
HSC
N/A
Originally posted by Fiona
Oh crap.

I thought it was later on when the thing checked to see if the card was there, and then after the IF thing to see if there was a card, there was instructions for what to do.

I thought the error was that in even if there was no card, it was doing the instructions for if there was a card eg. checking the password and stuff.

Hmm... :confused:
I did something similar. Put "Read cardslot" in line 12.5 after "cardinslot = true". Other wise if the person put a card in after "Read carslot" was executed, the loop would end without the card being read. Thats how i understood it not sure though...:confused:
About the variable not being defined i think is not true as that wouldn't be an error in the logic but a runtime error so the code wont run or compile.... i think.
 

cadsy48

Member
Joined
Sep 23, 2003
Messages
35
i thinkthat switched_on was a syntax error not a logic?? opr maybe i fucked the question???
 

mattyb

New Member
Joined
Nov 4, 2003
Messages
23
Location
ashtonfield
Gender
Male
HSC
2003
what about the argument count mismatch in the subroutines? the algorithm had parameters that were outputs which doesnt happen in subroutines, unless its a function then has one output only.
 

-X-

Member
Joined
Aug 10, 2003
Messages
481
Gender
Undisclosed
HSC
N/A
Originally posted by mattyb
what about the argument count mismatch in the subroutines? the algorithm had parameters that were outputs which doesnt happen in subroutines, unless its a function then has one output only.
I noticed that too but i didn't talk about it as incase i was wrong.
 

JRasnier

Member
Joined
Apr 24, 2003
Messages
416
well

with line 21, Validated = true, wouldnt that mean that the carddetails were accepted even if it wasnt validated in any of the subprograms.... thats a logic error isnt it?
 

JRasnier

Member
Joined
Apr 24, 2003
Messages
416
but with the READ cardslot line, it still works....nothing wrong with that happening....well i dont see any errors, maybe just wasts power but nothing spectacular...
 

JRasnier

Member
Joined
Apr 24, 2003
Messages
416
umm i reckon its syntax, as it will try to read the condition, would it still execute if the code is as it is? no because its SYNTAX is wrong, logical doesnt stop the execute...well thats how i see it..
 

-X-

Member
Joined
Aug 10, 2003
Messages
481
Gender
Undisclosed
HSC
N/A
I think it would be runtime. IE u cant compile a code with variables that are not defined?

Edit: could also be syntax too as its no different to mispelling a reserved word.
 
Last edited:

Saintly Devil

Member
Joined
Oct 12, 2002
Messages
107
It said that there was a logic error. That means that it executes fine, but the result isn't what is expected. This doesn't have to be an in-the-face error - it can be a subtle error (as was in this case)

The error (IMO) was that if a person got the password wrong 3 times in a row they could endlessly try different combinations of passwords - meaning they could access someone's account via trial and error, and this would have severe ramifications on the system, as both the bank and users could lose out big time on theft.

Basically, having the condition
IF Validated = true THEN
ChooseMenu (whatever)

and then not doing anything if Validated = false led to the logic error. To solve it I just created an algorithm that added the CustomerNumber to a block list if Validated = false so that you couldn't gain access again until "administration has reactivated your account".

That's basically what i came up right at the end (I think i'm right, but stand to be corrected - my teacher agreed with me, but I'm not sure whether he had really fully read the question coz it was straight after the exam)
 

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

Top