Data types Flashcards
1
Q
What is an algorithm?
A
• An algorithm is a set of rules or a sequence of steps specifying how to solve a problem, independent of any programming language.
2
Q
What do all algorithms have?
A
- Input
- Processing
- Output
3
Q
What is an integer?
A
Positive or negative whole numbers
4
Q
What is a real/float?
A
Stores numbers with decimal places/values
5
Q
What is a character?
A
Letters, numbers and special characters typically represented in ASCII.
6
Q
What is a string?
A
• Stores alphanumeric combinations and texts, group of characters.
7
Q
What is a variable?
A
- Variable are identifiers given to memory locations whose contents will change during the course of the program.
- Variable is a storage location, identified by a memory address paired with an associated symbolic name ( Identifier ) which contains information referred to as the value.
8
Q
What is an identifier?
A
User defined name of the programming element.
9
Q
What is a constant?
A
- Constant is a value that cannot be altered by the program during normal execution, the value would therefore be constant.
- Variable is an identifier with a value that can be changed during normal execution, i.e. the value is variable
10
Q
What are the advantages of using constants?
A
- In a long, complex program there is no chance a programmer will accidentally change its value by using the identifier for a different purpose.
- It is far more efficient to change the value of a constant, as the programmer does not have to search through the program to find all the lines where the value was changed.