Data types and Data Structure

Description

F452 - Programming Techniques and Logical Methods
JoeBland
Flashcards by JoeBland, updated more than 1 year ago
JoeBland
Created by JoeBland over 9 years ago
10
1

Resource summary

Question Answer
Definition of a data type. A data type is a formal description of the kind of data used in a computer program. How an item of data is stored and manipulated in the computer depends on its data type. This is why it is important to clearly define the data type of any items of data you use in a program.
Declaring a variable. Exactly how a variable is declared will vary from language to language, but usually you will need to state: • an identifier (name) for the variable • the data type of the variable.
Two types of numeric data types. • Integer • Real
Integer numeric data type. • Used to store whole numbers • Typical size: 2 - 4 bytes
Real numeric data type. • Used to store numbers that may have a decimal point • Typical size: 4 - 8 bytes
Definition of an alphanumeric data type. Alphanumeric data types are used to store textual data. They are used to store characters, digits and punctuation symbols.
Definition of Boolean. • Boolean data is data that can only have two values. • The two possible values are often referred to as TRUE and FALSE. They are also sometimes referred to as 1 (TRUE) and O(False) or YES and NO.
Definition of a data structure. • Data structures allow us to store more than one item of data together under one identifier (name) which can then be used to access the individual items of data if necessary.
Advantages of using an array over using separate variables. • You declare all the elements in one statement. If the number of elements changes, all you need to do is change the bounds of the array in the declaration. • Because the array contains similar data, you can use a loop to perform similar operations on all elements of the array.
Two-dimensional arrays. A two-dimensional array called ‘A’ can be represented in a table, such as the one shown here:
How would you reference the value 25? 41
Advantages of using and array rather than separate variables in this implementation. • Code is easier to manage ... as there are fewer variables • Can use iteration (to count up the votes)/looping ... instead of dealing with each vote separately • Code will be more easily scaleable/they can easily change the number of voters ... by changing the size of the array
Definition of an array • A data structure/contains several data items ...of the same data type ... grouped under one identifier • Individual items are accessed using an index • Stored contiguously in computer memory
Definition of a serial file. Serial files are files in which records are stored in the order in which they were entered. New records are always added at the end of such files.
Features of a serial file. • Such files are only searchable by going through the records one by one starting from the beginning and finishing at the end. In a file with 1,000 records, searching for a particular record will involve checking 500 records on average. • This isn't terribly efficient or quick.
Definition of sequential files. Sequential files are files in which records are stored according to some key field, perhaps alphabetically. Such files can be searched quickly and efficiently using a simple binary search.
Definition of an Indexed sequential file. Indexed sequential files are files in which records are stored according to some key field and where one or more indexes have been created to make searching even more efficient.
Definition of a random file. Random files are files in which records have been placed in the file according to some mathematical hash algorithm.
Show full summary Hide full summary

Similar

Chemistry Facts
beth2384
Germany 1918-45
paul giannini
Spanish - Clothing
riana_rabadia
GCSE Sociology-Crime and Deviance
aiysha
English Language Key Terms
emilyralphs
GCSE Chemistry - module c4
jessmitchell
Advantages and Disadvantages of Parliamentary Law making
Sinead Gapp
OCR AS Biology F211 Transport in plants.
Megan Vann
Fraction, Decimal and Percentage calculations.
Georgie Hatchman
PHR Sample Questions
Elizabeth Rogers8284