No, that's not how the match works. Let's look at your first scenario
Alice - W, X, Y, Z
Bob - Z, Y, -, -
Caroline - Y, Z, -, -
All have 2 slots:
W - doesn't rank any of them (or low)
X - Doesn't rank any of them (or low)
y - Bob, Alice, Caroline
Z - Alice, Bob, Caroline
The match will first try to place alice at W and X which doesn't happen, so will prelim place her in Y.
Bob will be placed in Z
Caroline will be placed in Y
... and we will be done.
I'm going to guess that you have a typo in your scenario, and there's only one position per program. In that case, all else being the same:
Alice gets prelim placed in Y
Bob gets Prelim placed in Z
Caroline wants Y also. Looking at Y's list, they want Alice more than Caroline, so Caroline does not get Y
Next Caroline wants Z. Z wants Bob more than Caroline, so Caroline does not get Z
So Caroline will get one of her other programs, or maybe not match at all.
Final result is Alice in Y and Bob in Z.
Let's say the applicants are processed in the reverse order, again 1 slot per program:
Caroline is prelim placed in Y
Bob is prelim placed in Z
Alice can't go to X or W. So next we try to place her in Y. She is ranked above Caroline, so she is placed in Y and Caroline is bumped out.
We try to place Caroline in Z, but Bob is already there and ranked above Caroline. So not an option.
Same result. Alice Y, Bob Z, Caroline something else.
You're welcome to explain why you think Alice will match at Z in your first scenario.