The Student Room Group

[AQA CPT 4] Trace Tables/Assembly Language

I know lot of people are having problems when it comes to trace tables and assembly language, me included! I am aiming for an A, and I feel like I will be going into the exam tomorrow having already lost 20 marks. I know a lot of people are saying practice makes perfect, but I have spent a lot of time practicing, I still cant get my head around it after looking at the mark scheme. I have uploaded some questions I am finding particularly irksome, from Jan and Jun 06, and do not understand at all, and I was wondering if people could help me out...?












I will love you forever if you could educate me :p:
Reply 1
No one?
trust me, i would love to educate u but i cant do the blooming things myself!!!!!
Reply 3
xxx-Laura-xxx
trust me, i would love to educate u but i cant do the blooming things myself!!!!!

Looks like we are both up poo creak without a paddle :frown:
Reply 4
i know that the AND instruction thing compares 2 bits and if both bits are 1 returns a 1 and everything else is 0
ASCII 00110000
binary for 0 00000000
*** that would make the answer 00000000 sucketh
my teacher went thru this one, but i never got it, i hate assembly!!
but i know you have to convert to hex, which would make my wrong answer #00

i just found the paper with that question 7 and my teacher made it out to be #OF
only one mark? harsh.
Reply 5
oops - only just seen this.

Are you still interested?
Reply 6
Help Me!
I can't help with assembly language cos that just sucks and i dont think many people can do it:confused: , but trace table i can.

For count1 1-4, means that while that field number is 4 or less, the rest of the code can happen. when it gets to four, the algorithm stops running.

If A[Count2] > A[Count2 + 1] Then
on the table there are colums with the header A, with numbers, 1-5. take the value that is in count2 column at the time and put lookup that number A column. Say count equaled 1, then A[1] would be 23 in the table. If this number is bigger than A[1+1], or A[2] then move onto the next piece of code. in the first run A[2] is 45. this is bigger than 23 so we move onto the piece of code contained in the then bit.

Temp  A[Count2]
This means take the value of A[count2] column and put it in the temp column. the arrow mean that the field being pointed to by the arrow, take on the value of the field on the left.

A[Count2] A[Count2 + 1]
same thing here, the new number for A[count2] field is the value of A[count2+1]

A[Count2 + 1] Temp
and thirdly the same again, the value that you just put into the temp column, is copied into the a[count2+1] column.

after this you add one to both the count1 and count2 columns, this is called incrementing. you then repeat the earlier steps until either no more numbers will swap or you reach count1 = 5. you dont do a fifth run.
btw, the purpose of the algorithm is to sort the numbers and you should end up with the numbers in ascending order when you are finsihed running the algorithm.

hope this helps.:p:
Reply 8
Further to the above - a lot of the traces (but not all) are standard algorithms or bits of them.

This one has two nested loops
comparing adjacent elements
swapping adjacent elements if the comparison yields the right result

(anything of the form

temp <-- X
X <-- Y
Y <-- temp

is a swap)

this will hopefully clue you in that it's a bubble sort. They have also used one pass of a bubble sort before now

the tree one is basically

explore left subtree
output item at node
explore right subtree

which should be enough to tell you that it's an in-order traversal

(pre-order is output node, left, right - and post-order is left, right, output node)

if you spot that it's a standard algorithm then you can use this to check your trace is correct

I can help with the assembly language ones too, but since the answers are presumably in the mark scheme there's not a lot of point just providing them myself - can you say what aspect's giving you particular trouble?