2.2 Programming Fundamentals Flashcards
OCR GCSE Computer Science J277
Initialisation
Setting the initial value for a variable.
Variable
An identifier associated with an area of computer memory in which data is stored. The data can change during program execution.
Sequence
The order. A set of instructions that will be carried out, one after the other, in the stated order.
Constant
An identifier associated with an area of computer memory in which data is stored. The data CANNOT change during program execution.
Selection
A program control structure with a logical test, or sequence of tests, that evaluate(s) to True or False. It allows subsequent statements to be run selectively depending on the outcome of the test(s).
Condition
An expression that evaluates to True or False (such as within an ‘if’ statement)
Selection with multiple conditions
Multiple statements take the form of else if and act as additional conditions that are checked in the order in which they are written in the selection block
Expression
Combination of variables, constants, values, or operators that is evaluated to produce a result.
Loop
A sequence of instructions that is repeated. This can be a fixed number of repetitions (count-controlled loop) or the number of repetitions can be controlled by a condition (condition-controlled loop)
Integer
A whole number, such as 5. It can be positive or negative.
Integer Division / Floor Division / Quotient
A division where the quotient (result) is an integer and any remainders are discarded. The operator is often represented by the abbreviation DIV or in Python it uses the // sign.
Modulo operation
An operation that returns the remainder of a division. The modulo operator is often represented by the abbreviation MOD or in Python it uses the % sign.
Real / Float
Real is also referred to as float. Real numbers include numbers with decimal places. A real number can be positive or negative.
Boolean
The Boolean data type is based on logic and can have one of only two values, True or False
Char
Char refers to a single character. The character can be any letter, digit or symbol
String
The string data type refers to text. A string is a collection of characters and includes spaces, punctuation, numeric digits and any other symbols. The numeric digits would be handled as text characters, not integers.
Null
A null value is used to indicate ‘nothing’; the lack of any value, of any type of data.
Data Type
An attribute of a data item that determines the values that can be stored and the operations that can be carried out on that data item. Examples include string, character, integer, float (real) and Boolean.
Casting
Changing the data type of a piece of data. For example, converting a string to an integer using int()
Concatenation
Joining two or more strings together to make a new string.
Index
A number that describes the position of an item within an array. Starts at zero for the first item.
Substring
A part of a string.
Function
A named block of code that performs a task and returns one or more values.
Procedure
A named section of code that can be called (executed) to perform a specific task by using the identifier (name of the procedure) in a program statement. It does not return a value.
Argument
A data value or reference passed to a subroutine as required by its defined parameters.
Local Variable
A variable that is only defined and visible for use in specific parts of a program, e.g. within a subprogram (procedure or function)
Global Variable
A variable that is accessible from all parts of a program.
Parameters
Part of the definition of a subprogram that specifies the data value(s) or reference(s) to be passed to the subprogram when it is called. When calling a subroutine (such as procedure or function), the values of the parameters are passed into the subroutine as arguments.
Array
A data structure whose elements can be accessed directly by an index. The position of each element is computed at runtime.
Data Persistence
The characteristic of a state that outlives the program that created it. If a python file creates a text or CSV file, the data in that file has data persistence. It isn’t wiped when the python code stops running.
Database
An organised collection of data that can be as simple as a single file, and as complex as a set of related tables
Primary Key
A field (column) that uniquely identifies a record (row) in a database table.
Foreign Key
FYI - an attribute (field, column) in one table that is the primary key in another table, and used to link the tables together.
Record
A data structure that can be used to store multiple pieces of data that relate to the same thing. Each piece of data can have a different data type. For instance, name, surname, telephone number for the same person.
Field
A column in a database, a category heading. Like telephone, surname.
Flat file database
A database in which all data is held in a single table.