Programming

studied byStudied by 9 people
5.0(2)
get a hint
hint

Variable

1 / 70

Tags and Description

71 Terms

1

Variable

A named space in memory, large enough to store a single piece of data. Each variable has a data type

New cards
2

Constant

A named space in memory with a value that can never change while the program is running

New cards
3

Declaration

Code that causes a variable to exist. Once a variable has been declared, it can be used.

New cards
4

Assignment

The process of putting a value into a variable

New cards
5

Boolean

Can either be True or False

New cards
6

Character

A single letter, number, punctuation mark, space, etc.

New cards
7

Integer

Whole numbers - positive, negative or zero

New cards
8

Real

Decimal numbers - positive or negative (zero can also be stored in a 'real' variable'

New cards
9

String

A collection of characters, used to store names, addresses, phone numbers etc.

New cards
10

Sequence

Instructions will always execute in the order in which they were written. Every line will be executed once and only once.

New cards
11

Selection

When one path through the code is chosen where multiple possible paths exist.

New cards
12

Iteration

Looping. Code that is iterative might be executed multiple times, even though it is only written once.

New cards
13

Nesting

Placing one programming structure inside another one. There is no limit to the number of levels of nesting

New cards
14

Operations

An action that is performed on one or more pieces of data in order to produce additional data

New cards
15

Arithmetic operations

A process performed on one or more numbers. Examples include +, -, *, /, DIV and MOD

New cards
16

Relational operations

A comparison between two values. Examples include
New cards
17

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

New cards
18

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

New cards
19

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

New cards
20

myArray = [4, 6, 1, 2, 9, 0]

Creates an array called 'myArray' and populates it with six integers

New cards
21

myArray[0] = 5

Places the number '5' into the first element (index '0') of the array

New cards
22

print(myArray[2])

Displays the third element of the array

New cards
23

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.

New cards
24

myArray2 = [ [ 'a', 'b'] , ['c', 'd'] ]

Creates a two-dimensional array that contains four letters

New cards
25

myArray2 [1] [0] = 'z'

Replaces 'c' with 'z'

New cards
26

print(myArray2 [0] [1])

Displays the requested letter (in this case, it is 'b')

New cards
27

Record

A data structure that can accept multiple data items that do not need to be of the same data type

New cards
28

Input

The process of introducing data into a computer system

New cards
29

Output

The process of communicating data beyond the system, typically to a human user

New cards
30

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

New cards
31

fullName = firstName + ' ' + lastName

Concatenation - used to join different strings together

New cards
32

print(len(firstName)

Displays the length (the number of characters) in a string

New cards
33

fullName = 'Richard Lee' print(fullName [0:7])

Displays a substring (in this case, 'Richard')

New cards
34

Casting

Converting a piece of data to a specific data type

New cards
35

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

New cards
36

Subroutine

A small subsection of the whole program that performs a specific, well-defined task

New cards
37

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

New cards
38

Parameter

A piece of data that is passed into a subroutine in order for that subroutine to do its job

New cards
39

Calling

A process where an instruction in one part of the code tells another named part of the code to run

New cards
40

Return

A command in which a subroutine passes a piece of data back to the line of code from which it was called

New cards
41

Difference between procedures and functions

A function is a subroutine that returns a value, and a procedure is a subroutine that does not

New cards
42

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

New cards
43

Scope

Refers to the visibility of a variable, and can either be local or global

New cards
44

Advantage of global variables

Another programmer who is working on a different subroutine could modify global variables and make them behave unpredictably

New cards
45

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

New cards
46

Secure

A secure program prevents users from accessing or altering data that they should not access or alter

New cards
47

Validation

Ensuring that data entered into the computer is reasonable and sensible. It does not ensure that the data entered is correct

New cards
48

Range check

Ensures that data is within a specified range Examples: race times, ensuring a person's birthday is not after today's date

New cards
49

Type check

Ensures that the correct data type has been entered Examples: checking whether the type is an integer or Boolean

New cards
50

Length check

Ensures that the string contains a valid number of characters Examples: postcode, phone number

New cards
51

Lookup check

Checks that what the user has entered exists on a list, such as a list of postcodes or days of the week

New cards
52

Presence check

Checks that the user has entered something. Essentially a length check that ensures that the length is greater than zero.

New cards
53

Authentication

The software process of ensuring that the person accessing a system is the person who is supposed to access that system

New cards
54

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

New cards
55

Normal (typical) test data

Data that is valid and that represents how the program would be used

New cards
56

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.

New cards
57

Erroneous

Data that should not be accepted by the system. This is included to test whether a programs validation and error messages work correctly.

New cards
58

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

New cards
59

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

New cards
60

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.

New cards
61

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

New cards
62

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

New cards
63

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

New cards
64

Translator

A program that translates source code into machine code

New cards
65

Assemblers

Translate assembly language - it is only used for low-level translation

New cards
66

Interpreters

Translate and execute high-level code, one line at a time

New cards
67

Compilers

Translate an entire high-level program before executing it

New cards
68

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

New cards
69

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

New cards
70

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

New cards
71

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

New cards

Explore top notes

note Note
studied byStudied by 30 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 2 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 7 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 37 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 38 people
Updated ... ago
5.0 Stars(2)
note Note
studied byStudied by 19 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 17 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 11743 people
Updated ... ago
4.7 Stars(89)

Explore top flashcards

flashcards Flashcard81 terms
studied byStudied by 225 people
Updated ... ago
5.0 Stars(4)
flashcards Flashcard337 terms
studied byStudied by 8 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard83 terms
studied byStudied by 2 people
Updated ... ago
4.0 Stars(1)
flashcards Flashcard105 terms
studied byStudied by 137 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard41 terms
studied byStudied by 34 people
Updated ... ago
5.0 Stars(5)
flashcards Flashcard65 terms
studied byStudied by 5 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard69 terms
studied byStudied by 3 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard545 terms
studied byStudied by 59443 people
Updated ... ago
4.3 Stars(604)