I'm doing a 2 hour ComSci exam tomorrow! Tips/tricks?
4 replies, posted
I'm doing a scholarship exam for the university I want to go to. I don't need to do it, having already got an offer, but if I pass & get a distinction, I get an unconditional offer to the university, and £1200 off my student fees every year.
Anyway. It's a (for me) pretty piss-easy exam. [url=http://www.aber.ac.uk/en/media/compsci.pdf]Looking at all the past papers[/url], the questions are things like:
[QUOTE]Write an algorithm in clear pseudo code, that describes how you might find and delete a DVD's information from a list of DVDs that is to remain sorted alphabetically by title. [15 marks][/QUOTE]
And:
[QUOTE]Explain your understanding of the following terms:
(i) Bit [2 marks]
(ii) ROM [2 marks]
(iii) Byte [2 marks]
(iv) CPU [2 marks][/QUOTE]
Since I've been coding shit since I was twelve the pseudocode question is easy as hell. Well, it looks like it should be. I'm thinking it should be like this:
[code]function removeFromList(list, title):
for each DVD in *list: // an asterisk denotes that the variable is a function argument
if DVD title is identical to *title, then:
remove current DVD entry from list
break loop
else:
continue 'for' loop
endif
end
end[/code]
Because, well, it says the list needs to remain sorted alphabetically, but if you remove something from the list it's not going to lose alphabetic ordering, right? Or is there more to it - are they looking for me to describe a sorting algorithm in pseudocode, or what? It just worries me that such an easy example is worth 15 marks.
Apart from that it is really, really easy. The most difficult question I've seen so far was one that wanted me to convert an int to a) binary and b) hexadecimal.
Wondering if anyone else has done ComSci exams like this - not yet degree level, but higher than college (the UK version of college, I mean 'A Level') level. They give no mark scheme, just say they're looking for "flair" in answers... so I guess I get to show everything I've learnt in the past 5 years :v: ...as long as I've not got it wrong, which is what I'm worried about.
They might mark you on the efficiency of the algorithm. For example, a [url=http://en.wikipedia.org/wiki/Binary_search_algorithm]Binary Search[/url] would be a quicker way to find the DVD's position if the list remains sorted.
Edit: What uni is this by the way?
[QUOTE=Vampired;20008658]They might mark you on the efficiency of the algorithm. For example, a [url=http://en.wikipedia.org/wiki/Binary_search_algorithm]Binary Search[/url] would be a quicker way to find the DVD's position if the list remains sorted.
Edit: What uni is this by the way?[/QUOTE]
Aberystwyth University, Wales. Not renowned for its computer science degrees, but it has a really cool Robotics & AI course and lots of equipment for it, and they're really lax about entry requirements (they don't need physics or maths to do the courses). Plus it's by the sea and is epic for parties, apparently :v:
Edit: And thanks for the binary search tip, I didn't really think about how I could optimize the actual loop.
[QUOTE=TehDoomCat;20008909]Aberystwyth University, Wales. Not renowned for its computer science degrees, but it has a really cool Robotics & AI course and lots of equipment for it, and they're really lax about entry requirements (they don't need physics or maths to do the courses). Plus it's by the sea and is epic for parties, apparently :v:
Edit: And thanks for the binary search tip, I didn't really think about how I could optimize the actual loop.[/QUOTE]
Sounds good. I have a few interviews during this month at universities I know nothing about.
That's a really vague question for 15 pointers... based on those directions, verbatim, you could write:
[code]
function removeDVDFromList(dvd, list)
index = binarySearch(list, dvd)
if index is valid
removeFromList(list, index)
[/code]
[editline]04:52PM[/editline]
They probably want an actual algorithm implementation, like binary search. But even then its very vague, since binary search can be written like this:
[code]
function binarySearch(list, item)
index = lowerBound(list, item)
if index is valid and list[index] is not greater than item
return index
else
return nil
[/code]
Notice how I wrote a binary search algorithm entirely based on the lower bound algorithm... if I had to write it without utilizing anything else, it would be:
[code]
function binarySearch(list, item, left=0, right=list.size - 1)
if left > right
return nil
mid = (left + right) / 2
if list[mid] equals item
return mid
else if list[mid] < item
return binarySearch(list, item, mid + 1, right)
else
return binarySearch(list, item, 0, mid - 1)
[/code]
Sorry, you need to Log In to post a reply to this thread.