I read a lot about it, but still not sure in what order states executes (in Composite States) and how exactly deep and shallow history works? Could anybody help me?
I have an example, which I'm not sure how to solve, here it is:

I would appreciate any help!
Question 1:
Answer 1:
Note this:
Question 2:
Answer 2:
Yes. You start from the Initial Pseudostate of the root state (A in this case).
Example:
For the given state-chart and event chain, you would get the following result (simulated with Rhapsody):
after default transition to A
x = 3x = x * 2 = 6after default transition to A::B
x = 6after e1
x = x + 1 = 7after default transition to A::C::G
x = x + 1 = 8after e3
x = x - 2 = 6x = x / 2 = 3after e4
x = x + 1 = 4after e6
x = x - 2 = 2x = x - 1 = 1x = x - 1 = 0x = (x * 4) + 2 = 2after e7
x = x + 1 = 3x = x + 1 = 4e4 is discarded