In many languages, what is the primary purpose of "declaring" a variable?
A.
To delete it from the computer's memory
B.
To tell the computer the name and type of data the variable will hold
C.
To display the value of the variable on the screen
D.
To perform a mathematical calculation
Which of the following is a valid variable name in most programming languages?
A.
2nd_place
B.
user-name
C.
total_amount
D.
class
Which of the following best describes a "constant"?
A.
A value that can be updated any time during program execution.
B.
A named memory location whose value cannot be changed once assigned.
C.
A type of variable that only stores text.
D.
A reserved word used to define a new function
What happens if you try to reassign a value to a constant after its initial assignment?
A.
The program will automatically create a new variable.
B.
The value will change without any issues.
C.
The program will ignore the new value.
D.
The compiler or interpreter will likely throw an error.
Which of the following data types will be appropriate to store the age of students?
A.
float
B.
double
C.
int
D.
char
Which of the following data types will be appropriate to store the salary of workers?
A.
double
B.
char
C.
bool
D.
int
A programmer wishes to use M for male and F for female. Which of the following data types will be appropriate to use?
A.
char
B.
int
C.
double
D.
float