This post originated from an RSS feed registered with Agile Buzz
by James Robertson.
Original Post: What's unexpected?
Feed Title: David Buck - Blog
Feed URL: http://www.cincomsmalltalk.com/rssBlog/buck-rss.xml
Feed Description: Smalltalk can do that
Which mathematical operator can generate unexpected results when used with integer numbers?
a) Addition (+)
b) Decrement (--)
c) Modulus (%)
d) Division (/)
e) Multiplication (*)
The answer they want is d) because 10 / 3 produces 3 which some people find unexpected. For me, this is perfectly expected based on knowledge of integer arithmetic. I would tend to answer a), b), and e) because of integer overflow problems. The point is, it's only unexpected if you don't understand. What a strange question.