2013 HSC Paper Question 20 (SDD) (1 Viewer)

dan964

what
Joined
Jun 3, 2014
Messages
3,473
Location
South of here
Gender
Male
HSC
2014
Uni Grad
2019
Been trying to figure out what I'm doing wrong with this question. (Q.20, SDD HSC 2013 Paper)

I am completely stumped to how this question's correct answer is D.

Anyone got have an explanation...

Link to question here...

Link to answers here...

:frown2:
It is C from the MG.

LOAD b
SUBTR a
JMPN else

IF b-a <0 then go to else statement. that is if b<a.
This means the IF statement in the high level code corresponds with the else block in the CPU code.

(Think of the ELSE case in the high-level language as the default, and so the default in the CPU code, is the JMPN code doesn't trigger a jump to "else")
 

silverdawn565

Member
Joined
Oct 25, 2017
Messages
53
Location
Newcastle, NSW
Gender
Female
HSC
2017
Oh yea I did this paper in class when we had finished the course early. I got it wrong at first I remember.
So D loads 'a' into the accumulator. Because 'b' needs to be less than 'a', a - b needs to be positive. JUPN jumps if a - b is negative to 'else'. If a - b isn't negative then it just continues on.
Actually... now I'm confused... lol
Nvm, it's not D. I agree with C now but it's confusing because 'c=a' is under 'else' instead of c=b and the command for 'IF a>b', would be 'IF b>=a' in this case...
IF b>=a THEN
c=b
ELSE
c=a
ENDIF
which is the same as saying:
IF a>b THEN
c=a
ELSE
b=a
ENDIF
Correct me if I'm wrong because I'm actually a bit confused and might have overthought it.
 

silverdawn565

Member
Joined
Oct 25, 2017
Messages
53
Location
Newcastle, NSW
Gender
Female
HSC
2017
Oh yea I did this paper in class when we had finished the course early. I got it wrong at first I remember.
So D loads 'a' into the accumulator. Because 'b' needs to be less than 'a', a - b needs to be positive. JUPN jumps if a - b is negative to 'else'. If a - b isn't negative then it just continues on.
Actually... now I'm confused... lol
Nvm, it's not D. I agree with C now but it's confusing because 'c=a' is under 'else' instead of c=b and the command for 'IF a>b', would be 'IF b>=a' in this case...
IF b>=a THEN
c=b
ELSE
c=a
ENDIF
which is the same as saying:
IF a>b THEN
c=a
ELSE
b=a
ENDIF
Correct me if I'm wrong because I'm actually a bit confused and might have overthought it.
I really hope I don't take this long to solve a MCQ today in the exam though... I actually ended up deskchecking (not exactly, I drew a tree diagram for D & C...)
 
Last edited:

sparcut

Member
Joined
Aug 17, 2017
Messages
31
Gender
Undisclosed
HSC
N/A
Interesting, I agree with C since:

b is put into ACC then you subtract a from the ACC.

If that results in a negative (aka a being greater than b), it puts a into ACC then stores that in c.

Then visa versa; if the result is not negative, it will put the value of b into ACC then stores that in c.

...

Are the answers wrong..? :jawdrop:
 
Last edited:

dan964

what
Joined
Jun 3, 2014
Messages
3,473
Location
South of here
Gender
Male
HSC
2014
Uni Grad
2019
I really hope I don't take this long to solve a MCQ today in the exam though... I actually ended up deskchecking (not exactly, I drew a tree diagram for D & C...)
I didn't do SDD, so I just did it knowing using intuition.
 

sparcut

Member
Joined
Aug 17, 2017
Messages
31
Gender
Undisclosed
HSC
N/A
Well... it was pointed out to me before the exam that the marking guidelines actually says C.

I must have had some temporary dyslexia, cause I swear it said D.

dan, you did say it was C from the marking guidelines, but I think I skipped over that, somehow didn't understand your acronym 'MG'.

Cheers for the help anyway! :eek:
 

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

Top