How is a named constant different from a variable? How would you create a named constant (and show an example)?
What will be an ideal response?
By definition, a variable's value can vary, or change. Sometimes you want to create a named constant (often simply called a constant), an identifier whose contents cannot change. You create a named constant similar to the way you create a named variable, but by using the keyword const. Although there is no requirement to do so, programmers usually name constants using all uppercase letters, inserting underscores for readability. This convention makes constant names stand out so that the reader is less likely to confuse them with changeable variable names. For example, the following declares a constant named TAX_RATE that is assigned a value of 0.06:
const double TAX_RATE = 0.06;
You might also like to view...
You must respect the author's intellectual property rights when using materials from the Web.
Answer the following statement true (T) or false (F)
Cable modems typically offer a dedicated pipe from the customer premises to the Internet.
a. True b. False
The Web analytic that measures visitor satisfaction with a site is ____.
A. unique visitors B. page views C. click-stream analysis D. repeat visitors
Modifying algorithms that change the order of the elements, not their values, are also called ____.
A. polymorphic algorithms B. associative algorithms C. compensating algorithms D. mutating algorithms