1.1 Fundamentals of programming Flashcards
Define a memory address
A specific location in memory where instructions or data are stored
Define assignment
The process of giving a value to a variable or constant
What is the difference between a constant and a variable?
A constant is an item of data whose value does not change, whereas a variable is an item of data whose value could change whilst the program is being run
Define debugging
The process of finding and correcting errors in programs
Define declaration
The process of defining variables and constants in terms of their name and data type
Why is naming variables important?
- Makes it easier to debug / find and correct errors in the code
- When several programmers are working on the same program at once, sensible naming conventions can make it easier to understand
- It is easier to update the program at a later date
What is a data type?
A data type determines what sort of data is being stored and how it will be handled by the program
Define an integer
An integer is any whole positive or negative number including 0
Define a real / float
A number with a fractional or decimal part
Define a string
A string is a data type used to store characters
Define boolean
A data type with 2 possible states of True or False
What is a pointer?
A data item that identifies a particular element in a data structure - normally the front or rear
What is an array?
A set of related data items stored under a single identifier. Can work on one or more dimensions
What is an element?
A single value within a set or a list - also called a member
Define a record
One line of a text file
What is the difference between a built in and a user defined data type?
Built in data types are pre-defined by the programming language, whereas user defined data types are created by the programmer for use in the code
Why are user defined data types useful?
- They can make code more efficient and can allow for reusing sections of code
- They can make code easier to read and understand
Define syntax
The rules of how words are used within a given language
Define selection and give an example
The principle of choosing what action to take based on certain criteria, in python this is an if statement
Define nesting
Placing one set of instructions within another set of instructions
Define iteration
The principle of repeating processes
Define definite iteration and give an example
A process that repeats a set number of times, in python this is a for loop
Define indefinite iteration and give an example
A process that repeats until a certain condition is met, in python this is a while loop
What is a sequence?
The principle of putting correct instructions in the right order within a program
Define arithmetic operations
Common expressions such as +, -, x, /
Define rounding
Reducing the number of digits used to represent a number while maintaining a value that is approximately equivalent
Define truncating
The process of cutting off a number after a certain number of characters or decimal places
What is the difference between random and pseudo-random number generation?
Random numbers are generated by a function that produces a completely random number whereas pseudo-random numbers are not 100% random, and are common in programming languages
Define a relational operation
A relational operation is an expression which compares two values such as equal to or greater than