Paper 1 Unit 2 Flashcards
Name different data types
String, integer, float, boolean, character
What is an identifier?
The name given to a data structure
What is a list?
An ordered set of data using a single identifier and an index to identify a data item
What is an index?
The position of a value in a list
Define what is meant by a scope
The extent to which a variable can be seen by the different parts of a program
What is an array?
A data structure using a single identifier and multiple indices to identify a data item
What is global variable?
A variable declared in the main body of a program and visible to all parts of the program
What is a local variable?
A variable declared within and used only within a sub-program, it is not visible outside the sub-program
What must be done before a text file can be used?
If the file does not already exist it must be created, it must be opened before writing, data must be written to the file, the file must be closed before data can have been written to the file
How is sequence used in programming?
An ordered list of instructions and must be followed step by step (like ordinary code)
How is selection used in programming?
The path a program will follow will be determined by a condition. An if statement is used to decide which path a program will follow
How is iteration used in programming?
A section of code is repeated for a set number of times, until a condition is met or while a condition is true. For and while loops can be used to make a program repeat itself
Which is better to use and why? A binary search or a linear search
A binary search is better as it is much quicker than a linear search especially for bigger lists. However it can only be used on a sorted list whereas a linear search can be used on an unsorted list
Evaluate the use of a bubble sort
Benefits: straightforward to implement, space requirements are minimal. Drawbacks: not good with large numbers of items, lots of processing required for each item in the data set
Evaluate the use of an insertion sort
Benefits: straightforward to implement, good with small quantities of data, minimal space requirements. Drawbacks: not good with large number of items, does not perform as well as other methods, lots of processing required for each item in the data set