Paper 1 Unit 2 Flashcards

1
Q

Name different data types

A

String, integer, float, boolean, character

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is an identifier?

A

The name given to a data structure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a list?

A

An ordered set of data using a single identifier and an index to identify a data item

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is an index?

A

The position of a value in a list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Define what is meant by a scope

A

The extent to which a variable can be seen by the different parts of a program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is an array?

A

A data structure using a single identifier and multiple indices to identify a data item

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is global variable?

A

A variable declared in the main body of a program and visible to all parts of the program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a local variable?

A

A variable declared within and used only within a sub-program, it is not visible outside the sub-program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What must be done before a text file can be used?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How is sequence used in programming?

A

An ordered list of instructions and must be followed step by step (like ordinary code)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How is selection used in programming?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How is iteration used in programming?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which is better to use and why? A binary search or a linear search

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Evaluate the use of a bubble sort

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Evaluate the use of an insertion sort

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Evaluate the use of a merge sort

A

Benefits: good with large sets of data. Drawbacks: has more space requirements than other methods and is not very efficient

17
Q

Evaluate the use of built in functions

A

Benefits of using built-in functions: thoroughly tested and widely used, reliable, saves time, reduces cost, optimised efficiency. Drawbacks: not specific to task and may have compromises to work around, difficult to modify, compatibility issues may mean it cannot be used in the program so it may then have to be coded from scratch

18
Q

What different types of validation checks can be done? Give a definition of each.

A

Presence check- checks if data has been supplied. Length check- checks the correct number of characters have been entered. Type check- checks the correct data type has been supplied. Format check- checks that data inputted matches the format required. Range check- checks the value is within an acceptable range. Check digit- calculation to ensure that when a number is read, transmitted or copied, the number has not been changed.

19
Q

How can code be made maintainable?

A

Use indents, comments, modular code, format the code to make it easier to read