4.1.1 - FoP (Programming) Flashcards
Define Data type
An attribute of data that determines what sort of data is being stored and how it will be used
Define Integer
A data type for storing positive or negative whole numbers
Define real/float
A data type for storing numbers with decimal values
Define Boolean
A data type that can only store one of two possible values
Define Character
A data type for storing a letter, number or special character.
Define String
A data type for storing a sequence of characters or symbols
Define Date/Time
A data type for storing date or time values
Define records
A data structure that stores related data items in elements called fields, organised based on attributes
Define Array
A data structure for storing finite, ordered set of data of the same data type within a single identifier.
What is a pointer/reference type
Data type which are stores for memory addresses of objects created at runtime, dynamically.
Define user-defined data types
Custom data types designed by the user by combining existing data types, for the bespoke needs of their program
Define language defined data types
A primitive data type provided by a programming language
Define Subroutines(Procedures/Functions)
a named ‘out of line’ block of code that may be executed (called) by
simply writing its name in a program statement.
Why is it important to use meaningful identifier names
- Makes logic of code easier to follow
- Makes code self-documenting (Describes th elogic of the code as its developed)
- Makes purpose of code clear
What are some advantages using named constants
- Keeps the program code consistent
- Makes it easier to read and debug a program.
- Because it is immutable if it is to be modified, it is only to be done in one place.
What are some advantages of using subroutines
1 - Reduces repition of code , as it can be reused
2- makes code more compact and easier to read as problems are broken down
3 - Easier to debug as subroutines can be tested independently from the whole program
4 - Faster development of large problems as the can be decomposed.
How do subroutines use parameters
parameters are specified between brackets after subroutine call statement, these are required for the method to be run
What is are the features of a local variabes
1 - One that exists while the subroutine is excecuted
2 - One that is only accessible within the subroutine
Why is it good practice to use local variables
- They use less system resources and so are more memory efficient
- Easier to debum as they can only be modified in the subroutine and not all over the program
What is a stack frame
A data structure that stores the return addressess, parameter and local variables when subroutines are called
What is a recursive routine