1. Re: Quiz
- Posted by Jeff Zeitlin <jzeitlin at CYBURBAN.COM>
Oct 21, 1998
-
Last edited Oct 22, 1998
On Wed, 21 Oct 1998 00:05:46 -0400, "Carl R. White"
<C.R.White at SCM.BRAD.AC.UK> wrote:
>Quiz Time (for everyone not just Matt :) )
>---------
>* Use EX.EXE *after* you've got answers. No cheating!
>i) Give the semantic difference between the following two subroutines.
reverse() only reverses the top level of the parameter sequence.
r_reverse() will reverse any sub-sequences, recursively, as well.
>ii) Give the contents of X and Y at the end of the program.
X =3D {4,6,2,6,{3,2,{3,8},4},9,7,9,{1,5,9,2,{6,5},3,5,8},4,1,3}
Y =3D {4,6,2,6,{4,{8,3},2,3},9,7,9,{8,5,3,{5,6},2,9,5,1},4,1,3}
>iii) Which function is more correct? (In your opinion) Discuss.
> [I hate "Discuss" questions >:^> ]
Neither one is "more correct"; it would depend on the particular
need for the program. I believe that most people, looking at the
question superficially, would consider r_reverse() to be "more
correct", as there is a tendency to "flatten" nested structures
like this, and r_reverse() conforms more to the "natural
expectation". Of course, being a programmer, with a programmer's
thought habits, I could be totally wrong about normal people's
thought habits...
>iv) BONUS question. Where have I got the "Start" numbers from? :)
The first 24 digits of pi, including the "3" before the decimal
point. Do you actually have it memorized that far?
--
Jeff Zeitlin
jzeitlin at cyburban.com