Computer science paper 1 Flashcards
integer
+/- whole number
real/float
+/- quantity (can be a decimal)
Boolean
true/false
array
-data structure that holds similar related data, allocating a contiguous part of memory for the purpose of storing that data
-starts at index 0
pointer
-variables declared as a pointer are used to store memory address of objects created at runtime
-use far less memory copying pointer that copying section of memory it is pointing to (32/64 bits in lenghth)
computer program
-series of statements that are executed one after the other
sequences
-executing one instruction after another
selection
allows program to branch and follow different direction dependinng on outcome of condition
e.g. if
iteration
-repeating sections of code
e.g. FOR loops
WHILE loops
variable
-a value that can change while program is running
-an address in memory
constant
-value that remains fixed
-must be set when program is first written
assignment
-supply a value to a variable/ constant
advantages of constants over variables
-C makes program easier to read by replacing strings with meaningful indentifiers that are easy to understand
-C makes program easier to modify and understand
-C may be referred to many times but will only neeed to be modified in 1 location
ALU
-arthmetic operation
-logical comparisons
-binary shifts
arthmetic operation
addition = +
subtraction = -
multiplication = *
division = /
exponentiation = **
modulus = % (7 MOD 2 = 1) remainder
integer division = // (7 DIV 2 = 3) division without any remainders
rounds = round() (x = round (2.667, 1) = 2.7)
truncates = trunc() (x = trunc(2.667,1) = 2.6)