Complete the following table by specifying the scope of each declaration I'm having a hard time understanding this question. Can each declaration have more than one scope or can a declaration have more than one scope?



If it's the later it would be:


Declaration              Scope
int a = 1;               B1  
int b = 1;               B1
int b = 2;               B2
int a = 3;               B3
int b = 4;               B4


Or can it have more than one scope:


Declaration              Scope
int a = 1;               B1, B2, B4  
int b = 1;               B1
int b = 2;               B2, B3
int a = 3;               B3
int b = 4;               B4


I'm sorry if this is a simple question. I just want to make sure what I'm doing is correct.

Thanks.
Your first answer is good (assuming the scope to assign is in order as declarations go).
Each declaration is in the scope, where it is declared. In inner scope (say B2) variable $b$ is declared shadowing previous declaration. Now you cannot use outer scope variable (read, write) as is by name without scope resolution operator.

Your second table suggests that variables are available in given scopes (say B1, B2, B4), and you have taken into account shadowing, so it still looks good, but technically it is accessible and not shadowed in that scope, not declared in that scope.