Programming Flashcards
What are the 5 main data types?
- Integer (INT)
- Real/ float (REAL)
- Boolean (BOOL)
- Character/char (CHAR)
- String (STRING)
What do the main data types store?
> Integer - whole numbers,
Real - numbers with decimals,
Boolean - true or false,
Character - a single letter, number or symbol,
String - used to represent text, can hold a collection of characters (cannot do maths).
What is the typical amount of memory taken up from the main data types? (in order)
1) Real - 4 Bytes or 8 Bytes,
2) Integer - 2 Bytes or 4 Bytes,
3) String - 1 Byte per character,
4) character - 1 Byte,
5) Boolean - 1 bit is needed but 1 byte is often used.
Is it possible to change one data type to another?
Yes, most languages do allow you to convert data types.
What does an assignment look like in pseudocode?
←
What are examples of selection?
If/Case, Though case is not used in pseudocode, it is specific to certain programming languages like VB.
What are the two types of iteration?
> Definite - a known number of loops at the start of the iteration,
Indefinite - loops until a condition is met.
What are examples of indefinite iteration?
While loops
What are examples of definite iteration?
For loops
What does DIV do?
Divides a number to the nearest whole number without going over, for example: 20 DIV 3 = 6
What does MOD do?
Gives you the remainder of a division, for example: 20 MOD 3 = 2
What is a constant?
A variable where data is assigned and then cannot be changed.
What is a variable?
A location where data values can be stored as a certain file type.
What is the difference between a constant and a variable?
The data in a constant cannot change but a variables data can.
How do you create a random number in Pseudocode?
RANDOM_INT(x, y)