Ch2. Data Types (zybooks) Flashcards
what is a variable ?
variable= named item that is used to hold a value.
assignment statement?
assignment statement: is when a variable is assigned a value. this is done through a statement.
what is the format of an assignment? hint: statements and variables
the left side of a statement assignment must be a variable while the right side can be an expression. so…
x = (y+5) X is the variable while (y+5) is the expression.
what does
mean in programming ? how does it work
=
not equals but instead equals is used to assign a value from the right side to a left side variable.
so… x = 5 means x is assigned 5.
what is an incrementing variable and how does it work.
increment variable: when a variable is assigned itself plus one. for example: x = x + 1
variable declaration?
statement that declares a new variable -type and name.
what is an assignment statement?
assignment statement:
what is an assignment statement?
assignment statement:
assigns a variable (left side of = ) with the value to the right of =
expression?
expression : a number, variable name or calculation
what does ‘int’ stand for in code?
int = integer or a number.
it tells the memory to allocate a space for the following object. this object holds a number/integer
can int variables (integer) hold a negative value?
yes, integer values can hold a negative value.
what is a reserve word or keyword?
reserve word/ keyword: a word that is part of the language (int, sort, double,) these words can not be used as an identifier.
how is an _ identified when used in an identifier?
_ is treated as a letter and can be the 1st “letter” in the identifier name.
are spaces allowed in an identifier name?
no, but _ can be used instead.
can an expression be a literal?
expression: evaluates to a value. a literal is a specific value. YES, an expression can be a series of operators (+ - ) with literals or variables or it can just be one literal.