Section 1 - Fundamentals of Programming Flashcards
What is an algorithm?
A set of rules/a sequence of steps you can follow to solve a problem. They have inputs, processing and outputs.
What is psuedocode?
The midpoint between a natural language and a programming languages. There are no concrete rules or syntax with multiple ways of writing the same statement.
What does the trunc function do?
Rounds a real number down to the nearest whole number
What does the div function do?
Floor division
What does the mod function do?
Gives the remainder
What are variables?
Identifiers given to memory locations whose content will change during the course of the program
What are constants?
A type of variable where the value never changes as the program is being run
What is the advantage of using constants?
- There is no chance a programmer accidentally changes it’s value during the program
- It is more readable than using values
- If you change the value of the constant you don’t have to manually change it on every line it appears
What are the 3 programming constructs?
- Sequence
- Selection
- Iteration
What is sequence?
2 or more statements following one after the other
What is selection?
A statement used to select which statement will be executed next, depending on some condition
What are relational operators used for?
Formulating the condition for selection
What is the CASE statement?
An alternative structure to the IF statement that is useful when there is a choice between several alternatives
What is the XOR operator?
Exclusive OR, i.e either a or b but not both
What is an iterative statement?
A statement causing the code to perform a loop, repeating a number of statements