62.8k views
3 votes
When a subroutine is called

a) it defines a new locality
b) it is in the same locality from where it was called
c) it does not define a new locality
d) b and c

User Harmelodic
by
8.6k points

1 Answer

3 votes

Final answer:

A subroutine defines a new locality, meaning it has a local scope with its own variables, providing modularity and encapsulation in a program.

Step-by-step explanation:

When a subroutine is called, it defines a new locality. This means that the subroutine has its own scope and set of variables that do not interfere with variables in other areas of the program. In programming, this locality is often referred to as a 'local scope' or 'function scope', where variables declared within a function are not accessible from outside of that function. This concept is crucial in modular programming as it allows for the creation of reusable and independent code blocks.

User Greensuisse
by
8.9k points