Please enable JavaScript.
Coggle requires JavaScript to display documents.
Fundamentals of programming (Data type: determines what sort of data are…
Fundamentals of programming
Data type:
determines what sort of data are being stored and how it will be handled by the program
Integer:
any whole positive or negative number including zero
Real/float:
any positive or negative with a fractional part
Boolean:
a piece of data that has two values TRUE or FALSE
character
string
date/time
Pointer/reference:
a data item that identifies a particular element in a data structure
records:
used to store a collection of related data items, where the items all have different data types
array:
a set of related data items stored under one identifier name
built-in data types:
those that are provided with the programming language
User-defined data types:
when users make up their own data type, usually by combining existing data types together
Programming concepts
Constant:
an item of data whose value does not change
Variable:
an item of data whose value could change while the program is being run
Declaration:
the process of defining variables and constants in terms of their name and data type
Assignment:
the process of giving a value to a variable or constant
Iteration:
the principle of repeating processes
Definite iteration:
a process that repeats a set number of times
Indefinite iteration:
a process that repeats until a certain condition is met
Selection:
the principle of choosing what action to take based on a certain criteria
Subroutine:
a named 'out of line' block of code designed to carry out a specific task
Function:
a subroutine that returns a value
benefits
they can be called at any time using the subroutines unique name
they allow you to gain an overview about how the program is put together
you can use a top-down approach to develop the whole project
the program is easier to test and debit because each subroutine is self-contained
very large projects can be developed by more than one programmer
Parameter:
data being passed into a subroutine
Nesting:
placing one set of instructions within another set of instructions
Arithmetic operations
addition
subtraction
multiplication
real/float division
integer division, including remainders
exponentiation
rounding:
reducing the number of digits used to represent a number while maintaining a value approximately equivalent.
truncation:
the process of cutting off a number after a certain number of characters or decimal places
Random number generation:
a function that produces a completely random number
Relational operations
equal to
not equal to: !=
less than
greater than
less than or equal to
greater than or equal to
Boolean operations
NOT
AND
OR
XOR
String handling
length
position
substring
concatenation
character -> character code
string conversion operations
character code:
a binary representation of a particular letter, number or special character
Exception handling:
the process of dealing with events that cause the current subroutine to stop
an error is thrown so the current subroutine stops or is paused, the current state is saved
Local & Global variables
Local variable :
limits the existence of the variable to the existence of the subroutine or function in which it was declared
Advantages
you cannot inadvertently change the value being stored somewhere else in the program
you could use the same variable name in different sections, and each could be treated as a separate variable
you free up memory as each time a local variable is finished with, it is removed from memory
Global variable:
allows the variable to be used anywhere in the program
Stack frames:
a collection of data about a subroutine call
Call stack:
a special type of stack used to store information about active subroutines and functions within a program
Recursion:
the process of a subroutine calling itself