Worksheets321-Quiz-08 - Names/Binding/Scope
Total questions: 11
Worksheet time: 8mins
Binding is
an association between a variable and its type value
is an association between an operation and a symbol
can be static or dynamic
is another way to link programs together
The type of a variable
determines the range of values the variable can store
determines the operations defined for values of the type
only matters for integer types
does not exists in machine language
Can be used to catch some errors early
The scope of a variable is
the range of statements where it is visible
how often it is referenced in a program
how much memory it uses
the number of programs it appears in
A referencing environment
defines the set of statements visible to the variables of the statement
applies only the local variables visible to the statement
defines the set of statements which can validly reference a name
for a name is its defining scope and all nested subscopes
Output in a a language that uses Dynamic Scoping :
30
20
10
30
10
2010
1010
10
20
30
Output in a a language that uses Static Scoping :
30
20
10
30
10
2010
1010
10
20
30
A symbol table is a data structure kept by a translator that allows it to keep track of each declared name and its binding.
true
false
Which of the following are in the group called basic bindings
name
type
location
lifetime
scope
In _______ scopes, same name can be bound to different entities without interference.
nested
disjoint
static
dynamic
Some languages have a construct that allows access to an entity that currently is not visible because its name has been used in an inner scope. What is this construct/feature called?
golden accessor
fish
universal scope accessor
scope resolution operator
scope accessor
What language allows you to redefine or overload most of the built-in operators, by using the keyword "operator" followed by the symbol for the operator being defined available. Such that we can have:
Color operator+(const Color&, const Color&);
...
Color c1=new Color(red);
Color c2=new Color(Yellow),;
Color c3 = c1 + c2;
Ada
Babbage
C#
C++
Python
