FC0-U71 · Question #90
A user is writing code to calculate the amount of pay for each worker at a company. The pay rate is the same for all workers. The code will use the formula amount_of_pay = nunber_of_hours * pay_rate W
The correct answer is C. Constant. A constant is a named value that does not change during program execution. Since the pay rate is the same for all workers and does not vary, it should be declared as a constant rather than a variable. This prevents accidental modification, improves code readability, and signals t
Question
A user is writing code to calculate the amount of pay for each worker at a company. The pay rate is the same for all workers. The code will use the formula amount_of_pay = nunber_of_hours * pay_rate Which of the following should be used in the code to represent pay_rate?
Options
- AObject
- BFunction
- CConstant
- DArray
How the community answered
(53 responses)- A2% (1)
- B2% (1)
- C91% (48)
- D6% (3)
Explanation
A constant is a named value that does not change during program execution. Since the pay rate is the same for all workers and does not vary, it should be declared as a constant rather than a variable. This prevents accidental modification, improves code readability, and signals to other developers that the value is intentionally fixed. An object or array would be overly complex for a single fixed value, and a function is used to perform actions, not store a static value.
Topics
Community Discussion
No community discussion yet for this question.