View this PageEdit this Page (locked)Attachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Spring 2004 Quiz 1

Recalling that all computations in Squeak are defined as a series of messages sent to objects, explain each of the following statements. In each case, list the messages sent in the order that they are sent and provide the information about each message requested in the table. Don't forget that the result of one message can be used as the receiving object of a subsequent message.

(1) Transcript show: (3+5) printString

Receiving objectMessageArguments (if any)Result
3+58
8printString'8'
Transcriptshow:'8''8' written on transcript

something to note here:

(2) 1 to: 10 do: [:index|myCollection at: index put: index+3*(1-index)abs]

solutions are formated in the following way: general answer (specific answer for the message sequence for the first execution). either the general or specific answer was ok, you didn't need both.

Receiving objectMessageArguments (if any)Result
1to:do:10, [...][...] executed 10 times
index (1)+3index+3 (4)
1-index (1)1-index (0)
1-index (0)absabsolute value of 1-index (0)
result of step2 (4)*result of step4 (0)product of results from steps 2 and 4 (0)
myCollectionat:put:index, result from step5 (1, 0)store result from step 5 in index of myCollection (store 0 in myCollection at index 1)

some things to note here:

Link to this Page