2.2 Programming Fundamentals Flashcards
Define integer
Whole numbers. The integer can be positive or negative and include zero.
Define real/ float
Numbers that have a decimal point. Again – a real number can be negative e.g. -1.8
Define Boolean
Can only take one of two values: true or false, yes or no, 0 or 1
Define character
A single letter, number or symbol, e.g. six, Y, &
Define string
Are used to represent text. It is a collection of characters, e.g. hello
Define casting
Casting is used to change the date type e.g. you can change the integer 7 to string “7”
Define arithmetic operators
Arithmetic operators, take two values and perform a mathematical function on them e.g 5 + 6
Define exponentiation
Exponentiation is used to raise a number to a power. In python the symbols ^ or ** is used
Define DIV
The DIV operator returns the whole number part of a division. In python the symbol // is used e.g 20 // 3 = 6
Define MOD
The MOD operator returns the remainder part of the division. In python the symbol % is used, e.g. 20 % 3 = 2
Define assignment
The assignment operator is used to allocate values to constants or variables.
Define comparison operators
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
Define constant
A constant is assigned a data value that cannot be changed as the program runs. E.g. VAT = 0.2. This can then be used in calculations cost = price*VAT
Define variable
The variable is the location of memory that holds one more values. It has a label or name to identify it and its values can be changed as the program runs.
Define string manipulation
The characters in a string are usually numbered starting at zero. You can use commands which give you information about the string or allows you to alter the string.