Transcript for:
AQA GCSE Computer Science Paper Overview

hi welcome to a video which I'm aiming at people who are about to walk into AQA dcse computer science paper one maybe tomorrow maybe later today I'm going to give an overview of as much as I can of paper one in half an hour and it will be useful I hope as that last minute go before you walk in if you happen to have more time than half an hour maybe you're a few days away maybe your weeks or months away from your exam do something else I've got a playlist which covers this in more detail I've got other useful videos which I'll link below but if you are about to do this exam it's a bit longer than paper two it is our programming paper and you'll have a paper in one of these three languages this video I'm not going to show any python code or c-sharp code or Visual Basic code because I don't want to model you if you're doing a different programming language I'm just going to show pseudo code but you have got to go in knowing the pseudocode concepts and the different terms in one of these three languages this paper isn't just about practical programming though you have good revised for Content which is what we're going to do in this video starting with algorithms so an algorithm is a sequence of steps that can be followed to complete a task when we are writing program code we are implementing an algorithm and perhaps before we do that we can also represent algorithms into other ways now pseudocode is this fairly relaxed version of program code which should be understood by any programmer AQA have come up with their own version of pseudocode now all of us can write our own pseudocode in different ways but AQA will have a fairly typical fairly recognizable version flowcharts there are I would say free symbols which are the most fundamental ones start and end will either start or end your algorithm a process box your what is a rectangle you'll write inside the rectangle what is going on maybe you are doing some maths maybe you are assigning a variable input and output could be done in process or you could do it in a parallelogram and a choice is for if statements and also for Loops a loop will go back on itself and if statement will just have yes or no again write a question inside the choice Diamond to say what it's doing now algorithms are said to be abstract abstraction is the process of removing unnecessary detail from a problem it's a way of simplifying a problem but also usually and if you are a good programmer your utilize decomposition this is a novice or problem solving technique because and I've weighed simplified problems what this will do is break a problem down into many sub problems that each represent a specific task so ideally each subprogram does just one job and if you solved it you'd eventually be able to combine all of these solutions to solve the original problem Trace tables are there to show how values change when an algorithm is carried out importantly you've got to go through every line so you're tracing through the code line by line do not jump ahead do not guess what it's doing and only add to a column when that column's value changes when you move on to a new row in your Trace table do that when you move into a new Block in the code a row in the trace table does not correspond to a line of code you might have four lines of code represented in one row in a trace table so don't worry about gaps gaps are perfectly fine and if you have got very few gaps that's also often fine as well so um here is an example bit of code you might have given you might want to pause and have quick look for it if you want to now here we've got user input being given and so often the question will give you some values so don't just jump to the code read the question carefully in case it tells you things like the values being putted now let's say we're given a blank Trace table like this one it will usually pick for columns for you it may not represent every variable being used it can also be items in a list it can also be outputs so print statements which displays something to the user well your job is to fill in this if you were given this question and the first step is the first three lines of code have got three variables num is set to zero X is 999 and Y zero because they're within one block of code and the order within this isn't important putting it in one row of a trace table is perfectly fine but when you move into the for Loop we haven't got a choice because we've not got not got any space if you have got move into a new line because it's a new block of code so if our first input is three five five three five five is less than x and so we set X actually y as well to be no now again you could put the second 355 on the line below because it's in an if statement below the top if statement but again personally I'd put it on the same right and we can progress through the code 554 is the next input only this is bigger than y and so y gets updated 199 this is less than the current value of x and so X changes we're left with a gap because nothing happened to X in that section and so we should really leave a gap to show the sequence of this if we plugged in 199 above it would suggest that was changed at the same time y was changed which it wasn't and so some gaps are important for showing the sequence let's just progress on to get the last two values so outside before you put outputting X and Y and so putting that on its own line makes sense now a common follow-up question following a trace table is well what is this code doing and you might be able to spot from the trace table what it's doing if it's confusing we're here with finding the smallest and biggest item in this sequence equally might be a logic error which asks you to try and spot and the trace table might help you with this we've got two searching algorithms on this paper linear search and binary search a searching algorithm is there to find an item or to see if an item is in a group of items linear search is our simplest linear search will compare each item in the list one by one and until the target item is found or equally not found now crucially there's no need for the list to be in order to do a linear search let's say we're looking for -10 in this list what linear search would do start looking at 15 then 17 then 19 then 5 then -10 Compares each to our Target minus 10 is equal to -10 and so this finishes binary search is a little bit of a more clever approach what binary search does is compare the middle item in the list to the Target and assuming the target is not the same as a middle item it will discard half of the list which can't have the Target in then it will repeat this essentially finally the next middle item in that smaller version of the list and repeats until either you find the Target or it runs out of items now this must be sorted so here's the same version of that list sorted meaning it's got an order now and let's say we're looking for five in this list this time first job is to find that middle item also called the midpoint also the pivot in this case it's 17 if you have an even numbered list and you've got you can't find a perfect middle choose either the left of center or right of Center just be consistent in this case 5 is less than 17 and so we can discard you might just cross out the top half of this list the next middle happens to be five what a coincidence and so we found our Target and it's finished regarding how they compare linear and binary search binary search is more time efficient for linear search meaning as the list grows big it will on average take less time to find your item but the key downside is it's got to be ordered beforehand not all data is ordered and surf is unordered and you can't sort it quickly The Intercept is really your only option but two sorting algorithms are a little bit more involved and I would argue if you get visas questions can take a bit more time bubble sort is a bit of an awkward one to do because what you do is go through the list in what's known as a pass and you look at each pair swapping those pairs to put it into order right sorting algorithms put it into order you can have it with letters you can have it with numbers so once you finish the pass you repeat going back to the start going through again and you repeat this whole process until you have a pass happening with no swaps if you go through entire list and don't swap anything it must be sorted Let's do an example on a very simple alphabetical list well Bob assault would start on his list in our first pass I would write this out in your workings out and I would copy the list and personally Circle each pair as you go A and C are in order so they're left C and B are not in order and so I would copy the list down again and swap these two and circle them to show that you're looking at those two the next two are CNE which are fine so now we look at e and D which are out of order and so I would swap those and that is one complete pass so you've gone from the start you've got to the end and then Bob is sort of the last item after each pass will be sorted if the question is mean you might have several passes to do actually here I've designed it so I've only got one more and this final pass has got to be it going through making no swaps okay don't forget to do a final pass but it doesn't make any swaps you could still write out fully I haven't here um but you could the way it merge so it works is first of all it keeps dividing the list by two halving it until each list has one item only so if I use the same list I keep dividing that list by two and you'd write it down like this if you've not got a clean divide that's fine you might have an uneven number of items on each side that's fine just keep dividing until you have one item only in these little mini lists then my second step is to start to combine these lists two at a time keeping the items in order so let's now do this in descending order so going the opposite way around so CNA would get combined like that we've got this sort of awkward triplet on the side so just do it step by step you've got to kind of leave D on its own for a second um but then combine those in the next step so the final step will be combine these two sub lists to give us our descending version of the list okay so we're splitting then merging that's how merge sort works and motor is a lot more time efficient for mobile sorts it's much quicker on average especially as the list grows big but because of all these sub lists it does use more memory overall moving on out to the programming side of things starting with data types so those type determines how data is stored on a computer and the operations it can do now there are five ones you've got to know about they may vary a little bit depending on your particular language just on that point for everything I'm going to show in the next few minutes in fact the rest of the video really make sure you know the equivalent in your programming language because there's one thing knowing AQA pseudocode and another thing knowing how to actually implement it yourself so I won't comment on all of these all I'd say about characters and strings is we know it is a character or a string because they've got either single or double quotes around it here I would say the most important arithmetic operators to memorize so just on div and mod because they're slightly Harder real division is just normal Division and it's a forward slash so 15 divided by 2 is 7.5 whereas div is making the result an integer so it cuts off that fractional part so 15 div 2 would just be seven and mods short for modulus or modulo gives us the remainder from a division so 2 goes into fifteen seven whole times with one left over which is why 15 mod 2 is one you'll use the relational and Boolean operators in your condition with if statements and while Loops now all I'd point out is in AQA Studio code one equal sign is how you do equal to whereas in something like python you do two equal signs for a comparison and here's an example of how you might use it with and and or so with and both sides need to be true and with or only one side needs to be true for the entire condition to be true and there are a few different string handling operations for two to have in your head as you go in I would say are substring and concatenation substring is giving you part of the string and they represent this using a subroutine where you give the start index the end index and the actual string you're just getting part of so concatenation is adding two strings together just a plus but both sides have got to be a string now there are also definitions for variables but one I like to go for is this so variable is an identifier that holds a value that can be changed and identify is just a name we give something so we give variables identifiers we also give so subroutines identifiers so here I've got a variable called variable the identify is variable you must have identify on the left hand side and the actual value on the right hand side and we can we can change it we can reassign it in the next line and that's perfectly fine whereas a constant is also an identifier which holds a value but it can't be changed after we set it and in pseudocode we'll start with something like constant and usually we put constants in uppercase letters arrows show variable assignment an equal sign is a is a test for equality like we just saw but an arrow assigns a value and saying it's a constant is an example of Declaration declaration is setting a certain property you might declare a variable AS Global for example but equally might declare a constant not every language has constants so why should they be used well first of all they help readability having pi as a named constant means it's a little bit clearer what's going on you know what that value is and also that second point it makes updating then in the future easier now Pi won't change but I have a common constants like tax rate or capacity those things might change in the future and so if you have as a constant you just change the value at the very top and it will apply throughout your entire code and finally because they just cannot be changed you might get an error if you try to change it this reduces the risk of accidental changes but having a constant locks in that value and so it can't be changed now for input and output like all of this make sure you can do this in your own language this is how AQA will show it just bear in mind that user input is always a string so if you are writing program code don't forget to convert it over an integer or real if you are about to do maths operations on it and we have what's sometimes called free fundamental programming constructs sequence selection and iteration sequences are simplest sequence is shown on this slide essentially a sequence Block in programming is where you have two or more lines which run just one by one whereas selection will deviate the path will deviate depending on a condition if statements are how we Implement selection in most of our languages so if statements the main headline bit is the actual F part of your statement so one thing to bear in mind is if it's always checked if you've got an if part this will always be checked no matter if you have several back to back so here we've got if price is greater than 30 and if price is greater than or equal to 20 if I had price set to be 50 both premium and standard would be outputted because both are checked whereas we often have else ifs or e-lifts which sit below and if statement the Visa only checked if previous conditions were false you can have several lcps if you want to just make sure they come after NF in this case if I typed in 50 again only premium would get outputted because the OSF wouldn't run and finally we can often stick an else on these else have no conditions so nothing comes after else and they only run if all of the previous parts to this statement were false mistakes we see in exams are people adding conditions to else's and also forgetting about else if and it can lead to logic here as if code runs when it shouldn't really be running iteration is our first kind of construct and these are the loops and we've got two types of Loops two types of iteration definite and indefinite so for one type of loop which is implementing definite iteration is a for Loop so a for Loop repeats a set number of times and that's what definite iteration is you know how many times it's going to repeat before the loop begins visit our 40 blocks in pseudocode it looks similar in your program code so in AQA sudo code you will start with your counter variable so it's often I it will start at whatever number you set set it to at the start and it'll keep going to whatever number you set it to at the end now in AQA pseudocode that upper number is included so this code would produce zero to five probably on separate lines actually but that second number is included whereas in Python actually that second number is not included use a for Loop when you're going a set number of times if you're not sure how many times to repeat use indefinite iteration and we've got two types of loop which implements this a while loop repeats until a condition is broken and a repeat until Loop repeats until a condition is met so they're sort of coming at it from different angles here's an example of a while loop with a password program so initially ask the user for a password and while this password is not equal to one two three it's going to keep asking for the password once they type in one two three the loop is going to end now if you get it right first time they might get it wrong a million times so you can't use a for Loop here because you don't know how many times this is going to repeat here is a repeat until Loop and you can kind of see two differences first of all the first difference is what I said in this definition that it repeats until a condition is met so here for condition password equals one two three is opposite to the while loop but the second key difference is the condition comes after The Loop say repeat until Loop always runs at least once and so you don't need to have that kind of outer input line like you do with a while loop there are two data structures to know about a data structure is an organized collection of items by far the most commonly used one is an array so an array will tip typically just contain items of the same data type so this first line here scores is set to then these items are part of this array and we use square brackets to signal that it is an array and you can see all of these are integers so you group multiple items under one name this is quite efficient it means you can do things like indexing now indexing is where you are specifying a particular item within an array so this second line where I'm going output scores index 2. without specifying the number 92 here because you need to assume that indexing starts counting at zero unless you are told otherwise so three is in the zeroth position 53 is in the first position 92 is in our second position despite being the third item it's always start counting from zero and you always use square brackets to index you can also you know overwrite items like I've done in this third line This is changing 13 to be now five now because we're using arrays to group similar items often we want to iterate through these items and you should be using a for Loop for this process and the for Loop will always look very similar so we start counting at zero because of our first item having the index zero most often and we end size of our array minus one it's -1 in pseudocodes at least because we start counting at zero then you just output it by indexing using I as your variable and if I run this having changed index 4 to B5 it'll just show the items like this now I always can get a tiny bit more complicated because you can have 2D arrays as well which I think scare people quite a lot sometimes but really in a way which is 2D is just an array of arrays so you've got mini arrays inside a bigger array so if you've got two sets of square brackets that's a sign you've got a 2d array and it's not too much more complicated because all you need to do is use a second index number now it does get a bit more complicated when you are wanting to iterate for it admittedly this looks a bit nastier than the previous for loop I showed but a game of structure is always very very similar so if you are asked to iterate through a 2d array it will look something on these lines so it's a four leap inside another for Loop and if you look at this middle Line's output scores index I index J that's what I mean when I say you index using two numbers okay the first number is the sort of which array is it so if I was zero here that's referring to the 3 and 53 array whereas if I was one that's referring to the 92 4013 array the second number kind of Dives deeper and goes inside for particular over you're looking at so if you can learn this structure that would be useful and this would again just print out all the numbers so you get all of them now just as a quick bit of Technology here we've got a for Loop inside another for Loop this is an example of nesting nesting is where you just have one block inside another block so if you've got say an if statement inside a while loop that's also an example of nesting the second Aid structure Which is less common but just to be aware of and don't get thrown by it if you see it are records so record instead of using index numbers we use name fields to organize the items so here's how you might set up a record with two Fields name is a field age is a field and you give it a data type in this definition now this isn't the actual structure itself you need to actually create the data structure for this record so I'm setting user as my record and I'm setting AJ to be the name and 16 to be the age so those are the values for my Fields then I can just use these field names instead of indexing it to get for particular values so user.age in this case would be 16. moving on to subroutines so subroutines are named out of line blocks of code here is an example subroutine it's a block of code and it has a name so add is the name in this particular subroutine and out of line refers to the fact that often we Define these right at the top of our program and to actually run it you have to call it so cooling it is just saying its name in your main program so if I extend this code to call the subroutine well output welcome is just saying welcome but saying add 10 comma 15 this is me calling for subroutine what it means is it will jump up and run the subroutine code when I run this entire program it'll just say welcome from that welcome line and then it will say 25 because 10 plus 15 is 25 and that is what this subroutine is doing so num1 becomes 10 num2 becomes 15 and it's going well num1 plus num2 so 10 plus 15 is 25 then it's going to Output 25 and so that's why I see it on my screen so it jumps up and what we call the parameters are the placeholders for the actual values I put in at the bottom now the actual values are sometimes called the arguments but if you described 10 and 15 as parameters that would be okay you can have one parameter you can have two you can have five you can have ten you can have zero so if you've got empty brackets that means you don't put any numbers in you've got no parameters and parameters are just special kind of variables used for input to subroutines now the reason we use subroutines is because they can be easily reused all you need to do is Define the code once and to reuse it again and again you just call it with one line so you've got less repeated code which leads to a few mistakes you writing the same codes again and again it leads to mistakes and errors and also programs are easier to test if you've got nice blocks of code which you can look at individually and just as a general principle if you are decomposing into subroutines this makes it just easier to code because you're solving simpler problems at a time and it's especially useful in a team because separate team members could program separate subroutines and they don't really affect each other so parameters are one bit of Technology with what to know about we've also got a few others so as you may have spotted that the code is morphed and I've now got a return line instead of an output line so this is what we call a return value you might hear these described as functions whereas what we had before is called a procedure sometimes so now I've got a return value this does slightly change how I call because a return value is sort of given back to your main code privately it's not shown to the user and so what I've done here is I've assigned this return value to a variable called result and then output to the result in the next line so I still get welcome 25 shown it's just done in a slightly different way okay so if you've got a return value make sure you actually assign it to a variable in your main program and then print that if you need to print it so we've got several variables in this code number two are like I say special kind of variables called parameters they're kind of separate but we've got some and we've got results which are two standard variables for differences sum is an example of a local variable whereas result is an example of a global variable a local variable is assigned inside a subroutine whereas a global one is assigned outside of it local variables only exist while subroutine is executing as soon as ADD finishes some ceases to exist it's not around anymore and so because of Israeli they're only accessible only available inside the subroutine I couldn't print or output some after ad is finished because it doesn't exist anymore which global variables are available anywhere in your code now there is a programming style which is very much connected to this called structured programming this is an approach which produces or is trying to produce readable so clear programs and organize programs by doing a few different things first of all this approach recommends you do use decomposition and you decompose problems into modules a module being a block of code and in essence this is saying look make subroutines because they're nice individual blocks other aspects are you need to be using clear parameters so you're recommended to use parameters and also recommended to use return values sometimes for parameters and the returns because they're the input and output to a subroutine they're sometimes called the interface of the subroutine a more simple one is use of meaningful names so making sure things like add and sum and results are sensible are meaningful and the big one is trying to minimize use of global variables so actually you having loads of global variables is not a great thing to do if you've got Global variables because they are available throughout the entire program their name the identifier can't be easily reused write words like sum and results could be used lots of times in a big program with it being Global you can't just reuse it because it's going to change the value there are some you could use the word sum in loads of different subroutines and they wouldn't affect each other and also if you've got Global variables it can occasionally lead to mistakes somebody might try and change their version of results and they might change another programmer's version of results leading to quite confusing errors there are two types of error to know a syntax error is an error where you're not following the rules of the language you mess up a colon you add an extra bracket when you shouldn't do and so it means your code won't even run whereas the logic error if a code will run it's just for result it's unexpected it doesn't do what you intend there is some mistake somewhere validation is where you are enforcing some rule around user input usually to try and avoid errors actually so for instance you might use a while loop to ensure that the user types something in and they don't type in just nothing so often volumes are used for validation actually also used for Authentication to this is where you're checking the identity of a user so most often password or username Checkers and in order to make sure your program is robust meaning it won't break because of Errors you should use a different range of test data so you should try some normal test data which is what you are expecting to get entered boundary test data is sort of like either side of the boundary it might be acceptable it might not be acceptable but it's close whereas erroneous is completely wrong and probably would break your program if you didn't validate it and the last thing you'll end on is just some quick advice for some of the trickier questions where you've got to write a program in your program code do not write pseudocode here it's got to be code in the language you have studied tiny mistakes aren't penalized but it has got to be in that language now people get put off because these can be quite a lot of marks do the basics no matter what so you get marks for assigning variables for casting if it's a number for using things like while Loops if statements even if they're not totally right be guided by the question do read the entire question before starting take some time to think about what it's asking for think about what contractors need did ever says things like keep keep asking use a while loop if this is things like check to see use an if statement Etc and the bullet points often tell you the rough order to go in there'll be grid lines which are there to help you indent you can see I've indented into my while loop just by shifting my writing across into the next box and don't get too put off by the size of your answer Grid or the number of marks available especially early on in the paper you might get quite a few marks for not much writing and you might get loads of space to answer in use this as a guide especially towards the end of your paper if it is a eight marker that suggests you're going to need to use a loop maybe an if statement maybe a couple of Loops actually and that's it I really hope paper one goes well and you'll be back ready for paper two when it comes around