The Student Room Group

AQA Computing COMP 3- 22nd June 2016 [Exam Discussion]

Scroll to see replies

Reply 40
Original post by RedRum99
Did
every one get -1344 or something like that for the floating point question?


Yes
Reply 41
Did anyone do a(ba|c)* for the last question?
Original post by Swizzas
Did anyone do a(ba|c)* for the last question?


I thought it was just ac*
Original post by RedRum99
Did everyone get -1344 or something like that for the floating point question?


Yeah
Original post by Swizzas
Did anyone do a(ba|c)* for the last question?


I got a(ba)*c*
Original post by TercioOfParma
I got a(ba)*c*


This is incorrect, unfortunately, as the "ba"s and "c"s could be mixed in any order so the correct answer would be a(ba|c)*.
Original post by Swizzas
Did anyone do a(ba|c)* for the last question?


Definitely a(ba|c)* yeah
Original post by Mav1
This is incorrect, unfortunately, as the "ba"s and "c"s could be mixed in any order so the correct answer would be a(ba|c)*.


Well, you could go accbac and that doesn't match so it can't be that either.
Original post by TercioOfParma
Well, you could go accbac and that doesn't match so it can't be that either.


That string would be accepted by the FSM and fits the rule.
(edited 7 years ago)
Original post by Mav1
That string would be accepted by the FSM.


Yes, but it wouldn't be accepted by that regex.
Original post by TercioOfParma
Well, you could go accbac and that doesn't match so it can't be that either.


a(ba|c)* means it can go
a ba c
a c ba
a c ba c
a ba c ba
etc, so accbac is accepted
Original post by cybernatural
a(ba|c)* means it can go
a ba c
a c ba
a c ba c
a ba c ba
etc, so accbac is accepted


Are you sure? I think that just means ababa or acc. I don't know for certain honestly, I know I got it wrong regardless

Edit: Just checked yeah that works.
Original post by TercioOfParma
Yes, but it wouldn't be accepted by that regex.


It would be, I think the confusion arises as you might not understand (ba|c)*. This does NOT mean choose ba or c then repeat that. It mean many choices of ba or c.
Does anybody remember the diagram for the regex in the last question? I just wrote ac* - I think I may have missed a b that returns to the first state.

Some areas which caused my class confusion:

For the SQL query question, you only needed the data described in the question, so the customer table was not needed. To get the correct price, you needed to compare the weight in the parcel to the min and max values in the price bands. No clue whether it should be ascending or descending - the question asked for the oldest date "at the top of the list" but I don't if top to bottom or bottom to top is "ascending".

For the DeleteItem procedure (pseudocode in the linked list question), you need to take into account if the first item in the list was the item to be deleted. Then you cannot change Previous and instead set Start = Current.Next. I also took into account if the item was the last in the list, so you would have to set Previous.Next to a null pointer, but I'm not sure if that would be required.
(edited 7 years ago)
Original post by Bunderwump

For the DeleteItem procedure (pseudocode in the linked list question), you need to take into account if the first item in the list was the item to be deleted. Then you cannot change Previous and instead set Start = Current. I also took into account if the item was the last in the list, so you would have to set Previous.Next to a null pointer, but I'm not sure if that would be required.


I thought you had to delete the item that had the value supplied as the parameter.
Original post by RedRum99
I thought it was just ac*


Thats what I did.
Original post by TercioOfParma
I thought you had to delete the item that had the value supplied as the parameter.


You're right, there's a mistake in my explanation. You set Start = Current.Next if Current is the first in the list.
Original post by Bunderwump
You're right, there's a mistake in my explanation. You set Start = Current.Next if Current is the first in the list.


I didn't use start at all in the loop, I set current and previous to start (to avoid null pointer issues) and simply assigned current to current.next and previous to current afterwards.
[video="youtube;P6PjYbyzldU"]https://www.youtube.com/watch?v=P6PjYbyzldU[/video]

We had to have one of these.
Original post by TercioOfParma
I didn't use start at all in the loop, I set current and previous to start (to avoid null pointer issues) and simply assigned current to current.next and previous to current afterwards.


That's right (you don't have to set previous to start depending on how you coded it afterwards) but if the element you need to delete is the first in the list, then you need to change the value of Start to the new start of the list (which would be Start.Next or Current.Next) - otherwise Start will be a null pointer after the procedure has finished.

Quick Reply

Latest

Trending

Trending