click below
click below
Normal Size Small Size show me how
Computer Science
Paper 2
| Question | Answer |
|---|---|
| What is decomposition? | Breaking a problem down in to smaller more manageable problems |
| What is abstraction? | The process of removing unnecessary detail from a problem |
| What is algorithmic thinking? | The ability to create a set of instructions to find the solution to a problem |
| What is pattern recognition? | The process of identifying similarities or recurring features in problems and solutions |
| What is pseudo code aka exam ref lang? | Almost like english but in code form |
| What does a parallelogram represent in a flow chart? | Input/Output |
| What does a rectangle represent in a flow chart? | Process |
| What does a diamond represent in a flow chart? | Decision |
| What does a oval represent in a flow chart? | Start/End |
| What does a rectangle with lines represent in a flow chart? | Sub program |
| What is a syntax error? | Breaks rules of language, it won't run. |
| What is a logic error? | Code runs but produces the wrong result |
| How does Linear search work? | Starts at first item and checks each one until target is found |
| Give 2 characteristics of linear search. | Easy to implement and works on both sorted and unsorted. |
| If we are searching for a number and it appears at the 5th index, what will it output? | 4, arrays start at 0 |
| If the target didn't exist in a linear search, what 2 things could it output? | -1 or appropriate message |
| How does Binary search work? (4) | List must be sorted, finds middle value, removes half that doesn't contain number, repeats until found |
| Give a characteristic for Binary search. | Faster than Linear search for large sorted lists |
| How does Bubble Sort work? | Compares 2 items next to each other and swaps into order, will go through multiple passes with one less comparison each time |
| What is one good thing and bad thing about Bubble sort? | It's easy to implement but can take a long time for reverse lists or large lists |
| How does merge sort work? | Splits list in half until they are all individual, merges sub lists back in the correct order, merging one by one |
| How does insertion sort work? | Starts at second number and sorts immediately into correct place and then goes to the next number and so on |
| What does this symbol represent % and what does it do? | MOD or Modulus, returns remainder |
| What does this symbol represent / / and what does it do? | DIV and returns the full number without the remainder |
| What does this symbol represent ^ and what does it do? | Exponentiation, means to the power of |
| What does the NOT operator do? | Returns opposite boolean value |
| What does the AND operator do? | Returns True only if both conditions are True |
| What does the OR operator do? | Returns True if just one condition is True |
| What is sequence? | Instructions executed in order |
| Give 2 examples of selection. | IF, ELSE |
| Give 2 examples of iteration. | WHILE, FOR |
| Give an example of casting an integer to a string. | number=str(123) |
| How do you find a length of a variable called "name" | name.length() |
| If a variable called "hello" contained "hi world", how would I get "hi" from it? | hello.subString(0,2) |
| How do you join 2 strings together? | "Hello" + " World" |
| How do you write to a file? Variable "myFile" and the file called "sample.txt" and write the line "Goodbye!" | myFile=openWrite("sample.txt") myFile.writeLine("Goodbye!") myFile.close() |
| How do you read a file? Variable "myFile" and the file called "sample.txt" and read the line "x" | myFile=openRead("sample.txt") x=myFile.readLine() print(x) myFile.close() |
| Give an example of a 2D array under a variable called Alphabet. | Alphabet = [ ["A", "B"], ["C", "D"] ] |
| How could I access the letter B in this 2D array? | Alphabet[0][1] |
| In SQL, what do you write in the SELECT, FROM and WHERE commands? | Select= Field From= Tablename Where= Condition |
| For SELECT what is the wildcard symbol and what does it mean? | * and it selects every field |
| Perform a function to find the speed of distance 100 and time 50, and call the function speed, the variable to be returned s and for the main part, userDistance, userTime and userSpeed. | def speed(distance,time): s=(distance/time) return s userDistance=int(input("Enter distance")) userTime=int(input("Enter time")) userSpeed=speed(userDistance,userTime) print(userSpeed) |
| Using a variable called num, how could I get a random number between 0 to 6 | import random num=random.randint(0,6) print(num) |
| What is authentication? | The process of determining the identity of a user usually through a username and password |
| What is the role of a presence check? | Insures data added is not empty |
| What is the role of a range check? | Ensures input fits within a required range e.g(if num>=10: print("too large")) |
| What is the role of a length check? | Ensures a certain number of characters has been entered |
| If a range was 1-10 what would an example of a Normal test be? | 5 |
| If a range was 1-10 what would an example of a Boundary test be? (2) | 10 or 1 |
| If a range was 1-10 what would an example of an Erronous test be? (3) | -1, "eleven" "abc" |
| For the AND boolean logic, what is the algebra symbol? | ∧ |
| For the OR boolean logic, what is the algebra symbol? | ∨ |
| For the NOT boolean logic, what is the algebra symbol? | ¬ |
| For AND, what does the symbol look like? | Thumbnail, 2 inputs and 1 output |
| For OR, what does the symbol look like? | Arrowhead, 2 inputs and 1 output |
| For NOT, what does the symbol look like? | Triangle, 1 input and 1 output and circle at beginning of output |
| Give one advantage of high level languages. | Easy for humans to understand and debug |
| Give one disadvantage of high level languages. | Slower to execute than low-level languages |
| Give one advantage of low level languages. | Faster and more efficient to execute |
| Give one disadvantage of low level languages. | Harder to read and write |
| What type of code can computers only understand and hence what would need to happen? | Machine code - Translators would have to translate high-level code |
| What can a compiler and interpreter be used for? | Translate high level programs into machine code |
| What are the 2 steps a compiler does? | Checks for any errors line by line and then translates the entire program at once |
| What happens in a compiler if the source code contains an error? | It will not be translated |
| What steps does an interpreter take? | Translation begins immediately and checks for errors as it's translating |
| For interpreters what is the rule when it's executed? | Both the source code and the interpreter must be present |
| Give 3 features IDEs have. | Auto-indentation, Debugging tools and Interpreters |
| What do editors to? | Provide the platform for programmers to write and develop code |
| What do run-time environments allow? | Programs to be run that can't be run on the actual computers e.g Virtual Machines |
| What do Error diagnostics do? | Help identify the errors when writing code, they can point out the line number or highlight |