Variables And Assignments Flashcards
What does = mean in programming?
It assigned a value, IT DOES NOT MEAN EQUALS
X = 5 assigns the value 5 to the variable x
What does a variable declaration do?
Declares a new variable, specifying the variables name and type.
What is a name for a variable or function?
Identifier
An identifier must:
Be a sequence of letters (a-z, A-Z), underscores, and digits
Start with a letter
what are reserved words? Give examples
Words that are part of the language
Integer, Get, Put
List of reserved words:
Get
Put
To
From
Input
Output
Integer
Float
Array
And
Or
Not
List of reserved function names:
RaiseToPower
SquareRoot
AbsoluteValue
RandomNumber
SeedRandomNumbers
What is an expression?
A combination of items, like variables, literals, operators, and parenthesis that evaluates to value and commonly used on the right side of an assignment statement.
X = 2 * (x + 1)
What is a literal?
A specific value in code, like ‘2’.
What is an operator?
A symbol that performs a built-in calculation, like ‘+’ which performs addition.
In programming, can multiplication be indicated like this: 2x
No, it must be indicated explicitly, 2 * x
In y = x + 1, what is the expression?
X + 1
What is a -minus known as in programming?
Unary minus
Are commas allowed in an integer general?
No
What is incremental dev?
Process of writing, compiling, and testing a small amount of code, then writing, compiling, and testing a small amount more, and so on.
WCT
What is a floating point number?
A real number, like 98.6, 0.0001 and refers to the decimal point being able to appear anywhere.
It is a data type that represents a real number with a fractional component.
What is a floating point literal?
A specific representation of a floating point number as written in a program or source code. It can be a decimal or exponential notation.
It is a specific representation of a value of this data type in a program or source code.
What may a floating point variable that holds the value 299792458.0 be printed as?
2.99792e+08
Floating point variables are used when dealing with _____________.
Fractions of countable items, such as the average number of cars per household, avg. distances, and avg. weights
By default most programming languages output at ___ digits after the decimal point.
5 (five)
Is this a valid function? Why or why not?
Y = SquareRoot (2.0, 8.0)
No, because SquareRoot () only accepts one argument.
If the growth rate of a tree is 5% per year, what is the float number the program computes?
1.05
What two arguments does RandomNumber () take?
LowValue and highValue
What type of number does RandomNumber () return?
A random integer in the range lowValue to highValue