Unit 1 - Fundamentals of Programming Flashcards
What is an algorithm?
An algorithm is a sequence of steps, which if followed, can successfully solve a problem.
Define pseudocode.
Pseudocode is a form of code somewhere in the middle of plain English and programming language code. It uses similar statements to code and mathematical terms, and acts as an aid to help plan out the code before you actually start to code.
Give an advantage of pseudocode.
As pseudocode is in the middle of a programming language and English, it is generally easy to use as the programmer won’t need to worry about getting the exact programming syntax.
What is an identifier?
An identifier is a name which points to a specific memory location.
What is assignment?
An assignment is where a value is assigned to a memory location/identifier.
Give the names of common data types used in code.
- String
- Character
- Integer (whole number)
- Boolean value
- Decimal (float)
Define a variable.
A variable is a memory location holding a data value in a computer program. It can be referenced or changed in a program from time to time.
What is a constant?
A constant is a fixed data value which stays the same throughout the whole program and can only be changed in the source code, but the whole program would have to be recompiled for that change in value.
Why use a constant?
A constant is useful because if you have a program which is quite number heavy, than instead of changing each individual data value, by changing the value of the constant, all the values in program instantly are updated, saving a significant amount of time.
What is the modulus (mod for short) operator?
The mod operator is an operator which returns the remainder of integer division.
What is the div operator?
The div operator is an operator which returns only the integer part of integer division.
Give examples of string handling functions.
Examples of string-handling functions include the len function which returns the length of a string and the .find function which helps find a certain part of the string, returning the position of the first character of the phrase requested.
Define program flow.
Program flow is the sequence of execution of instructions in a program.
What do selection statements such as the if statement do?
Selection statements help maintain this program flow throughout the whole program.
What is iteration?
Iteration is the repetition of a sequence of instructions in a program. It is very efficient and significantly reduce unnecessarily rewriting lines of code.