What is the proper way to declare a student's grade point average throughout the term if this item is needed in several places in a program?
Correct Answer: A
Comprehensive and Detailed Explanation From Exact Extract:
A grade point average (GPA) is a numerical value that typically includes decimal places (e.g., 3.75).
According to foundational programming principles, it should be declared as a variable if it may change (e.g., as grades are updated) and as a floating-point type to accommodate decimals.
* Option A: "Variable float gpa." This is correct. GPA requires a floating-point type (float) to handle decimal values, and since it may change over the term, it should be a variable, not a constant. For example, in C: float gpa = 3.5;.
* Option B: "Constant float gpa." This is incorrect. A constant (const in C) cannot be modified after initialization, but GPA may change as new grades are added.
* Option C: "Variable int gpa." This is incorrect. An integer (int) cannot store decimal values, which are common in GPAs (e.g., 3.2).
* Option D: "Constant int gpa." This is incorrect. GPA requires a float for decimals and a variable for mutability, making both const and int unsuitable.
Certiport Scripting and Programming Foundations Study Guide (Section on Variables and Data Types).
C Programming Language Standard (ISO/IEC 9899:2011, Section on Floating Types).
W3Schools: "C Variables" (https://www.w3schools.com/c/c_variables.php).