Programming

5.0(2)
studied byStudied by 10 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/70

flashcard set

Earn XP

Description and Tags

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

71 Terms

1
New cards
Variable
A named space in memory, large enough to store a single piece of data. Each variable has a data type
2
New cards
Constant
A named space in memory with a value that can never change while the program is running
3
New cards
Declaration
Code that causes a variable to exist. Once a variable has been declared, it can be used.
4
New cards
Assignment
The process of putting a value into a variable
5
New cards
Boolean
Can either be True or False
6
New cards
Character
A single letter, number, punctuation mark, space, etc.
7
New cards
Integer
Whole numbers - positive, negative or zero
8
New cards
Real
Decimal numbers - positive or negative (zero can also be stored in a 'real' variable'
9
New cards
String
A collection of characters, used to store names, addresses, phone numbers etc.
10
New cards
Sequence
Instructions will always execute in the order in which they were written. Every line will be executed once and only once.
11
New cards
Selection
When one path through the code is chosen where multiple possible paths exist.
12
New cards
Iteration
Looping. Code that is iterative might be executed multiple times, even though it is only written once.
13
New cards
Nesting
Placing one programming structure inside another one. There is no limit to the number of levels of nesting
14
New cards
Operations
An action that is performed on one or more pieces of data in order to produce additional data
15
New cards
Arithmetic operations
A process performed on one or more numbers. Examples include +, -, *, /, DIV and MOD
16
New cards
Relational operations
A comparison between two values. Examples include
17
New cards
Logic operations
Can only have one of two outcomes - true or false. A logic operator connects together logic expressions. Examples include AND, OR and NOT
18
New cards
Data structure
A structured (organised) means of storing related data. While a variable can only store a single piece of data, a data structure can contain many
19
New cards
One-dimensional array
A data structure for storing multiple data items of the same data type. The whole array has a single name, with each element within the array having a specific index number
20
New cards
myArray = [4, 6, 1, 2, 9, 0]
Creates an array called 'myArray' and populates it with six integers
21
New cards
myArray[0] = 5
Places the number '5' into the first element (index '0') of the array
22
New cards
print(myArray[2])
Displays the third element of the array
23
New cards
Two-dimensional array
Another data structure for storing multiple data items of the same data type. Unlike a one-dimensional array, it can be considered like a grid instead of a row. Elements are referred to with two numbers.
24
New cards
myArray2 = [ [ 'a', 'b'] , ['c', 'd'] ]
Creates a two-dimensional array that contains four letters
25
New cards
myArray2 [1] [0] = 'z'
Replaces 'c' with 'z'
26
New cards
print(myArray2 [0] [1])
Displays the requested letter (in this case, it is 'b')
27
New cards
Record
A data structure that can accept multiple data items that do not need to be of the same data type
28
New cards
Input
The process of introducing data into a computer system
29
New cards
Output
The process of communicating data beyond the system, typically to a human user
30
New cards
File
A store of data, used by a program, that continues to exist when the program, and even the computer itself, is no longer running
31
New cards
fullName = firstName + ' ' + lastName
Concatenation - used to join different strings together
32
New cards
print(len(firstName)
Displays the length (the number of characters) in a string
33
New cards
fullName = 'Richard Lee'
print(fullName [0:7])
Displays a substring (in this case, 'Richard')
34
New cards
Casting
Converting a piece of data to a specific data type
35
New cards
Uses of random numbers
- Encrypting data, making it difficult for unauthorised people to understand
- Causing simulations to run differently each time
- Adding variability to computer games
- Random sampling of survey participants
36
New cards
Subroutine
A small subsection of the whole program that performs a specific, well-defined task
37
New cards
Advantages of Subroutines
- Each subroutine can be given to a different programmer - working as a team is straightforward
- Subroutines can be tested separately
- Subroutines that are commonly used can be reused in other programs, saving time and reducing errors
38
New cards
Parameter
A piece of data that is passed into a subroutine in order for that subroutine to do its job
39
New cards
Calling
A process where an instruction in one part of the code tells another named part of the code to run
40
New cards
Return
A command in which a subroutine passes a piece of data back to the line of code from which it was called
41
New cards
Difference between procedures and functions
A function is a subroutine that returns a value, and a procedure is a subroutine that does not
42
New cards
Modularisation
The process of breaking a program into smaller parts called modules. A subroutine is a type of module, and the advantages of dividing a program into either subroutines or modules are the same
43
New cards
Scope
Refers to the visibility of a variable, and can either be local or global
44
New cards
Advantage of global variables
Another programmer who is working on a different subroutine could modify global variables and make them behave unpredictably
45
New cards
Robust
A robust program continues to function even when confronted with unexpected events such as a lost network connection or a user inputting data of the wrong data type
46
New cards
Secure
A secure program prevents users from accessing or altering data that they should not access or alter
47
New cards
Validation
Ensuring that data entered into the computer is reasonable and sensible. It does not ensure that the data entered is correct
48
New cards
Range check
Ensures that data is within a specified range
Examples: race times, ensuring a person's birthday is not after today's date
49
New cards
Type check
Ensures that the correct data type has been entered
Examples: checking whether the type is an integer or Boolean
50
New cards
Length check
Ensures that the string contains a valid number of characters
Examples: postcode, phone number
51
New cards
Lookup check
Checks that what the user has entered exists on a list, such as a list of postcodes or days of the week
52
New cards
Presence check
Checks that the user has entered something. Essentially a length check that ensures that the length is greater than zero.
53
New cards
Authentication
The software process of ensuring that the person accessing a system is the person who is supposed to access that system
54
New cards
Authentication methods
- Usernames and Passwords
- Memorable information - prompting for something that only the real user should know
- Checking that the user is using their usual computer by logging the IP address
55
New cards
Normal (typical) test data
Data that is valid and that represents how the program would be used
56
New cards
Boundary (extreme) test data
Data that is just barely valid, to check that the extreme ranges of normal input work correctly. It is also good practice to test data that is just outside the acceptable range.
57
New cards
Erroneous
Data that should not be accepted by the system. This is included to test whether a programs validation and error messages work correctly.
58
New cards
High-level languages
More understandable to humans than low-level languages because the code is more similar to English, so are more popular. One line of code might do several things.

Examples: Java, Python, C#, Visual Basic
59
New cards
Low-level languages
More difficult to understand but can be executed very quickly by computers. Each line of code performs a single task.

Examples: Machine and Assembly code
60
New cards
Machine Code
Machine-specific code, which means that a machine code program written for one computer does not necessarily work on another computer. Consists of 1s and 0s.
61
New cards
What is needed in order to run code in high and low level languages?
High-level: Either an interpreter or a compiler, to enable code to be translated into machine code so that the computer can run it

Low-level: Machine code does not need to be translated, but assembly language requires an assembler
62
New cards
Suitability of high-level languages
- More appropriate if the program is to be used on a variety of different computer builds
- More people are proficient in high-level than low-level languages
63
New cards
Suitability of low-level languages
- Likely to be used within embedded systems, where specific memory locations and processor functions can be addressed directly
- Suited to time-critical applications, where execution must take place as quickly as possible
64
New cards
Translator
A program that translates source code into machine code
65
New cards
Assemblers
Translate assembly language - it is only used for low-level translation
66
New cards
Interpreters
Translate and execute high-level code, one line at a time
67
New cards
Compilers
Translate an entire high-level program before executing it
68
New cards
Advantages of Interpreters
- A program that contains errors can still be run up to where the error exists
- Debugging is easier, as the problematic line can be more easily pinpointed
69
New cards
Disadvantages of Interpreters
- A program needs to be interpreted every time you run it, which is time consuming
- It is easier for unauthorised people to access the source code
70
New cards
Advantages of Compilers
- A compiled object code file will run more quickly than re-interpreting a source code file
- It is more difficult for unauthorised people to modify a compiled object code file
71
New cards
Disadvantages of Compilers
- More memory is needed for the compilation process than for interpretation
- The entire program needs to be error free in order for it to compile