CompTIA ITF+ (FC0-U71) — Question 26
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?
Answer options
- A. Object
- B. Function
- C. Constant
- D. Array
Correct answer: C
Explanation
The correct answer is C, Constant, because the pay rate does not change and should remain fixed throughout the calculations. Options A (Object) and D (Array) are not suitable since they are used for collections or data structures, while B (Function) is incorrect as it implies a process rather than a fixed value.