March 19, 2024

Smalltalk Exercises - Precedence

 

Clicking on the A graphic will go to the answer.

Question 1
What object is returned after the following expression series is evaluated in a Workspace?
What is the textual representation of the message answer?

10 - (17 - 10)plus: 10

Link to answer for Q1

 

Question 2
What answer is returned after the following expression series is evaluated in a Workspace?
You can assume that aFrog and aToad are initialised instances.
What then is the position of aToad?
What is the textual representation of the message answer?

aToad position: aFrog position + 3 * 2 -  aToad position

Link to answer for Q2

 

Question 3
What answer is returned after the following expression series is evaluated in a Workspace? What then is the balance of myAccount?
You can assume that myAccount references an instance of Account and has its instance variable balance set to 500.

myAccount balance: (myAccount balance) - 100 / 2 * 5

Link to answer for Q3

 

Back to « Precedence

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Up to top of page