I have some more questions,
(Q1) Based on what I found out on google and based on what I understand, mask is used for calculation. Example I am given 0xF7 and I want to toggle the third bit.
The 0xF7 is the mask.
The number that you wanted to use in toggling is the flags.
The final output is called mask. and we use
mask=mask^flags(since we want to use it for toggling)
Am I right?