C173/D278 Study Questions WITH |\ |\ |\ |\
CORRECT ANSWERS |\
What is the purpose of a variable?
|\ |\ |\ |\ |\ |\
a named item like x, used to hold a value.
|\ |\ |\ |\ |\ |\ |\ |\ |\
How do you save a value to a variable?
|\ |\ |\ |\ |\ |\ |\ |\
An assignment statement assigns a variable with a value. (x = 0)
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
What is a programming expression?
|\ |\ |\ |\
A number, variable (x), or simple calculation (numApples + 1).
|\ |\ |\ |\ |\ |\ |\ |\ |\
What is an identifier?|\ |\ |\
A name created for a variable or a function.
|\ |\ |\ |\ |\ |\ |\ |\
What constitutes a valid identifier?
|\ |\ |\ |\
An identifier must start with a letter and 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 do you convert an item's type?
|\ |\ |\ |\ |\ |\
By using a type conversion.
|\ |\ |\ |\
What does the modulo operator do?
|\ |\ |\ |\ |\
evaluates to the remainder of the division of two integer operands.
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
What is the difference in a variable and a constant?
|\ |\ |\ |\ |\ |\ |\ |\ |\
A variable can change while a constant is a value that always stays the same.
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
How does an array work? |\ |\ |\ |\
It is a collection of data stored in an index together.
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
What does index reference? |\ |\ |\
The location where values are stored in an array.
|\ |\ |\ |\ |\ |\ |\ |\
How does a branch differ from a loop?
|\ |\ |\ |\ |\ |\ |\
In a branch is only executed under a certain condition (true, false). A loop
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
repeatedly executes as long as the loops decision expression evaluates to true
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
( i < numVals.size).
|\ |\ |\ |\
How does an if-else branch work?
|\ |\ |\ |\ |\
CORRECT ANSWERS |\
What is the purpose of a variable?
|\ |\ |\ |\ |\ |\
a named item like x, used to hold a value.
|\ |\ |\ |\ |\ |\ |\ |\ |\
How do you save a value to a variable?
|\ |\ |\ |\ |\ |\ |\ |\
An assignment statement assigns a variable with a value. (x = 0)
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
What is a programming expression?
|\ |\ |\ |\
A number, variable (x), or simple calculation (numApples + 1).
|\ |\ |\ |\ |\ |\ |\ |\ |\
What is an identifier?|\ |\ |\
A name created for a variable or a function.
|\ |\ |\ |\ |\ |\ |\ |\
What constitutes a valid identifier?
|\ |\ |\ |\
An identifier must start with a letter and 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 do you convert an item's type?
|\ |\ |\ |\ |\ |\
By using a type conversion.
|\ |\ |\ |\
What does the modulo operator do?
|\ |\ |\ |\ |\
evaluates to the remainder of the division of two integer operands.
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
What is the difference in a variable and a constant?
|\ |\ |\ |\ |\ |\ |\ |\ |\
A variable can change while a constant is a value that always stays the same.
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
How does an array work? |\ |\ |\ |\
It is a collection of data stored in an index together.
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\
What does index reference? |\ |\ |\
The location where values are stored in an array.
|\ |\ |\ |\ |\ |\ |\ |\
How does a branch differ from a loop?
|\ |\ |\ |\ |\ |\ |\
In a branch is only executed under a certain condition (true, false). A loop
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
repeatedly executes as long as the loops decision expression evaluates to true
|\ |\ |\ |\ |\ |\ |\ |\ |\ |\ |\
( i < numVals.size).
|\ |\ |\ |\
How does an if-else branch work?
|\ |\ |\ |\ |\