WGU C173 / D278 STUDY QUESTIONS AND
ANSWERS BY COMPETENCY
What is a variable?
A named something, such as x that holds a value
How to store a value to a variable
The assignment statement sets a variable with a value. (x = 0)
What is an expression in programming?
A number, variable (x), or simple calculation (numApples + 1)
What is an identifier?
A name given to a variable or function.
What is a valid identifier?
An identifier shall begin with a letter and shall be a sequence of letters,
underscores, and digits.
What is a literal?
any number, text, or other information that directly represents a value.
What is an operator?
a symbol that performs a built-in calculation. (+, -, *, /)
, What precedence rules does programming use?
PEMDAS
How does an integer differ from a float?
Integers are whole numbers and used for counted values.
Floats allow the decimal point to appear anywhere in the number and are used
for values that are measured or fractions.
What happens if you divide two integers? you will get an integer or the answer
will be cut short
what happens if you divide an integer and float? It returns a float
What happens if you divide a nonzero floating point number by zero? In coral -
infinity or infinity. Otherwise not a number.
How would you change the type of an item?
By using a type conversion.
What does the % operator do?
It returns the remainder from dividing two integer operands.
ANSWERS BY COMPETENCY
What is a variable?
A named something, such as x that holds a value
How to store a value to a variable
The assignment statement sets a variable with a value. (x = 0)
What is an expression in programming?
A number, variable (x), or simple calculation (numApples + 1)
What is an identifier?
A name given to a variable or function.
What is a valid identifier?
An identifier shall begin with a letter and shall be a sequence of letters,
underscores, and digits.
What is a literal?
any number, text, or other information that directly represents a value.
What is an operator?
a symbol that performs a built-in calculation. (+, -, *, /)
, What precedence rules does programming use?
PEMDAS
How does an integer differ from a float?
Integers are whole numbers and used for counted values.
Floats allow the decimal point to appear anywhere in the number and are used
for values that are measured or fractions.
What happens if you divide two integers? you will get an integer or the answer
will be cut short
what happens if you divide an integer and float? It returns a float
What happens if you divide a nonzero floating point number by zero? In coral -
infinity or infinity. Otherwise not a number.
How would you change the type of an item?
By using a type conversion.
What does the % operator do?
It returns the remainder from dividing two integer operands.