Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

321-Quiz-08 - Names/Binding/Scope

Total questions: 11

Worksheet time: 8mins

Name
Class
Date
1.

Binding is

a)

an association between a variable and its type value

b)

is an association between an operation and a symbol

c)

can be static or dynamic

d)

is another way to link programs together

2.

The type of a variable

a)

determines the range of values the variable can store

b)

determines the operations defined for values of the type

c)

only matters for integer types

d)

does not exists in machine language

e)

Can be used to catch some errors early

3.

The scope of a variable is

a)

the range of statements where it is visible

b)

how often it is referenced in a program

c)

how much memory it uses

d)

the number of programs it appears in

4.

A referencing environment

a)

defines the set of statements visible to the variables of the statement

b)

applies only the local variables visible to the statement

c)

defines the set of statements which can validly reference a name

d)

for a name is its defining scope and all nested subscopes

5.

Output in a a language that uses Dynamic Scoping :

a)

30
20
10

b)

30

10

20

c)

10

10
10

d)

10
20
30

6.

Output in a a language that uses Static Scoping :

a)

30
20
10

b)

30

10

20

c)

10

10
10

d)

10
20
30

7.

A symbol table is a data structure kept by a translator that allows it to keep track of each declared name and its binding.

a)

true

b)

false

8.

Which of the following are in the group called basic bindings

a)

name

b)

type

c)

location

d)

lifetime

e)

scope

9.

In _______ scopes, same name can be bound to different entities without interference.

a)

nested

b)

disjoint

c)

static

d)

dynamic

10.

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?

a)

golden accessor

b)

fish

c)

universal scope accessor

d)

scope resolution operator

e)

scope accessor

11.

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;

a)

Ada

b)

Babbage

c)

C#

d)

C++

e)

Python