8.1 Programming fundamentals Flashcards

1
Q

Variables

A

A variable is a named memory location that holds data during the execution of a program, the data can change.
Variables can store a variety of different types of data such as numbers, text or true/false values.
To store data in a variable, the process of assignment is used.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Constant

A

A constant is fixed data that during the execution of a program cannot change.
A constant can store a variety of different types of data, similar to variables.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Assignment

A

Assignment is the process of storing data in a variable or constant under a descriptive name.
Assignment is performed using the = symbol

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Operators

A

An operator is a symbol used to instruct a computer to perform a specific operation on one or more values
Examples of common operators include:
Arithmetic
Comparison
Boolean (AND, OR and NOT)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Input

A

An input isa value that is read from an input device and then processed by a computer program.
Typical input devices include:
Keyboards - Typing text
Mice - Selecting item, clicking buttons
Sensors - Reading data from sensors such as temperature, pressure or motion
Microphone - Capturing audio, speech recognition
Without inputs, programs are not useful as they can’t interact with the outside world and always produce the same result.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Output

A

An output is a value sent to an output device from a computer program.
Typical output devices include:
Monitor - Displaying text, images or graphics
Speaker - Playing audio
Printer - Creating physical copies of documents or images

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Programming construct

A

A programming construct determines the order in which lines of code are executed.
They control logic and behaviour of code.
There are three core programming constructs:
Sequence
Selection
Iteration

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Sequence

A

Sequence refers to lines of code which are run one line at a time.
The lines of code are run in the order that they written from the rst line of code to the last line of code.
Sequence is crucial to the fl ow of a program, any instructions out of sequence can lead to unexpected behaviour or errors.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Selection

A

Selection is when the ow of a program is changed, depending on a set of conditions.
The outcome of this condition will then determine which lines or block of code is run next.
Selection is used for validation, calculation and making sense of a user’s choices.
There are two ways to write selection statements:
if… then… else… statements - this is when you test conditions sequentially.
case select or switch… statements - this is when you test an expression against multiple possible constant values (known as cases).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Iteration

A

Iteration is repeating a line or a block of code using a loop.
Iteration can be:
Count controlled - this is when the code is repeated a fixed number of times (e.g. using a for loop).
Condition controlled - this is when the code is repeated until a condition is met (e.g. using a while loop or a do while loop).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly