Programming Flashcards
What is an algorithm?
An algorithm is a sequence of instructions that can be followed to solve a problem, and that always terminates.
How is pseudocode used?
Pseudocode is used to write instructions using statements that are somewhere between English and a programming language.
There are guidelines for writing pseudocode, but no strict rules.
Pseudocode is an aid to work out the steps needed to solve a problem before beginning to code.
How are flowcharts used?
A flowchart is a diagram used to illustrate the steps of an algorithm.
Flowcharts are made up of symbols, each containing a single step of the algorithm.
The shape of the symbol represents the type of process that the symbol contains.
Arrows are used to show the flow of execution, meaning that flowcharts can represent all the core concepts of programming, namely sequence, selection, and iteration.
What is a variable?
A named piece of memory that holds a value. The value it holds can, and often does, change during the running of a program.
What is a constant?
A named piece of memory where the value cannot be changed while a program runs.
Why are constants useful?
Constants are useful because they are declared and assigned once, but can be referred to over and over again throughout the program. This means that if the programmer needs to change the value throughout the program code, they only need to make one change. This can help make a program easier to maintain.
What naming conventions do constants follow?
Constants follow the same naming conventions as variables, except that they are often written in uppercase. Some programming languages, such as Python, do not support constants.
What is a data type?
How data is stored depends on what the data is. A data type is defined by the values it can take or the operations which can be performed on it.
How do programmers decide which data type to use?
In some situations, it might be possible to store one piece of data using various different data types. In this case, the programmer must decide which option is the best suited to solving a particular problem or which is the most memory-efficient.
For example, if a programmer needs to store a user’s age in years, they could use a string or an integer. In this situation, using an integer would be the best option, because a person’s age is only ever going to contain numerical digits.
What is an integer?
A whole number, which can be positive, negative, or zero.
What is a real/float?
A number which can have a decimal part. The number can be positive, negative, or zero.
What is a Boolean?
A value that is either True or False.
What is a character?
A single number, letter, or symbol, enclosed in quotation marks, e.g. ‘a’, ‘9’, ‘@’, ‘!’.
What is a string?
A list of characters enclosed in quotation marks, e.g. ‘Hello’, ‘ABC123!’.
What is a date/time?
A way of storing a point in time. Many different formats are used.
What is a pointer/reference?
A way of storing memory addresses.
What is a record?
A collection of fields, each of which could have a different data type. You can think of a record as a row from a table.
What is an array?
A finite, indexed set of related elements each of which
has the same data type.