Answer:
The correct option is option 3.
Step-by-step explanation:
The public variable is accessible to all the classes
A private variable is accessible to only the class in which it is defined
A protected variable is accessible in the defining and derived classes
Now as the class A2 is under consideration, so the two variables which are defined in A2 are both accessible by A2 which are the protected int a and the private int b.
Now for the other variables, public int x is accessible to all the classes as it is a public variable.
Private int y is defined in class A1 so it is not accessible to class A2.
Protected int z is defined in class A1 but A2 is derived from A1 thus this is also accessible by A2.
Private int q is defined in class A3 so it is not accessible to class A2.
Thus a,b,x and z are the four variables accessible by the class A2 sso option 3 is the correct option.