**Challenge Yourself**
Ejercicios tomados del libro:
[Challenge yourself](learning-oop/2018-04-01-LearningOOP.pdf)
**4.1 Challenge: Message identification**
For each of the expressions below, fill in the answers:
• Whatis the receiver object?
• Whatis the message selector?
• Whatis/are the argument (s)?
• Whatis the result returned by this expression execution?
* receiver: 3
* selector: +
* arguments: 4
* result: 7
* receiver: Date
* Selector: Year - Month - Day
* Arguments: Today
* Results: 2025-04-23
* Reciever: Hello
* Selector: Word
* Arguments: 1
* Result: Hello Word
* Receiver: 1
* Selector: 22
* Arguments: 333
*Result: 22
* Receiver: 2
* Selector: 33
* Arguments: 67
* Result: 2 33 4 67
* Receiver: 25
* Selector: @
* Arguments: 50
* Result: 25 y 50
* Receiver: Small
* Selector: Integer
* Arguments: maxval
* Result: 1152921504606846975
* receiver: abcdef
* selector: cinludesall
* arguments: fdb
* result: true
* receiver: True
* selector: |
*arguments: false
* result: True
* receiver: Point
* selector:
*arguments: Selectors
* result: 120 items
**4.2 Challenge: Literal objects**
What kind of object does the following literal expressions refer to? It is the same as asking what is the result of sending the class message to such expressions.
* 1.3
* node1
* (2 33 4)
* 'Hello, Dave'
* [ :each | each scale: 1.5 ]
* A
* true
* 1
**4.3 Challenge: Kind of messages**
Examine the following messages and report if the message is unary, binary or keyword-based.
* unary
* Keyword-based
* binary
* Keyword-based
* binary
* unary
* Keyword-based
**4.4 Challenge: Results**
Examine the following expressions. What is the value returned by the execution of the following expressions?
* -2
* -2
* 32
* Second
* (4 9 100 9)
*5
* -32
* true
**4.5 Challenge: unneeded parentheses**
Putting more parentheses than necessary is a good way to get started. Such practice however leads to less readable expressions. Rewrite the following expressions using the least number of parentheses.
* x between: (pt1 x) and: (pt2 y)
* #(a b c d e f asSet) intersection: #(f d b asSet)
* En caso de esta operación da un error en la segunda **x**
* 1 = 56 2 = 33
* 3 + 4 + (2 * 2) + (2 * 3)