In general what is a scope in a programming language? For example, in C/C++ each function is a scope. The compiler uses a stack in processor for all variables in a function. Different stacks for different functions. So are scopes maintained on different stacks too?
The scopes are probably maintained by some kind of node tree, any variables created would be created in the "current scope" node. When trying to reference any variables, if the referenced variable is not found in the "current scope", it wouid traverse backward through the node tree trying to find that variable until it gets to the first tree, say node[0]. If it isn't found there, I imagine you would get a compilation error.
From an application programmer's point of view, the mechanism about how a scope is implemented, is not very important. It may / may not be on a stack; the underlying mechanism is irrelevant to an app programmer.
What _is_ important is whether a variable is visible or not ie: whether it is in scope or not, and that is as has been explained.
Stacks come into the picture when a function is being invoked, because the arguments are passed to the function on a stack. Therefore, each function call involves a different stack. Note that the stack really comes into the picture (for the app programmer) when the function is _called_ rather when it is _defined_.
Nonetheless, all program variables that are not objects are defined on the stack.
Objects (instances of classes) are defined on the heap.