2.2 - Programming Fundamentals Flashcards
What are the three programming constructs?
- Sequence
- Selection
- Iteration
What is sequencing?
Structuring code into a logical, sequential order one after the other
What is selection?
Decision making using if or statements
What is iteration?
Repeating code using for or while loops
What is a variable?
A named location in memory used to store a value which can be changed while the program is running
What is a constant?
A variable that doesn’t change whilst the program is running
What is a subroutine
Named out of line blocks of code that are called in the main program to execute
A sequence of instructions that perform a specific task
What are local variables?
Variables declared within a specific subroutine that can only be used within that subroutine
What are the advantages of using local variables?
- Saves memory
- Easier to debug local variables
- You can reuse subroutines with local variables in other programs
What are global variables?
Variables that can be used at any point within the whole program
What are the advantages of using global variables?
- Can be used anywhere in the program
- Makes maintenance easier
- Can be used for constants
What are the most common arithmetic operators?
- Add (+)
- Subtract (-)
- Multiply (*)
- Divide (/)
What is modulo division (AKA modulus)?
Reveals the remainder from the last whole number, E.G:
9 MOD 4 = 1 (4 goes into 9 twice (8) with a remainder of 1)
Operator: MOD or %
What is integer division (AKA quotient)?
Reveals the whole number of times a number can be divided into another number, E.G:
9 DIV = 2 (4 goes into 9 fully, twice)
Operator: DIV or //
What are logical operators?
TRUE or FALSE values (Boolean), E.G: AND, OR or NOT
What is a character?
A single character, such as a letter, number or punctuation symbol, E.G:
- T
- 8
- ?
What is a string?
A sequence of characters that can include letters, numbers and punctuation, E.G:
- Harry Waters
- 14:50pm
- Ice Age 4
What is an integer?
A whole number, E.G:
- 475
- -8432
- 5
What is a real number?
A decimal number, E.G:
- 65.3
- -321.1234
- 909.135
What is boolean?
An answer that only has two possible values, E.G:
- True / False
- Yes / No
- 1 / 0
What is casting?
Converting the value of a variable from one data type to another
What is an array?
A list containing items of the same data type
What is a two-dimensional array?
An array with multiple rows and columns that comes in the form of a table
What are records?
Lists storing data of different data types
What should we always assume indexing starts at?
0, unless told otherwise
What is SQL (structured query language)?
A language that can be used to search for data in a database