How to calculate the training accuracy of a decision tree?

The hint given was to construct a confusion matrix.

A decision tree assigns one prediction (in your case "Yes" or "No") to each leaf-node (in your case this would be Nodes 2, 4, 7, 8). Each sample is then mapped to exactly one leaf node and the prediction of that node is used.

Example. A 35 year old male with 10 (year?) of education would be mapped to leaf-node 7. Node 7 is trained with 23 cases of "No" and 9 cases of "Yes", so it will predict "No" (which appear more often in the training data).

If you now look at the training data, you can count for each node, how often which combination of prediction and actual outcome would appear.

Example. For node 7, we always have the prediction "No", this leads to:

Predict "No" Predict "Yes"
Actual "No" 23 0
Actual "Yes" 9 0

You can do this for all leafs, sum them up and get a total confusion matrix of the training data. Then count the number of correct predictions divided by the total number of samples to compute the accuracy.