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
What are the three types of translators?
Compilers
Interpreters
Assemblers
Remember pneumonic CIA
What does an assembler do?
Assemblers are used to turn assembly language into machine code
What is an embedded system?
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.
What is the language used for embedded systems?
Assembly code
What are the two types of low-level language?
Machine code - harder for humans to read and write
Assembly code- easier for humans to read and write
What are the properties of Low-level languages?
- 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
What are the properties of High-level languages?
- 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
What do trace tables help you to do?
Trace tables help you to find logic errors
Name something algorithms are tested for
They are tested for time efficiency
What are the two types of programming errors?
Syntax and logic
Define an algorithm
An algorithm is a set of instructions used to help carry out a task
What do you store lots of similar data in?
An array
Define a one-dimensional array
An array is a data structure that can store a group of data values, of the same type, under one name
Which brackets are used for arrays?
Square brackets
What would this print?
rowers = [John, James, Joe, Júan]
Output rowers [1]
James
What would this do to the array?
rowers[0] = “Joe”
Output rowers
rowers = [John, James, Joe, Júan]
rowers = [Joe, James, John, Júan]
Which element would be outputted from this array?
rowers = [John, James, Joe, Júan]
Output rowers[-1]
Júan
What is a two-dimensional array
They are like a list of lists
What would this output?
bordercrossers = [[‘júan’, ‘carlos’] , [‘sanchez’ ,’ diego’] , [‘jóse’, ‘ miguel’]
OUTPUT ‘the best chef is’ + bordercrossers[1][0]
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
What are the names of the boolean operators?
AND, OR, NOT
When are FOR loops used?
FOR loops are used when you know how many times you are going to run it
When are WHILE loops used?
WHILE loops are used when you don’t know how many times you are going to run it
What technique does Huffman coding use?
It uses the frequency of each data value
How much storage does one character in ASCII take-up?
1 byte
How does a binary SEARCH work?
- It finds the middle item in the ordered list
- If this is the correct item in the list it will stop the search
- 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
- 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 does a linear SEARCH work?
- It looks at the first item in the list and if it is the correct item the search will stop
- If not, look at the next item in the list
- 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 does a bubble SORT work?
- It first looks at the first two items in the list
- 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
- Move to the next pair of items (the 2nd and 3rd items) and repeat step 2
- 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.
- Repeat all the steps until there are no swaps in a pass and that is how you know that it is ordered correctly
What are the pros of a bubble sort?
- 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