Programming Fundamentals Flashcards
What is an INTEGER?
Whole numbers that can be positive or negative and includes 0.
Examples include -5, 0, and 7.
What is a REAL / FLOAT?
Numbers that have a decimal point, which can also be negative.
Examples include -1.8, 0.5, and 3.14.
What is a BOOLEAN?
A data type that can only take one of two values: TRUE or FALSE, YES or NO, 0 or 1.
Used in logical operations.
What does CHARACTER represent in programming?
A single letter, number or symbol, e.g. 6, Y, &.
It is often used to denote individual characters in strings.
What is a STRING?
A collection of characters used to represent text, e.g. ‘Mavis’, ‘C19$8’.
Strings can include spaces and punctuation.
Fill in the blank: A BOOLEAN can only take the values _______.
TRUE or FALSE
True or False: A FLOAT can only be a positive number.
False
FLOATs can be negative, such as -1.5.
What is casting?
Casting is used to change the data type.
e.g. You could change the integer 7 to string “7”.
What are arithmetic operators?
Arithmetic Operators take two values and perform a mathematical function on them.
e.g. 5 + 6.
What is exponentiation?
Exponentiation is used to raise a number to a power. In Python, the symbols ^ or ** are used.
e.g. 2 ** 3 = 2x2x2 = 8.
What does the Div operator do?
The Div operator returns the whole number part of a division. In Python, the symbol // is used.
e.g. 20 // 3 = 6.
What does the MOD operator do?
The MOD operator returns the remainder part of the division. In Python, the symbol % is used.
e.g. 20 % 3 = 2.
What is the Assignment Operator?
The Assignment Operator is used to allocate values to constants or variables.
What do Comparison Operators do?
Comparison Operators compare the expression on the left hand side with the expression on the right hand side and produce a Boolean value: True or False.
What is a Constant?
A Constant is assigned a data value that cannot be changed as the program runs.
Example: VAT = 0.2