2.2.1 FINAL Programming techniques Flashcards
(15 cards)
What is a data type?
A classification of data into groups
What is an integer?
Used to represent whole numbers, either positive or negative
What is a real?
Used to represent numbers with a fractional part, either positive or negative
What is chr?
Used to represent a single character such as a letter, digit or symbol
What is a string?
Used to represent a sequence of characters
What is boolean?
Used to represent true or false values
What is casting?
When you convert one data type to another data type
What is a programming construct?
Determines the order in which lines of code are executed
State the 3 types of programming constructs
Sequence, Branching, Iteration
What is 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 are written from the first line of code to the last line of code
What is a selection?
- The flow of the program is interrupted and a condition is tested
- Outcome of the condition will then determine which lines/block of code is run next. Two ways to write selection statements:
- IF statement: test conditions sequentially
SWITCH statement: test an expression against multiple possible constant values
What is an iteration?
- Repeating a line or block of code using a loop. It can be:
- Count controlled: When the code is repeated a fixed number of times (for loop)
- Condition controlled: When the code is repeated until a condition is met (while loop)
What is a SWITCH/CASE statement?
- Type of conditional statement that provides an alternative way to perform multiple comparisons based on the value of an expression
- Useful when you have a single expression that you want to compare against multiple possible values
What is a for loop?
Count controlled loop that will repeat a fixed number of times