Let me try to explain,
the general format of a switch statement is
expression here is anything that will evaluate to/will have a final value of an int. The final value of the expression will then be compared to the cases that follows the switch
Now, writing something like
int a = 1;
will make the variable a be evaluated, meaning the value of a will be fetched in memory and that value will be considered as the value of the expression.
If you write something like
the 1 there is a constant (it is an int literal) and the value of course of the expression when evaluated is the integer 1.
You can even write something like
switch (a * 2)
In this case, the value of the expression is 10.
Whatever is contained in the ( ) of the switch expression should have a final value of something that can be evaluated to an int.
The only reason why they give sample questions like that is to make it easy to evaluate the expression in the switch.
In practice, it is probably not being done.
Just remember that, you look at the expression, determine its value. It does not matter whether it is a constant or a variable. What matters is the final value of the expression.
I hope I did not add to your confusion.