Chapter 3 Data Types and Structures Flashcards
What is a data type?
A data type is the type of data that is used in the program. The way in which the data is manipulated will depend on the data type.
What is declared at the start of the program alongside a variable?
An identifier and a data type.
What are the 3 main data types?
Numeric, alpha-numeric and boolean.
What two types of numeric data types are there?
Integer and Real.
What two types of alpha-numeric data types are there?
String and Character
What kind of answer does a boolean have?
TRUE/FALSE or YES/NO
What kind of numbers can an integer be?
Whole
Can a real value have a decimal value?
Yes
What does a boolean do?
It can only have two values and is often used to see if a condition has occurred or a value has been met.
How many digits does a character normally have?
One
Which data type is used for longer pieces of text?
A String
What are the two data structures?
Arrays and Records.
What is an Array?
An array is a piece of data that contains several pieces of similar data.
What is meant by an element of an array?
Elements of an array are pieces of data with the same data type, similar memory size and are usually stored next to each other.
What orders the elements?
The index.
What are the bounds of the index?
The highest and lowest values.
Why does using an array help when declaring the data?
You can declare all the statements using the array by using one statement.
What is a record?
A record is used to store several data types under one identifier.
What is the name given to individual values in a record?
A field.
In which file types will removing a piece of data leave a gap?
Serial, Sequential and Indexed Sequential.
What is the difference between a sequential file and an indexed sequential file?
An indexed sequential file has a index.
What is the formula for finding a record in a direct access file?
Address of record number (n)=Beginning of file + (n-1) * size of record.
What are the 4 steps in estimating a file size?
- Work out the size of each field in the record in bytes.
- Add field sizes together to get the size of one record.
- Multiply the size of one record by the number of records in the file.
- Add 10% to accommodate for the extra storage needed to manage the file.
How do you change from bytes to kilobytes?
Divide by 1000.
Why don’t you divide by 1024?
Because it is only an estimate.