Noah's Paper 1 topics Flashcards

To learn all the paper one topics quicks Contents - Computational thinking - Search algorithms - Sorting algorithms - Data types - Operators - Constants and variables - Strings

1
Q

What are the three types of translators?

A

Compilers
Interpreters
Assemblers

Remember pneumonic CIA

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

What does an assembler do?

A

Assemblers are used to turn assembly language into machine code

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

What is an embedded system?

A

An embedded system is a computer built into another system for example in dishwashers TV’s and microwaves

They monitor and control machinery to achieve the desired result eg controlling the water pumps in the dishwasher.

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

What is the language used for embedded systems?

A

Assembly code

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

What are the two types of low-level language?

A

Machine code - harder for humans to read and write

Assembly code- easier for humans to read and write

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

What are the properties of Low-level languages?

A
  • One instruction of assembly code represents one instruction of machine code
  • Usually written for one type of machine or processor and won’t work on any others
  • The programmer has to know about the internal structure of the CPU
  • Code is very difficult to read, understand and modify
  • Commands in machine code can be executed directly and there is no need for a translator
  • You control exactly what the CPU does and how it uses its memory so programs will be more memory efficient and therefore faster
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the properties of High-level languages?

A
  • One instruction of high-level code represents many lines of low-level code
  • The same code will work for many different machines and processors
  • The programmer can easily store data in different structures without having to know the memory structure
  • Code is easy to read, understand and modify
  • Must be translated into machine code before a computer is able to understand it
  • You don’t have much control over the CPU actually does so programs will be less memory efficient and therefore slower
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What do trace tables help you to do?

A

Trace tables help you to find logic errors

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

Name something algorithms are tested for

A

They are tested for time efficiency

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

What are the two types of programming errors?

A

Syntax and logic

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

Define an algorithm

A

An algorithm is a set of instructions used to help carry out a task

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

What do you store lots of similar data in?

A

An array

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

Define a one-dimensional array

A

An array is a data structure that can store a group of data values, of the same type, under one name

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

Which brackets are used for arrays?

A

Square brackets

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

What would this print?

rowers = [John, James, Joe, Júan]
Output rowers [1]

A

James

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

What would this do to the array?

rowers[0] = “Joe”
Output rowers
rowers = [John, James, Joe, Júan]

A

rowers = [Joe, James, John, Júan]

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

Which element would be outputted from this array?

rowers = [John, James, Joe, Júan]
Output rowers[-1]

A

Júan

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

What is a two-dimensional array

A

They are like a list of lists

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

What would this output?

bordercrossers = [[‘júan’, ‘carlos’] , [‘sanchez’ ,’ diego’] , [‘jóse’, ‘ miguel’]
OUTPUT ‘the best chef is’ + bordercrossers[1][0]

A

Sanchez
Because the program calls the item that is number 1 in the array and then calls inside that list the item in 0 and prints that

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

What are the names of the boolean operators?

A

AND, OR, NOT

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

When are FOR loops used?

A

FOR loops are used when you know how many times you are going to run it

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

When are WHILE loops used?

A

WHILE loops are used when you don’t know how many times you are going to run it

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

What technique does Huffman coding use?

A

It uses the frequency of each data value

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

How much storage does one character in ASCII take-up?

A

1 byte

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

How does a binary SEARCH work?

A
  1. It finds the middle item in the ordered list
  2. If this is the correct item in the list it will stop the search
  3. If it is not the correct one and it comes before the middle item get rid of the second half of the list as it cannot be in there and vice versa
  4. You now have a list that is half the size of the original list. Repeat steps 1 and 3 until you find the correct item you are looking for
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

How does a linear SEARCH work?

A
  1. It looks at the first item in the list and if it is the correct item the search will stop
  2. If not, look at the next item in the list
  3. Repeat the steps until you find the item or you have checked every item and if you have not found it, it isn’t in there
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

How does a bubble SORT work?

A
  1. It first looks at the first two items in the list
  2. If they are in the correct order, you don’t have to do anything, if they are in the wrong order you need to swap them
  3. Move to the next pair of items (the 2nd and 3rd items) and repeat step 2
  4. Repeat step 3 until you get to the end of the list, this is called one pass. The last item will now be in the correct place so don’t include it in the next pass.
  5. Repeat all the steps until there are no swaps in a pass and that is how you know that it is ordered correctly
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

What are the pros of a bubble sort?

A
  • It is a simple algorithm that can be easily implemented on a computer
  • It’s an efficient way to check if a list is already in order. For a list of n items, you only have to do a pass of n-1 comparisons to check if the list is ordered or not
  • Doesn’t use very much memory as all the sorting is done using the original list
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

What are the cons of a bubble sort?

A
  • It’s an inefficient way to sort a list. For a list of n items, the worst-case scenario would involve you doing n(n-1) all divide by 2 comparisons.
  • Due to being inefficient, the bubble sort algorithm is pretty slow for a very large list of items
30
Q

What does a merge sort do?

A

A merge sort splits the list apart then merges it back together. The merge sorts it a divide and conquer algorithm. Shortlists are easier to sort than long lists. It’s easier to merge two ordered lists than two unordered lists.

31
Q

How does a merge sort work?

A
  1. Splits the list in half (the smaller lists are called sub-lists) - the second sublist should start at the middle item.
  2. Keep repeating step 1 on each sub-list until each list only contains one item
  3. Merge pairs of sub-lists so that each sub-list has twice as many items. Each time you merge a sub-lists, sort the items into the right order
  4. Repeat step 3 until you have merged all the sub-lists together
32
Q

What are the pros of a merge sort?

A
  • In general, it is much more efficient than bubble sorts for large lists and has a similar running time for shortlists.
  • It has a very consistent running time regardless of how ordered the items in the original lists are.
33
Q

What are the cons of a merge sort?

A
  • Even if the list is already sorted, it still goes through the whole splitting and merging process, so a bubble sort may be quicker in some cases
  • It uses more memory than the bubble sort because it has to create additional lists
34
Q

What are the 5 main data types used in programming?

A
Integers
Real (or float)(decimals))
Boolean
Character 
string
35
Q

What are the properties of integers and the storage they take up?

A

They are whole numbers only (2 bytes or 4 bytes)

36
Q

What are the properties of real/float and the storage they take up?

A

They always contain a decimal part (4 or 8 bytes)

37
Q

What are the properties of Boolean and the storage they take up?

A

Can only take two values, usually TRUE or FALSE (1 bit is needed but 1 byte is usually used)

38
Q

What are the properties of characters and the storage they take up?

A

A single letter, number or symbol (1 byte)

39
Q

What are the properties of strings and the storage they take up?

A

Used to represent text, it is a collection of characters (1 byte for every character in the string)

40
Q

True or false you can change from one data type to another?

A

True, programming languages usually have special functions to allow conversions between set data types

41
Q

What data type is “Cameron is shite at overwatch”?

A

String

42
Q

What data type is 9847.23123?

A

Real or float

43
Q

What are the types of comparison operator?

A

=(or==) - is equal to
<> or != - is not equal to
< - is less than
> - is more than

44
Q

What are the types of assignment operators?

A

= you just are basically adding a variable to a value

45
Q

What do many programming languages use for assignment and what do many use for comparisons?

A

”=” - to assign

“==” to compare

46
Q

What can data variables either be?

A

Data variables can either be constants or variables

47
Q

Define a constant

A

A constant is an assigned value at creation time and can’t be changed if you try to change it in the program the interpreter or compiler will give an error message

48
Q

Define a variable

A

A variable is a value that can be declared in the program and can change later on making it much more useful to programmers. You can’t change the data type of the variable only the value.

49
Q

In pseudo-code what does LEN(string) do?

A

It will return the length of the string for example

LEN(“Hello”) returns 5

50
Q

In pseudo-code what does POSITION (string, character) do?

A

Returns the position of the first occurrence of a certain character in a given string, for example

POSITION(“Hello” ,”o” ) returns 4

51
Q

In pseudo-code what does SUBSTRING (x, y, string) do?

A

It extracts a substring from the original string at starting position x and finishing at point y. For example

SUBSTRING(0,3,”hello”) returns “hell”

52
Q

What will this pseudo code output?

a ← 1
WHILE a < 4
 OUTPUT a
 a ← a + 1
ENDWHILE
A

This will output 1,2,3

53
Q

What will this pseudo code output?

FOR a ← 1 TO 3
OUTPUT a
ENDFOR

A

This will output 1,2,3

54
Q

What will this pseudo code do?

a ← 1
IF (a MOD 2) = 0
THEN
 OUTPUT 'even'
ENDIF
A

MOD in pseudo-code means to print the remainder from dividing the first number by the second. The remainder from this equation would not equal 0 so it would not output ‘even’.

55
Q

What will this pseudo code do?

a ← 1
IF (a MOD 2) = 0
THEN
 OUTPUT 'even'
ELSE
 OUTPUT 'odd'
ENDIF
A

MOD in pseudo-code means to print the remainder from dividing the first number by the second. The remainder from this equation would not equal 0 so it would not output ‘even’ and as it is using else it would print ‘odd’.

56
Q

Define colour depth

A

Colour depth is the number of bits used for each pixel

57
Q

What is image resolution

A

The image resolution is the number of pixels in the image.
The more pixels an image has, the better quality it is.
It is sometimes given as the width x height

58
Q

What’s the formula to work out file size (in bits)?

A

File size(in bits) = image resolution x colour depth
or
width x height x colour depth

59
Q

How is sound stored?

A

Sound is sampled and stored digitally

60
Q

How is sound recorded and what type of sound is it when recorded?

A

It is recorded with a microphone as an anologue signal

61
Q

What are the two different types of sound?

A

Analogue - How it is recorded ( continually changing data)

Digital - How it is stored

62
Q

What is the process of converting analogue signal to digital signal called?

A

Sampling

We sample at regular intervals

63
Q

What shape are anologue signals and digital signals stored in?

A

Anologue signals are continuous waves whereas digital data is stored in blocks of data. It’s about the same shape as the anologue data however, it has lost a lot of data.

64
Q

How often is an audio track sampled?

A

Every few milliseconds

65
Q

How can the quality of an audio track be improved?

A

By taking samples more often

66
Q

What is sample rate measured in?

A

Hertz or kilohertz

eg. 44100 samples per second = 44100 Hz

67
Q

What is sample resolution?

A

Sample resolution is the number of bits available for each sample. It’s the sound equivalent of colour depth - the number of bits used for each ‘piece’ of data in the file

68
Q

How do you calculate the size of an audio file?

A

File size (in bits) = Sample rate (in hertz) x sample resolution x length (in secs)

69
Q

What happens if you increase the sample rate?

A

The track will be better quality and closer to the original recording however will take up more storage

70
Q

What happens if you increase the sample resolution?

A

If you increase the sample resolution, the digital file will pick up quieter sounds even if they are at the same time as loud ones. This will also make a track that is closer to the original recording.

71
Q

What does
FOR i = 1 TO 100 STEP 2
do in pseudo-code

A

This would go through and stop at every 2 so 2,4,6,8 and skip the others.