Named constants are used because . . . . . . . .

Because they take up less space in memory
Because they make documentation and code modification easier
Because they can be easily accessed by procedures
Because they are easily declared

The correct answer is: B. Because they make documentation and code modification easier.

Named constants are used to give a name to a value that is used repeatedly in a program. This makes the code easier to read and understand, and it also makes it easier to modify the code later on. For example, if you have a program that calculates the area of a circle, you could use a named constant for the value of pi. This would make the code look like this:

def area_of_circle(radius):
return pi * radius ** 2

This is much easier to read and understand than if you had used the actual value of pi in the code. It is also easier to modify the code later on. For example, if you decide to use a different value for pi, you can simply change the value of the named constant.

The other options are incorrect for the following reasons:

  • Option A is incorrect because named constants do not take up less space in memory than literal values.
  • Option C is incorrect because named constants are not necessarily easily accessed by procedures. It depends on how the named constant is declared.
  • Option D is incorrect because named constants are not necessarily easy to declare. It depends on the programming language.
Exit mobile version