<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.kram.nz/index.php?action=history&amp;feed=atom&amp;title=SE250%3AApril_24%3ATest</id>
	<title>SE250:April 24:Test - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.kram.nz/index.php?action=history&amp;feed=atom&amp;title=SE250%3AApril_24%3ATest"/>
	<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:April_24:Test&amp;action=history"/>
	<updated>2026-04-28T10:51:36Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.kram.nz/index.php?title=SE250:April_24:Test&amp;diff=1757&amp;oldid=prev</id>
		<title>Mark: 8 revision(s)</title>
		<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:April_24:Test&amp;diff=1757&amp;oldid=prev"/>
		<updated>2008-11-03T05:08:39Z</updated>

		<summary type="html">&lt;p&gt;8 revision(s)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Question One ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== 1a ===&lt;br /&gt;
&lt;br /&gt;
*Answer required a piece of code with a loop with at least 10,000 iterations&lt;br /&gt;
*A million iterations was a good number for sensible results&lt;br /&gt;
*Answer need to explain how to interpret the output as well as how to get results&lt;br /&gt;
**e.g. Comment out bits of code, run the loop several times, etc.&lt;br /&gt;
&lt;br /&gt;
=== 1b ===&lt;br /&gt;
&lt;br /&gt;
*While the hypothesis sounds reasonable, they were all false under certain circumstances&lt;br /&gt;
**Just stating &amp;quot;fa;se&amp;quot; without qualification was not sufficient as they were generally true&lt;br /&gt;
*Need to reference the lab results in explanation&lt;br /&gt;
&lt;br /&gt;
=== 1c ===&lt;br /&gt;
&lt;br /&gt;
*Answer should include idea that it is not possible to get an accurate measure for runtime by breaking a programme down to its constituents - performance measurement is not reductive&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Question Two ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== 2a ===&lt;br /&gt;
*Answer was&lt;br /&gt;
 1	4&lt;br /&gt;
 4	4&lt;br /&gt;
 4	4&lt;br /&gt;
 5	8&lt;br /&gt;
*However it should be noted that the second part of the answer may vary with compiler&lt;br /&gt;
&lt;br /&gt;
=== 2b ===&lt;br /&gt;
*Generally well done&lt;br /&gt;
*Ambiguous statement for allocating memory was not accepted&lt;br /&gt;
**i.e. cannot use &amp;quot;int x = 0&amp;quot; for everything, need to be specific about their differences&lt;br /&gt;
&lt;br /&gt;
=== 2c ===&lt;br /&gt;
*Part a) requires understanding to be shown about memory for stack being reused resulting in garble&lt;br /&gt;
*Common errors include&lt;br /&gt;
**Claims to char* not being returned (it was)&lt;br /&gt;
**s not being initialised (it was)&lt;br /&gt;
*Two possible solution to part b)&lt;br /&gt;
**Allocate memory to s with malloc - however this may result in memory leaks in the programme as it is not obvious who should be responsible for freeing the memory after it is used&lt;br /&gt;
**Making string a static variable - however, every time the function is called the previous value of s will be overwritten&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Question Three ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== 3a ===&lt;br /&gt;
*Parameters include&lt;br /&gt;
**Initial capacity&lt;br /&gt;
**Growth factor&lt;br /&gt;
*Resizing factor has the greatest effect on performance&lt;br /&gt;
*This was well justified&lt;br /&gt;
&lt;br /&gt;
=== 3b ===&lt;br /&gt;
*Growth factors around 10 was not accepted as they were too big&lt;br /&gt;
*Diminishing returns could be seen in performance graph&lt;br /&gt;
**i.e. Going from 4 to infinity has a smaller gain than going from 1.5 to 2&lt;br /&gt;
*No strong case can be made for growth factors greater than 4&lt;br /&gt;
*Model answer would be 1.5ish up to 4&lt;br /&gt;
*The shape of the graph is linear with growth factor being inversely proportional to the slope, but with diminishing returns&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== 3c ===&lt;br /&gt;
*People either had this question completely right or wrong - no middle grounds&lt;br /&gt;
*The code returns the address in memory of the function interpreted as an integer&lt;br /&gt;
**Not the number of elements in the list&lt;br /&gt;
*It was suggested that if people needed convincing, they could write the code themselves&lt;br /&gt;
*In order to get the number of elements in the list, the call needs to be&lt;br /&gt;
 arraylist_size(AL); //where AL is the array list&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Question Four ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== 4a ===&lt;br /&gt;
*Diagram was generally well done&lt;br /&gt;
*Need to show the self reference of the nil cell in order to get full marks&lt;br /&gt;
*Common mistake including making a new chain for ys instead of using the existing cells in xs&lt;br /&gt;
&lt;br /&gt;
=== 4b ===&lt;br /&gt;
*Fairly well done as most has seen a shorter version of this code&lt;br /&gt;
*Common mistake was using the code&lt;br /&gt;
 Cons* zero_one = cons( 0, cons( 1, zero_one ) );&lt;br /&gt;
*However, in the above code zero_one is unintialised when called&lt;br /&gt;
*An additional step is needed&lt;br /&gt;
 zero_one-&amp;gt;tail-&amp;gt;tail = zero_one;&lt;br /&gt;
&lt;br /&gt;
=== 4c ===&lt;br /&gt;
*Reasonably well done&lt;br /&gt;
*Common errors include&lt;br /&gt;
**Not stepping ys&lt;br /&gt;
*Solution&lt;br /&gt;
 void sumlist( Cons* xs, Cons* ys ) {&lt;br /&gt;
 	for( ; xs != nil; xs = xs-&amp;gt;tail, ys = ys-&amp;gt;tail )&lt;br /&gt;
 		xs-&amp;gt;head += ys-&amp;gt;head;&lt;br /&gt;
 }&lt;br /&gt;
*Note that the check ys != nil is insignificant &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Question Five ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== 5a ===&lt;br /&gt;
*The question was somewhat ambiguous as theory vs practise could either be considered as statistic vs results or low entropy vs high entropy&lt;br /&gt;
**People are welcome to bring script to John for remark - at the risk of being marked down&lt;br /&gt;
*Answer required justification&lt;br /&gt;
**e.g. each statistic test result for buzhash points to random&lt;br /&gt;
*Rand was not accepted as an answer&lt;br /&gt;
**This is not an actual hash function&lt;br /&gt;
*Two possible solutions for best performing hash function in practise&lt;br /&gt;
**Buzhash for being closest to expected value&lt;br /&gt;
**Java Int for having shortest chains&lt;br /&gt;
&lt;br /&gt;
=== 5b ===&lt;br /&gt;
*H1 can be disproved by either Java Str or Java Int - both of which are superior in practise but poor in theory&lt;br /&gt;
*H2 can be disproved by Java Str - which performed better with a low entropy source&lt;br /&gt;
*A handful of people pulled examples supporting the hypothesis&lt;br /&gt;
&lt;br /&gt;
=== 5c ===&lt;br /&gt;
*Most had the answer right (&amp;quot;no&amp;quot;) but provided no explanation&lt;br /&gt;
*Explanation could include&lt;br /&gt;
**Hashing even numbers will result in half the table being empty&lt;br /&gt;
**The function is &amp;quot;fragile&amp;quot; and will &amp;quot;[go] to custard&amp;quot; with certain kinds of data&lt;/div&gt;</summary>
		<author><name>Mark</name></author>
	</entry>
</feed>