System: You are ChatGPT, a large language model trained by OpenAI.
User: I will send you a body of text, I will then state what you do next.
User: 8●Sequencing instructions correctly is critical when programming. In simple terms this means making sure that each line of code is executed in the rightorder. For example, a DVD recorder may have a simple program to record aTV channel at a certain time. The sequence of events would be: Set time to record = 15: 00Set channel to record = Channel 4Check timeIf time = 15: 00 Then RecordIf any of these instructions were wrong, missed out or executed in thewrong order, then the program would not work correctly.2 Programming conceptsLEARNING OBJECTIVESIn this chapter you will learn how to: •put lines of code in the correct sequence •write an assignment statement•write a selection statement •write an iterative (repeat) statement•use loops. INTRODUCTIONIn simple terms, programming is just a case of writing a series of instructions in order to complete a task. Depending on which programming language you use, this is done in different ways. However, there are certain constructs that are common to all high-level languages. These building blocks of programming are sequence, selection and repetition (also known as iteration). There is also a further fundamental principle called assignment.SPECIFICATION COVERAGE 3.1.1.2 Programming concepts9SELECTIONThe actual process of writing statements varies from one programming language to another. This is because all languages use different syntax . Common usage of the word syntax refers to the way that sentences are structured to create well-formed sentences. For example, the sentence ‘Birds south fly in the winter’ is syntactically incorrect because the verb needs to come after the noun. Programming languages work in the same way and have certain rules that programmers need to stick to otherwise the code will not work. ●AssignmentWe met the concept of an assignment statement in Chapter 1. Assignmentgives a value to a variable or constant. For example you might be using avariable called Age  so the code: Age  34will set the variable Age  to have the value 34. The value stored in the variable could change as the program is run. Forexample, a computer game might use a variable called Score . At thebeginning of the game the value is set to 0. Each time the player scoresa point, the assignment process takes place again to reset the value ofScore  to 1 and so on. Assigning values will take place over and over again while a program isbeing run. Initially, the programmer will assign a value to the variable.Then as the program runs, the algorithms in the program code willcalculate and then return (re-assign) the latest value. Assignments are thefundamental building blocks of any computer program because they definethe data the program is going to be using.
 ●SelectionThe selection  process allows a computer to compare values and then decide what course of action to take. For example you might want your program to decide if someone is old enough to drive a car. The selectionprocess for this might look something like this: If Age < 17 Then Output = "Not old enough to drive"Else Output = "Old enough to drive"End IfIn this case, the computer is making a decision based on the value of the variable Age. If the value of Age  is less than 17 it will output the text string "Not old enough to drive" . For any other age it will output the text string "Old enough to drive" . The If  statement is a very common construct. In this case it is used to tell the program what to do if the statement is true using the If...Then  construct. If the statement is false, it uses the Else  part of the code. This is a very simple selection statement with only two outcomes.KEYWORD Selection: the principle of choosing what action to take based on certain criteria.KEYWORD Syntax: the rules of how words are used within a given language. 2 Programming concepts 10Nested selectionYou can carry out more complex selections by using a nested statement. For example, a program could be written to work out how much to charge to send parcels of different weights. This could be achieved using the following sequence of selection statements: If Weight >= 2000 Then Price = £10Else If Weight >= 1500 Then Price = £7.50Else If Weight >= 1000 Then Price = £5Else Price = £2.50End IfWhen the weight is input, it works through the lines of code in the If statement and returns the correct value. For example, if the parcel weighs 1700 g it will cost £7.50 as it is between 1500 g and 1999 g. If it weighed 2000 g or more, the If  statement would return £10.In some languages complex selections can be implemented using constructs such as this Case  statement. The following example shows a section of code that allows the user to type in a country code to identify where a parcel is being sent to: Select Case ParcelDestinationCase 1 WriteLine ("Mainland UK")Case 2 WriteLine ("Europe")Case 3 WriteLine ("USA")Case Else WriteLine ("Rest of the World")End SelectThis routine takes the value of the variable ParcelDestination  and compares it against the different criteria. So if ParcelDestination  is  1 then Mainland UK  will be printed to the screen.
 ●Repetition (Iteration)It is useful to be able to repeat a process in a program. This is usually called iteration . For example you might want to count the number of words ina block of text or you may want to keep a device moving forward until it reaches a wall. Both these routines involve repeating something until aKEYWORD Nesting: placing one set of instr uctions within another set of instructions. KEYWORDIteration: the principle of repeating processes.REPETITION (ITERATION) 11condition is met – either you run out of words to count or the device comes to a wall. An iterative process has two parts – a pair of commands that show the start and finish of the process to be repeated and some sort of condition. There are two basic forms of iteration – definite and indefinite. Definite iteration  mean s that the instructions are repeated in a loop a certain number of ti mes. Indefinite iteration  means that the instructions are repeated in a loop  until some other event stops it. Iteration statements are often referred to as loops , as they go round and round. Let’s look at an example of each. Definite iterationIf you want a process to be carried out a set number of times you will need to use definite iteration. For example, the following code could be used to operate a robotic device. It will move a device forward 40 units: For Counter = 1 To 40  Move forward 1 unitNextAfter it has moved forward 40 units it will stop. It will try and move irrespective of whether it meets an obstacle or not. This is known as a For...Next loop as it will carry out the instruction for a set number of times. Indefinite iterationIn this case the loop is repeated until a specified condition is met – so it uses a selection process to decide whether or not to carry on (or even whether to start) a process.
 This routine moves a device forward until the sensor detects an obstacle: Repeat  Move forward 1 unitUntil Sensors locate an obstacle Figure 2.1 Parking sensorKEYWORDS Definite  iteration: a process that repe ats a set number of times.
 Indefinite iteration: a process that rep eats until a certain condition is met. Loop: a repeated process. 2 Programming concepts12There is no way of knowing how many times this loop will be repeated so potentially it could go on forever – a so-called infinite loop. This example is also known as a Repeat...Until  loop as it repeats the instruction until a condition is met.To check for a condition before the code is run, you can use what is commonly called a While  or Do while  loop. For example, a program that converts marks to grades might use the following line of code: While Mark <=100  Convert Mark to GradeEnd WhileIn this case, it checks the condition before the code is run. If the mark is over 100, then the code inside the While  loop will not even start. Nested loopsIn the same way that you can nest selection statements together, it is also possible to have a loop within a loop. For example, an algorithm to create a web counter on a web page may have 8 digits allowing for numbers up to 10 million. Starting with the units, the program counts from 0 to 9. When it reaches 9, it starts again from 0, but it also has to increment the value in the tens column by 1. The units will move round 10 times before the tens, then moves once. The tens column moves around 10 times and then the hundreds increments by 1 and so on.
 The same algorithm can therefore be used for each digit and can be nested together so that the code is carried out in the correct sequence . The code below shows a nested loop just for the units and tens: Tens = 0 Units = 0While Tens < 10   While Units < 10Output Tens and Units to web counterUnits = Units + 1   End While   Tens = Tens + 1   Units = 0End WhileNotice that the way the code is indented indicates the sequence of events. This shows that for every iteration of the outer loop, the inner loop will be completed. Structures such as those mentioned in this chapter are one of the characteristics of a high-level language. They are easy to understand when they are viewed in isolation, but the problems start when you try to put a series of constructs together to do something more useful than deciding if someone is old enough to drive a car or to move a device forwards. In order to create larger, more useful programs, you need to plan ahead and organise your code. Practice questions can be found at the end of the section on pages 46 and 4 7.KEYWORDSequence: the principle of putting the correct instructions in the right order within a program.
 Figure 2.2 A web counter82530000Tens UnitsREPETITION (ITERATION)13STUDY / RESEARCH TASKS1 Identify a real-life situation where it might be useful to use the following constructs within a program: a)iterationb)selection.2 Write a program that reads in a ﬁle of test marks and then converts them to grades.3 Write a program that works out the postage charges for parcels of different weights.4 Write a program that simulates the odometer on a car.KEY POINTS •Programming statements are built up using four main constructs: sequence,selection, repetition (alsoknown as iteration) andassignment.
 •Sequence is putting theinstructions in the correct order to perform a task.
 •Selection statementschoose what action to take based on specified criteria.For example, If...Thenstatements. •Iteration is where a particularstep or steps are repeatedin order to achieve a certaintask. For example, For...Next  statements. •Assignment is the processof giving values to variables and constants. For example,Age = 25 .TASKS1 Write examples of the three main types of programming statement: assignment, selection, iteration.2 Give two examples where an iterative process might be used. 3 Explain the difference between definite and indefinite iteration.
 4 Explain the concept of a nested statement.
 5 Why is the sequence of programming statements so important? Use an example to explain. 6 What is syntax and why is it important? Use an example to explain.
User: Make the following text more clear.
Format it properly.
Do NOT change the meaning of the words or methods used to obtain the answer or anything like that.
This is for AQA A(S)-Level Computer Science. I repeat, do not alter the words as it could have an effect on the marks acquired from the marking scheme.
However, remove any redundant information or USELESS examples that are not needed for a student to know, or simplify unnecessary information (if it has a definition or keywords, it is not unnecessary).
If you can, use different values for the examples.
For things that will not score a mark or are generally useless, for example, "we will cover" or a fun fact, change the wording. This is for AS Level, do not include information about topics that are ONLY A-Level Content (if it says it is)
Link the 'sections' of your answer to the following spec-points (by title):
e.g. "**Topic** (Spec Points: a.b.c. Whatever)
3.1.1.2 Programming concepts
Content
Additional information
Use, understand and know how the following statement types can be combined in programs:
variable declaration
constant declaration
assignment
iteration
selection
subroutine (procedure/function).
The three combining principles (sequence, iteration/repetition and selection/choice) are basic to all imperative programming languages.
Use definite and indefinite iteration, including indefinite iteration with the condition(s) at the start or the end of the iterative structure. A theoretical understanding of condition(s) at either end of an iterative structure is required, regardless of whether they are supported by the language being used.
Use nested selection and nested iteration structures.
Use meaningful identifier names and know why it is important to use them.


You MUST make sure they are ALL met. Everything it says on there you should meet.
SOMETIMES the specification does not always mention everything. If you encounter something from the body of text that is not necessarily mentioned on the specification point, still try to include it but condense it. Do not make the notes unecessary or useless.

I already provided the available exam questions you MAY choose to add on to the notes, with 'des' explaining what it's about, and 'fil' meaning the Question ID.
The content, too. Delivered in the form 'fil', JSON
Ignore exam questions that contain 'Skeleton Program'. Do not only put like 2 exam questions, try to put more!
For the exam questions, in the original text, there is a label named 'Tasks'. Those (usually) six questions are NOT the exa questions. The exam questions are the ones that were given in JSON form to you, do NOT do the 'Tasks'. Do the exam questions that contain HTML in JSON!

In the markscheme, a ';' typically means that a mark was gained.
When mentioning exam questions, you *must* answer them, according to the markscheme, scoring full marks. No 'do it yourself'.

Include ALL definitions (KEYWORDS) from the original text I sent in your notes. When I mean all, I mean ALL.

If necessary for scoring marks, try to embed the exam-questions into your notes, sometimes without even referencing the fact that it is an exam question. For example, if an exam question is a definition or benefits, use the answer in your notes.
Remember. DO NOT ADD USELESS STUFF. Your task is to create the MOST EFFICIENT (SHORTEST [for an explanation] BUT STILL SCORES ALL MARKS) possible notes resource, which will score all marks easily, so its wording has to be mostly like that of the exam questions. By any means, if necessary, please include examples and exam questions! At the end you can have a 'try these exam questions' thing.
At the end of your answer, you will give a 'breakdown'/'summary' of each thing you covered which will tell the most concise FULLY MARK-SCORING explanation possible.

In summary, your answer must:

* Be efficient, useful
* For topics in an exam that may require some form of mathematical working, always show an example of a question.
* Be clear – provide clear, step-by-step examples/instructions when needed.
* Follow the entire specification and everything it says.
* Link your section to a spec point. E.g. **Topic** (Spec Points: a.b.c Whatever)
* Score ALL marks.
* Include ALL exam questions S at the end (except ones that contain 'Skeleton Program'), with the same wording as the original ones in the JSONs sent to you – and INCLUDE THE QUESTION CONTENT, AND THE ANSWERS/MARK SCHEME. Only the ones that I provided to you, include Question IDs.
* Remove redundant, unnecessary and useless information that would not be brought up in an exam answer.
* Be helpful to the reader
* Provide the full notes, covering ALL spec-points (and showing the spec-points covered in each section).
* Include ALL definitions (KEYWORDS, usually represented explicitly and specifically in the original text as Keyword: Definition), do not change the wording (unless that definition is an exam question). MAKE ALL THE DEFINITIONS FULL (yet consice, as they can sometimes even be 2 marks). Incorporate the definitons into the notes.
* Include a seperate section named 'Definitions' that covers the keywords and their simplest definition that scores all marks. These are (usually) found in the original text.
* Include a summary at the end (after definitions) that goes through everything you need to score all marks.

At the end of the formatted text, after everything is done, fill out the JSON:
Remove the type clarification.
{
"chapter": (int),
"page": (int),
"chapter_name": (str),
"topics": (list)
}

User: And these are the available exam questions, with 'des' explaining what it's about, and 'fil' meaning the Question ID.
{'S1$.1.b': [{'index1': '|D.A$|', 'index2': '|1$|', 'index3': '3$', 'index4': 'S1$.1.b | L1$.1.b', 'index5': '|', 'index6': 'QS00A205', 'qid': 'QS00A205', 'des': 'Programming statements; selection/ iteration', 'index7': '', 'marks': '3 marks', 'time': '5', 'ttext': 'Programming concepts', 'fld': 'AA_COM', 'fil': 'QS00A205', 'year': 0, 'res': '', 'flag1': 0}, {'index1': '|D.A$|', 'index2': '|2$|', 'index3': '2$', 'index4': 'S1$.1.b', 'index5': '|', 'index6': 'Q22S1B09p1', 'qid': 'Q22S1B09p1', 'des': 'Explain differences between definite and indefinite iteration; loops', 'index7': '', 'marks': '2 marks', 'time': '3', 'ttext': 'Programming concepts', 'fld': 'AA_COM', 'fil': 'Q22S1B09P1', 'year': 2023, 'res': '', 'flag1': None}, {'index1': '|D.A$|D.C$|D.D$|H.B$|K$|', 'index2': '|2$|', 'index3': '1$', 'index4': 'S1$.1.b | S1$.1.k | S1$.1.l | S2$.1.b | S3$.1.d | S4$.1.a', 'index5': '|1$|', 'index6': 'Q23S1C12', 'qid': 'Q23S1C12', 'des': 'Accumulator; parameter; subroutine', 'index7': '', 'marks': '5 marks', 'time': '7', 'ttext': 'Programming concepts | Practical programming | Data structures | Testing | Preliminary material', 'fld': 'AA_COM', 'fil': 'Q23S1C12', 'year': 2023, 'res': '/RESOURCES/AA_COM/RESOURCES/2023_AS_SectionC_resources.html', 'flag1': 0}, {'index1': '|D.A$|D.C$|H.B$|K$|', 'index2': '|2$|', 'index3': '1$', 'index4': 'S1$.1.a | S1$.1.b | S1$.1.d | S1$.1.i | S3$.1.d | S4$.1.a', 'index5': '|1$|', 'index6': 'Q23S1C13', 'qid': 'Q23S1C13', 'des': 'Validation; range check; type check', 'index7': '', 'marks': '6 marks', 'time': '8', 'ttext': 'Programming concepts | Practical programming | Testing | Preliminary material', 'fld': 'AA_COM', 'fil': 'Q23S1C13', 'year': 2023, 'res': '/RESOURCES/AA_COM/RESOURCES/2023_AS_SectionC_resources.html', 'flag1': 0}, {'index1': '|D.A$|D.C$|', 'index2': '|1$|', 'index3': '3$', 'index4': 'S1$.1.b | S1$.1.c | S1$.1.e | L1$.1.b | L1$.1.c | L1$.1.e', 'index5': '|', 'index6': 'QS99N103', 'qid': 'QS99N103', 'des': 'Data type (Boolean); apply DIV; MOD', 'index7': '', 'marks': '3 marks', 'time': '5', 'ttext': 'Programming concepts | Practical programming', 'fld': 'AA_COM', 'fil': 'QS99N103', 'year': 0, 'res': '', 'flag1': 0}, {'index1': '|D.A$|D.C$|K$|', 'index2': '|1$|', 'index3': '2$', 'index4': 'S1$.1.b | S1$.2.a', 'index5': '|16$|', 'index6': 'QS18S1B09', 'qid': 'QS18S1B09', 'des': 'Hierarchy chart', 'index7': '', 'marks': '2 marks', 'time': '2', 'ttext': 'Programming concepts | Practical programming | Preliminary material', 'fld': 'AA_COM', 'fil': 'QS18S1B09', 'year': 2018, 'res': '/RESOURCES/AA_COM/RESOURCES/AS_P1_Summer2018.html', 'flag1': 1}, {'index1': '|D.A$|K$|', 'index2': '|2$|', 'index3': '2$', 'index4': 'S1$.1.b', 'index5': '|19$|', 'index6': 'Q22S1B09p2', 'qid': 'Q22S1B09p2', 'des': 'State identifier of subroutine in skeleton program that uses definite iteration; loops', 'index7': '', 'marks': '1 marks', 'time': '1', 'ttext': 'Programming concepts | Preliminary material', 'fld': 'AA_COM', 'fil': 'Q22S1B09P2', 'year': 2023, 'res': '/RESOURCES/AA_COM/RESOURCES/2022_AS_SectionB_resources.html', 'flag1': None}, {'index1': '|D|D.A$|D.D$|K$|', 'index2': '|2$|', 'index3': '2$', 'index4': 'S1$.1.b | S2$.1.b | S3$.1.b', 'index5': '|19$|', 'index6': 'Q22S1B07', 'qid': 'Q22S1B07', 'des': 'Describe how skeleton program would be changed to use a 4x4 grid instead of 3x3', 'index7': '', 'marks': '2 marks', 'time': '3', 'ttext': 'Programming | Programming concepts | Data structures | Preliminary material', 'fld': 'AA_COM', 'fil': 'Q22S1B07', 'year': 2023, 'res': '/RESOURCES/AA_COM/RESOURCES/2022_AS_SectionB_resources.html', 'flag1': None}, {'index1': '|K$|', 'index2': '|2$|', 'index3': '1$', 'index4': 'S1$.1.b', 'index5': '|7$|', 'index6': 'QS171PM', 'qid': 'QS171PM', 'des': 'PM - Capture the Sarrum', 'index7': '', 'marks': '0 marks', 'time': '0', 'ttext': 'Preliminary material', 'fld': 'AA_COM', 'fil': 'QS171PM', 'year': 2017, 'res': '/RESOURCES/AA_COM/RESOURCES/COMP1Summer2017.html', 'flag1': 0}]}

User: These are the content of said exam questions, these are the ONLY exam questions, you will use these later, delivered in form 'fil', JSON: {'QS00A205': {'question': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">Using a High Level Language with which you are familiar, give <b>one</b> example of <b>each of </b>the following.</p>  \r<p class="indent1new">(a)&nbsp;&nbsp;&nbsp;&nbsp; Data assignment<span class="answer-toggle">____________________________________________________</span></p>  \r<p class="indent2new answer-toggle">__________________________________________________________________</p>  \r<p class="indent1new">&nbsp;(b)&nbsp;&nbsp;&nbsp; Selection (Conditional step)<span class="answer-toggle">____________________________________________</span></p>  \r<p class="indent2new answer-toggle">__________________________________________________________________</p>  \r<p class="indent1new">&nbsp;(c)&nbsp;&nbsp;&nbsp; Repetition (Iteration)<span class="answer-toggle">_________________________________________________</span></p>  \r<p class="indent2new answer-toggle">__________________________________________________________________</p>  \r<p class="mark">(Total 3 marks)</p></h5>', 'markscheme': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">Statements must be sufficient to demonstrate general principle e.g.</p>  \r<p class="indent1 indentright">(a)&nbsp;&nbsp;&nbsp;&nbsp; X: =Y+Z;</p>  \r<p class="levelms">1</p>  \r<p class="indent1 indentright">(b)&nbsp;&nbsp;&nbsp;&nbsp; IF X&gt;l0 THEN PRINT “GOOD”../CASE OF / SWITCH;</p>  \r<p class="levelms">1</p>  \r<p class="indent1 indentright">(b)&nbsp;&nbsp;&nbsp;&nbsp; WHILE X&lt;10 DO.X=X+1../REPEAT...UNTIL X=l0/FOr X=l TO 10 DO;</p>  \r<p class="levelms">1</p>  \r<p class="indent1new indentright"><i>1 mark for each example</i></p>  \r<p class="indent1new indentright m-t-0"><i>Max 3</i></p>\r<p class="mark">[3]</p></h5>', 'examinerreport': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">This question required candidates to give actual examples of programming statements from a high level language with which they were familiar. In too many cases, three easy marks were lost by those candidates who did not read the question and either described the statement or wrote, for example,<br> IF..... . .THEN. . .ELSE”.</p></h5>', 'notes': '', 'resources': ''}, 'Q22S1B09P1': {'question': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">Explain the differences between definite and indefinite iteration.</p>\r\n<p class="indent1new answer-toggle">_______________________________________________________________________</p>\r\n<p class="indent1new answer-toggle">_______________________________________________________________________</p>\r\n<p class="indent1new answer-toggle">_______________________________________________________________________</p>\r\n<p class="indent1new answer-toggle">_______________________________________________________________________</p>\r\n<p class="mark">(Total 2 marks)</p></h5>', 'markscheme': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question"><b>2 marks for AO1 (understand)</b></p>\r\n<p class="indent1new indentright">Definite iteration: the number of iterations is known (at the time of execution);</p>\r\n<p class="indent1new indentright m-t-0">Indefinite iteration: the number of iterations depends on a condition (that is tested before / after each iteration);</p>\r\n<p class="indent1new indentright"><b>NE.</b> indefinite iteration: number of iterations not known</p>\r\n<p class="mark">[2]</p></h5>', 'examinerreport': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">Many students failed to secure full marks in this question, with responses that were insufficiently specific rather than incorrect. The most common way in which a mark was dropped was to correctly define definite iteration, and then to present indefinite iteration as the opposite of definite iteration. Where a mark is available for providing a definition, a standalone definition should be provided.</p></h5>', 'notes': '', 'resources': ''}, 'Q23S1C12': {'question': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">This question extends the functionality of the <b>Skeleton Program</b>.</p>\r\n<p class="indent1new">The functionality of the <span class="comp">SKP</span> opcode is to be changed so that it increments the value stored in the accumulator by 1</p>\r\n<p class="indent1new">For example, if the accumulator contained 4, then executing the instruction</p>\r\n<p class="indent2new m-t-0"><span class="comp">SKP</span></p>\r\n<p class="indent1new m-t-s">would change the value in the accumulator to 5</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1new"><b>What you need to do:</b></p>\r\n<p class="indent1new"><b>Task 1</b></p>\r\n<p class="indent1new m-t-0">Amend the subroutine <span class="comp">ExecuteSKP</span> so that it adds 1 to the accumulator and then updates the status register if required. The <span class="comp">Registers</span> data structure should be passed as a parameter.</p>\r\n<p class="indent1new"><b>Task 2</b></p>\r\n<p class="indent1new m-t-0">Amend the call to <span class="comp">ExecuteSKP</span> in the <span class="comp">Execute</span> subroutine as required.</p>\r\n<p class="indent1new"><b>Task 3</b></p>\r\n<p class="indent1new m-t-0">Test that the changes you have made work by conducting the following test:</p>\r\n<p class="indent1 m-t-0">&#8226;&emsp;&emsp;&nbsp;run your amended <b>Skeleton Program</b></p>\r\n<p class="indent1 m-t-0">&#8226;&emsp;&emsp;&nbsp;enter <span class="comp">L</span></p>\r\n<p class="indent1 m-t-0">&#8226;&emsp;&emsp;&nbsp;load <b>prog2</b></p>\r\n<p class="indent1 m-t-0">&#8226;&emsp;&emsp;&nbsp;enter <span class="comp">A</span></p>\r\n<p class="indent1 m-t-0">&#8226;&emsp;&emsp;&nbsp;enter <span class="comp">R</span></p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1new"><b>Evidence that you need to provide</b></p>\r\n<p class="indent1">(a)&emsp;&nbsp;Your PROGRAM SOURCE CODE for the entire subroutine <span class="comp">ExecuteSKP</span> and the entire subroutine <span class="comp">Execute</span>.</p>\r\n<p class="mark">(4)</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1">(b)&emsp;&nbsp;SCREEN CAPTURE(S) showing the requested test described in <b>Task 3</b>.</p>\r\n<p class="indent2new">The SCREEN CAPTURE(S) only need to show all of Frame 0 and all of the final frame.</p>\r\n<p class="mark">(1)</p>\r\n<p class="mark">(Total 5 marks)</p></h5>', 'markscheme': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="questiona">(a)&emsp;&nbsp;<b>4 marks for AO3 (programming)</b></p>\r\n<p class="indent2new indentright"><b>Mark as follows:</b></p>\r\n<p class="indent2 indentright">1)&emsp;&ensp;&nbsp;Add required parameter to subroutine call in <span class="comp">Execute</span>;</p>\r\n<p class="indent2 indentright m-t-0">2)&emsp;&ensp;&nbsp;Add required parameter to <span class="comp">ExecuteSKP</span> definition;</p>\r\n<p class="indent2 indentright m-t-0">3)&emsp;&ensp;&nbsp;Add <span class="comp">1</span> to <span class="comp">Registers[ACC];</span></p>\r\n<p class="indent2 indentright m-t-0">4)&emsp;&ensp;&nbsp;Update status register (by calling <span class="comp">SetFlags</span> with correct parameters);</p>\r\n<p class="indent2new indentright"><b>Max 3</b> if any errors</p>\r\n<p class="levelms">4</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1 indentright">(b)&emsp;&nbsp;<b>Mark is for AO3 (evaluate)</b></p>\r\n<p class="indent2new indentright"><b>&#42;&#42;&#42;&#42; SCREEN CAPTURE &#42;&#42;&#42;&#42;</b></p>\r\n<p class="indent2new indentright m-t-0">Must match code from <b>(a)</b>, including prompts on screen capture matching those in code.</p>\r\n<p class="indent2new indentright m-t-0">Code for <b>(a)</b> must be sensible.</p>\r\n<p class="indent2new indentright">Screen capture showing (values changing from Frame 0 to Frame 5 shown highlighted):</p>\r\n<p class="indent2new"><img src="AA_COM/M23S1C12_files_M/img01.jpg"/>&nbsp;</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent2new"><b>VB.Net</b></p>\r\n<p class="indent2new comp-top">Sub ExecuteSKP(<b>Registers() As Integer</b>)&nbsp;&nbsp;\' MP2</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>Registers(ACC) += 1</b>&nbsp;&nbsp;\'MP3</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>SetFlags(Registers(ACC), Registers)</b>&nbsp;&nbsp;\'MP4</p>\r\n<p class="indent2new comp">End Sub</p>\r\n<p class="indent2new comp-top">Sub Execute(ByVal SourceCode() As String, ByVal Memory() As AssemblerInstruction)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Dim Registers() As Integer = {0, 0, 0, 0, 0}</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;SetFlags(Registers(ACC), Registers)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Registers(PC) = 0</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Registers(TOS) = HI_MEM</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Dim FrameNumber As Integer = 0</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;DisplayFrameDelimiter(FrameNumber)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;DisplayCurrentState(SourceCode, Memory, Registers)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Dim OpCode As String = Memory(Registers(PC)).OpCode</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;While OpCode &lt;&gt; &quot;HLT&quot;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;FrameNumber += 1</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine()</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;DisplayFrameDelimiter(FrameNumber)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Dim Operand As Integer = Memory(Registers(PC)).OperandValue</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine($&quot;* Current Instruction Register: {OpCode} {Operand}&quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Registers(PC) += 1</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Select Case OpCode</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Case &quot;LDA&quot;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecuteLDA(Memory, Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Case &quot;STA&quot;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecuteSTA(Memory, Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Case &quot;LDA#&quot;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecuteLDAimm(Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Case &quot;ADD&quot;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecuteADD(Memory, Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Case &quot;JMP&quot;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecuteJMP(Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Case &quot;JSR&quot;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecuteJSR(Memory, Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Case &quot;CMP#&quot;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecuteCMPimm(Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Case &quot;BEQ&quot;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecuteBEQ(Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Case &quot;SUB&quot;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecuteSUB(Memory, Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Case &quot;SKP&quot;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecuteSKP(<b>Registers</b>)&nbsp;&nbsp;\'MP1</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Case &quot;RTN&quot;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecuteRTN(Memory, Registers)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;End Select</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;If Registers(ERR) = 0 Then</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OpCode = Memory(Registers(PC)).OpCode</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DisplayCurrentState(SourceCode, Memory, Registers)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Else</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OpCode = &quot;HLT&quot;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;End If</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;End While</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Console.WriteLine(&quot;Execution terminated&quot;)</p>\r\n<p class="indent2new comp">End Sub</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent2new"><b>Python 3</b></p>\r\n<p class="indent2new comp-top">def ExecuteSKP(<b>Registers</b>):&nbsp;&nbsp;<b># MP2</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>Registers[ACC] = Registers[ACC] + 1</b>&nbsp;&nbsp;<b># MP3</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>Registers = SetFlags(Registers[ACC], Registers)</b>&nbsp;&nbsp;<b># MP4</b></p>\r\n<p class="indent2new comp-top">def Execute(SourceCode, Memory):</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Registers = [0, 0, 0, 0, 0]</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Registers = SetFlags(Registers[ACC], Registers)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Registers[PC] = 0</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Registers[TOS] = HI_MEM</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;FrameNumber = 0</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;DisplayFrameDelimiter(FrameNumber)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;DisplayCurrentState(SourceCode, Memory, Registers)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;OpCode = Memory[Registers[PC]].OpCode</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;while OpCode != &quot;HLT&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;FrameNumber += 1</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;print()</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;DisplayFrameDelimiter(FrameNumber)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Operand = Memory[Registers[PC]].OperandValue</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;* Current Instruction Register: &quot;, OpCode, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Registers[PC] = Registers[PC] + 1</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;if OpCode == &quot;LDA&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registers = ExecuteLDA(Memory, Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;elif OpCode == &quot;STA&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Memory = ExecuteSTA(Memory, Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;elif OpCode == &quot;LDA#&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registers = ExecuteLDAimm(Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;elif OpCode == &quot;ADD&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registers = ExecuteADD(Memory, Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;elif OpCode == &quot;JMP&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registers = ExecuteJMP(Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;elif OpCode == &quot;JSR&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Memory, Registers = ExecuteJSR(Memory, Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;elif OpCode == &quot;CMP#&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registers = ExecuteCMPimm(Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;elif OpCode == &quot;BEQ&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registers = ExecuteBEQ(Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;elif OpCode == &quot;SUB&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registers = ExecuteSUB(Memory, Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;elif OpCode == &quot;SKP&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecuteSKP(<b>Registers</b>)&nbsp;&nbsp;<b># MP1</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;elif OpCode == &quot;RTN&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registers = ExecuteRTN(Memory, Registers)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;if Registers[ERR] == 0:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OpCode = Memory[Registers[PC]].OpCode</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DisplayCurrentState(SourceCode, Memory, Registers)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;else:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OpCode = &quot;HLT&quot;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;print(&quot;Execution terminated&quot;)</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent2new"><b>Python 2</b></p>\r\n<p class="indent2new comp-top">def ExecuteSKP(<b>Registers</b>)<b>:</b>&nbsp;&nbsp;<b># MP2</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>Registers[ACC] = Registers[ACC] + 1</b>&nbsp;&nbsp;<b># MP3</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>Registers = SetFlags(Registers[ACC], Registers)</b>&nbsp;&nbsp;<b># MP4</b></p>\r\n<p class="indent2new comp-top">def Execute(SourceCode, Memory):</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Registers = [0, 0, 0, 0, 0]</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Registers = SetFlags(Registers[ACC], Registers)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Registers[PC] = 0</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Registers[TOS] = HI_MEM</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;FrameNumber = 0</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;DisplayFrameDelimiter(FrameNumber)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;DisplayCurrentState(SourceCode, Memory, Registers)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;OpCode = Memory[Registers[PC]].OpCode</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;while OpCode != &quot;HLT&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;FrameNumber += 1</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;print</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;DisplayFrameDelimiter(FrameNumber)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Operand = Memory[Registers[PC]].OperandValue</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;print &quot;* Current Instruction Register: &quot;, OpCode, Operand</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Registers[PC] = Registers[PC] + 1</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;if OpCode == &quot;LDA&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registers = ExecuteLDA(Memory, Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;elif OpCode == &quot;STA&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Memory = ExecuteSTA(Memory, Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;elif OpCode == &quot;LDA#&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registers = ExecuteLDAimm(Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;elif OpCode == &quot;ADD&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registers = ExecuteADD(Memory, Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;elif OpCode == &quot;JMP&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registers = ExecuteJMP(Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;elif OpCode == &quot;JSR&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Memory, Registers = ExecuteJSR(Memory, Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;elif OpCode == &quot;CMP#&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registers = ExecuteCMPimm(Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;elif OpCode == &quot;BEQ&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registers = ExecuteBEQ(Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;elif OpCode == &quot;SUB&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registers = ExecuteSUB(Memory, Registers, Operand)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;elif OpCode == &quot;SKP&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecuteSKP(<b>Registers</b>)&nbsp;&nbsp;<b># MP1</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;elif OpCode == &quot;RTN&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registers = ExecuteRTN(Memory, Registers)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;if Registers[ERR] == 0:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OpCode = Memory[Registers[PC]].OpCode</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DisplayCurrentState(SourceCode, Memory, Registers)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;else:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OpCode = &quot;HLT&quot;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;print &quot;Execution terminated&quot;</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent2new"><b>Pascal</b></p>\r\n<p class="indent2new comp-top">procedure ExecuteSKP<b>(var Registers: TRegisters);</b>&nbsp;&nbsp;<b>// MP2</b></p>\r\n<p class="indent2new comp">begin</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>Registers[ACC] := Registers[ACC] + 1;</b>&nbsp;&nbsp;<b>// MP3</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>SetFlags(Registers[ACC], Registers);</b>&nbsp;&nbsp;<b>// MP4</b></p>\r\n<p class="indent2new comp">end;</p>\r\n<p class="indent2new comp-top">procedure Execute(var SourceCode: TSourceCode; var Memory: TMemory);</p>\r\n<p class="indent2new comp">var</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Registers: TRegisters;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;OpCode: string;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Operand, FrameNumber: integer;</p>\r\n<p class="indent2new comp">begin</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Registers := TRegisters.create(0, 0, 0, 0, 0);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;SetFlags(Registers[ACC], Registers);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Registers[PC] := 0;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Registers[TOS] := HI_MEM;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;FrameNumber := 0;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;DisplayFrameDelimiter(FrameNumber);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;DisplayCurrentState(SourceCode, Memory, Registers);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;OpCode := Memory[Registers[PC]].OpCode;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;while OpCode &lt;&gt; \'HLT\' do</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;begin</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FrameNumber := FrameNumber + 1;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;writeln;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;DisplayFrameDelimiter(FrameNumber);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Operand := Memory[Registers[PC]].OperandValue;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;writeln(\'* Current Instruction Register: \', OpCode, \' \', Operand);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registers[PC] := Registers[PC] + 1;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if OpCode = \'LDA\' then ExecuteLDA(Memory, Registers, Operand);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if OpCode = \'STA\' then ExecuteSTA(Memory, Registers, Operand);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if OpCode = \'LDA#\' then ExecuteLDAimm(Registers, Operand);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if OpCode = \'ADD\' then ExecuteADD(Memory, Registers, Operand);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if OpCode = \'JMP\' then ExecuteJMP(Registers, Operand);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if OpCode = \'JSR\' then ExecuteJSR(Memory, Registers, Operand);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if OpCode = \'CMP#\' then ExecuteCMPimm( Registers, Operand);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if OpCode = \'BEQ\' then ExecuteBEQ(Registers, Operand);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if OpCode = \'SUB\' then ExecuteSUB(Memory, Registers, Operand);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if OpCode = \'SKP\' then ExecuteSKP(<b>Registers</b>);&nbsp;&nbsp;<b>// MP1</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if OpCode = \'RTN\' then ExecuteRTN(Memory, Registers);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if Registers[ERR] = 0</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;then</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;begin</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OpCode := Memory[Registers[PC]].OpCode;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DisplayCurrentState(SourceCode, Memory, Registers);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OpCode := \'HLT\';</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;end;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;writeln(\'Execution terminated\');</p>\r\n<p class="indent2new comp">end;</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent2new"><b>C#</b></p>\r\n<p class="indent2new comp-top">private static void ExecuteSKP(<b>int[] registers</b>)&nbsp;&nbsp;<b>// MP2</b></p>\r\n<p class="indent2new comp">{</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>registers[ACC] = registers[ACC] + 1;</b>&nbsp;&nbsp;<b>// MP3</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>SetFlags(registers[ACC], registers);</b>&nbsp;&nbsp;<b>// MP4</b></p>\r\n<p class="indent2new comp">}</p>\r\n<p class="indent2new comp-top">private static void Execute(string[] sourceCode, AssemblerInstruction[] memory)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;{</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;int[] registers = new int[] { 0, 0, 0, 0, 0 };</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;int frameNumber = 0, operand = 0;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;SetFlags(registers[ACC], registers);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;registers[PC] = 0;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;registers[TOS] = HI_MEM;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;DisplayFrameDelimiter(frameNumber);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;DisplayCurrentState(sourceCode, memory, registers);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;string opCode = memory[registers[PC]].opCode;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;while (opCode != &quot;HLT&quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;{</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;frameNumber++;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine();</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DisplayFrameDelimiter(frameNumber);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;operand = memory[registers[PC]].operandValue;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine($&quot;* Current Instruction Register: {opCode} {operand}&quot;);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;registers[PC] = registers[PC] + 1;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switch (opCode)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case &quot;LDA&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecuteLDA(memory, registers, operand); break;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case &quot;STA&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecuteSTA(memory, registers, operand); break;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case &quot;LDA#&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecuteLDAimm(registers, operand); break;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case &quot;ADD&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecuteADD(memory, registers, operand); break;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case &quot;JMP&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecuteJMP(registers, operand); break;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case &quot;JSR&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecuteJSR(memory, registers, operand); break;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case &quot;CMP#&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecuteCMPimm(registers, operand); break;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case &quot;BEQ&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecuteBEQ(registers, operand); break;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case &quot;SUB&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecuteSUB(memory, registers, operand); break;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case &quot;SKP&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecuteSKP(<b>registers</b>); break;&nbsp;&nbsp;<b>// MP1</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case &quot;RTN&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ExecuteRTN(memory, registers); break;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (registers[ERR] == 0)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;opCode = memory[registers[PC]].opCode;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DisplayCurrentState(sourceCode, memory, registers);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;opCode = &quot;HLT&quot;;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;}</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine(&quot;Execution terminated&quot;);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;}</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent2new"><b>Java</b></p>\r\n<p class="indent2new comp-top">void executeSKP(<b>int[] registers</b>) {&nbsp;&nbsp;<b>// MP4</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>registers[ACC] = registers[ACC] + 1;</b>&nbsp;&nbsp;<b>// MP2</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>setFlags(registers[ACC], registers);</b>&nbsp;&nbsp;<b>// MP3</b></p>\r\n<p class="indent2new comp">}</p>\r\n<p class="indent2new comp-top">void execute(String[] sourceCode, AssemblerInstruction[] memory)</p>\r\n<p class="indent2new comp-top">{</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;int[] registers = {0, 0, 0, 0, 0} ;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;setFlags(registers[ACC], registers);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;registers[PC] = 0;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;registers[TOS] = HI_MEM;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;int frameNumber = 0;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;displayFrameDelimiter(frameNumber);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;displayCurrentState(sourceCode, memory, registers);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;String opCode = memory[registers[PC]].opCode;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;while (!opCode.equals(&quot;HLT&quot;)) {</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;frameNumber += 1;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Console.println();</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;displayFrameDelimiter(frameNumber);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;int operand = memory[registers[PC]].operandValue;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Console.println(&quot;* Current instruction Register: &quot; + opCode + &quot; &quot; + operand);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;registers[PC] = registers[PC] + 1;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;switch (opCode) {</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case &quot;LDA&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;executeLDA(memory, registers, operand); break;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case &quot;STA&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;executeSTA(memory, registers, operand); break;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case &quot;LDA#&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;executeLDAimm(registers, operand); break;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case &quot;ADD&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;executeADD(memory, registers, operand); break;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case &quot;JMP&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;executeJMP(registers, operand); break;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case &quot;JSR&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;executeJSR(memory, registers, operand); break;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case &quot;CMP#&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;executeCMPimm(registers, operand); break;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case &quot;BEQ&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;executeBEQ(registers, operand); break;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case &quot;SUB&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;executeSUB(memory, registers, operand); break;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case &quot;SKP&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;executeSKP(<b>registers</b>); break;&nbsp;&nbsp;<b>// MP1</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case &quot;RTN&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;executeRTN(memory, registers); break;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;default:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;}</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;if (registers[ERR] == 0) {</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;opCode = memory[registers[PC]].opCode;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;displayCurrentState(sourceCode, memory, registers);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;} else {</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;opCode = &quot;HLT&quot;;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;}</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;}</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Console.println(&quot;Execution terminated&quot;);</p>\r\n<p class="indent2new comp">}</p>\r\n<p class="levelms">1</p>\r\n<p class="mark">[5]</p></h5>', 'examinerreport': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">This question was the first that required changes to be made to the skeleton program, and answers were of a good quality, with around seventy percent of students securing either full marks or three out of four on part (a).</p>\r\n<p class="indent1new">Where a mark was dropped in an otherwise correct response, it was that awarded for updating the status register, which was missed out rather than being attempted incorrectly.</p></h5>', 'notes': '', 'resources': ''}, 'Q23S1C13': {'question': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">This question adds validation to the <b>Skeleton Program</b>. The subroutine <span class="comp">EditSourceCode</span> asks the user to enter a line number. The line number must be an integer and the number of an existing line in the file containing the program.</p>\r\n<p class="indent1new">For example, the last line (line 11) of <span class="comp">prog2.txt</span> is:</p>\r\n<p class="indent2new m-t-0"><span class="comp">FINAL:&emsp;&emsp;&emsp;&emsp;0</span></p>\r\n<p class="indent1new">Therefore, a valid line number for <span class="comp">prog2.txt</span> would be an integer between 1 and 11 inclusive.</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1new"><b>What you need to do:</b></p>\r\n<p class="indent1new"><b>Task 1</b></p>\r\n<p class="indent1new m-t-0">Amend the subroutine <span class="comp">EditSourceCode</span> to check that the line number entered by the user is a valid existing line number. If an invalid value is entered the subroutine should output an appropriate error message. The program must not continue until a valid line number has been entered.</p>\r\n<p class="indent1new"><b>Task 2</b></p>\r\n<p class="indent1new m-t-0">Test that the changes you have made work by conducting the following test:</p>\r\n<p class="indent1">&#8226;&emsp;&emsp;&nbsp;run your amended <b>Skeleton Program</b></p>\r\n<p class="indent1 m-t-0">&#8226;&emsp;&emsp;&nbsp;enter <span class="comp">L</span></p>\r\n<p class="indent1 m-t-0">&#8226;&emsp;&emsp;&nbsp;load <b>prog2</b></p>\r\n<p class="indent1 m-t-0">&#8226;&emsp;&emsp;&nbsp;enter <span class="comp">E</span></p>\r\n<p class="indent1 m-t-0">&#8226;&emsp;&emsp;&nbsp;enter <span class="comp">Q</span></p>\r\n<p class="indent1 m-t-0">&#8226;&emsp;&emsp;&nbsp;enter <span class="comp">22</span></p>\r\n<p class="indent1 m-t-0">&#8226;&emsp;&emsp;&nbsp;enter <span class="comp">0</span></p>\r\n<p class="indent1 m-t-0">&#8226;&emsp;&emsp;&nbsp;enter <span class="comp">2</span></p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1new"><b>Evidence that you need to provide</b></p>\r\n<p class="indent1">(a)&emsp;&nbsp;Your PROGRAM SOURCE CODE for the entire subroutine <span class="comp">EditSourceCode</span>.</p>\r\n<p class="mark">(5)</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1">(b)&emsp;&nbsp;SCREEN CAPTURE(S) showing the requested test described in <b>Task 2</b>.</p>\r\n<p class="mark">(1)</p>\r\n<p class="mark">(Total 6 marks)</p></h5>', 'markscheme': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="questiona">(a)&emsp;&nbsp;<b>5 marks for AO3 (programming)</b></p>\r\n<p class="indent2new indentright"><b>Mark as follows:</b></p>\r\n<p class="indent2 indentright">1)&emsp;&ensp;&nbsp;Check for non-integer input;</p>\r\n<p class="indent2 indentright m-t-0">2)&emsp;&ensp;&nbsp;Check within valid lower boundary;</p>\r\n<p class="indent2 indentright m-t-0">3)&emsp;&ensp;&nbsp;Check within valid upper boundary;</p>\r\n<p class="indent2 indentright m-t-0">4)&emsp;&ensp;&nbsp;At least 2 correct checks will be repeated until valid data is input at which point the loop exits;</p>\r\n<p class="indent2 indentright m-t-0">5)&emsp;&ensp;&nbsp;Output suitable error message(s) under appropriate circumstances based upon at least 2 correct checks; <b>R.</b> if message is displayed when it should not be</p>\r\n<p class="indent2new indentright"><b>Max 4</b> if any errors</p>\r\n<p class="levelms">5</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1 indentright">(b)&emsp;&nbsp;<b>Mark is for AO3 (evaluate)</b></p>\r\n<p class="indent2new indentright"><b>&#42;&#42;&#42;&#42; SCREEN CAPTURE &#42;&#42;&#42;&#42;</b></p>\r\n<p class="indent2new indentright">Must match code from <b>(a)</b>, including prompts on screen capture matching those in code.</p>\r\n<p class="indent2new indentright m-t-0">Code for <b>(a)</b> must be sensible.</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent2new indentright">Screen capture showing:</p>\r\n<p class="indent2new indentright comp-top">Enter your choice: E</p>\r\n<p class="indent2new indentright comp">Enter line number of code to edit: Q</p>\r\n<p class="indent2new indentright comp">Not a valid number</p>\r\n<p class="indent2new indentright comp">Enter line number of code to edit: 22</p>\r\n<p class="indent2new indentright comp">Not a valid line number</p>\r\n<p class="indent2new indentright comp">Enter line number of code to edit: 0</p>\r\n<p class="indent2new indentright comp">Not a valid line number</p>\r\n<p class="indent2new indentright comp">Enter line number of code to edit: 2</p>\r\n<p class="indent3new indentright comp">&nbsp;&nbsp;&nbsp;&nbsp;SUB NUM1</p>\r\n<p class="indent2new indentright comp">E - Edit this line</p>\r\n<p class="indent2new indentright comp">C - Cancel edit</p>\r\n<p class="indent2new indentright comp">Enter your choice:</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent2new"><b>VB.Net</b></p>\r\n<p class="indent2new comp-top">Sub EditSourceCode(ByRef SourceCode() As String)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Dim Choice As String = EMPTY_STRING</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Dim LineNumber As Integer</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>Do</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Console.Write(&quot;Enter line number of code to edit: &quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>Dim Temp As String = Console.ReadLine</b>&nbsp;&nbsp;\' <b>MP1</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>If Not Integer.TryParse(Temp, LineNumber) Then</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>LineNumber = -1</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Console.WriteLine(&quot;Not a valid number&quot;)</b>&nbsp;&nbsp;\' <b>MP5</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>End If</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>Loop Until LineNumber &gt; 0 And LineNumber &lt;= Convert.ToInt32(SourceCode(0))</b>&nbsp;&nbsp;\' <b>MP2, MP3, MP4</b></p>\r\n<p class="indent2new comp-top">&nbsp;&nbsp;Console.WriteLine(SourceCode(LineNumber))</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;While Choice &lt;&gt; &quot;C&quot;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Choice = EMPTY_STRING</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;While Choice &lt;&gt; &quot;E&quot; And Choice &lt;&gt; &quot;C&quot;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine(&quot;E - Edit this line&quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine(&quot;C - Cancel edit&quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.Write(&quot;Enter your choice: &quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Choice = Console.ReadLine()</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;End While</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;If Choice = &quot;E&quot; Then</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.Write(&quot;Enter the new line: &quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SourceCode(LineNumber) = Console.ReadLine()</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;End If</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;DisplaySourceCode(SourceCode)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;End While</p>\r\n<p class="indent2new comp">End Sub</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent2new"><b>Python 3</b></p>\r\n<p class="indent2new comp-top">def EditSourceCode(SourceCode):</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>LineNumber = 0</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>NumberOfLines = int(SourceCode[0])</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>while LineNumber not in range(1, NumberOfLines + 1):</b>&nbsp;&nbsp;<b># MP2, MP3, MP4</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>try:</b>&nbsp;&nbsp;<b># MP1</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LineNumber = int(input(&quot;Enter line number of code to edit: &quot;))</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>if LineNumber not in range(1, NumberOfLines + 1):</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>print(&quot;Not a valid line number&quot;)</b>&nbsp;&nbsp;<b># MP5</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>except:</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>print(&quot;Not a valid number&quot;)</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;print(SourceCode[LineNumber])</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Choice = EMPTY_STRING</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;while Choice != &quot;C&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Choice = EMPTY_STRING</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;while Choice != &quot;E&quot; and Choice != &quot;C&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;E - Edit this line&quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;C - Cancel edit&quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Choice = input(&quot;Enter your choice: &quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;if Choice == &quot;E&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SourceCode[LineNumber] = input(&quot;Enter the new line:&quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;DisplaySourceCode(SourceCode)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;return SourceCode</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent2new m-t-1"><b>Alternative method:</b></p>\r\n<p class="indent2new comp-top">def EditSourceCode(SourceCode):</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>LineNumberStr =</b> input(&quot;Enter line number of code to edit: &quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>Valid = False</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>while not Valid:</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>if LineNumberStr.isdigit() and int(LineNumberStr) &gt; 0 and int(LineNumberStr) &lt;= int(SourceCode[0]):</b>&nbsp;&nbsp;<b># MP1, MP2, MP3, MP4</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Valid = True</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>LineNumber = int(LineNumberStr)</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>else:</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>print(&quot;Not a valid line number&quot;)</b>&nbsp;&nbsp;<b># MP5</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>LineNumberStr =</b> input(&quot;Enter line number of code to edit: &quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;print(SourceCode [LineNumber])</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Choice = EMPTY_STRING</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;while Choice != &quot;C&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Choice = EMPTY_STRING</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;while Choice != &quot;E&quot; and Choice != &quot;C&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;E - Edit this line&quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(&quot;C - Cancel edit&quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Choice = input(&quot;Enter your choice: &quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;if Choice == &quot;E&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SourceCode[LineNumber] = input(&quot;Enter the new line:&quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;DisplaySourceCode(SourceCode)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;return SourceCode</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent2new"><b>Python 2</b></p>\r\n<p class="indent2new comp-top">def EditSourceCode(SourceCode):</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>LineNumber = 0</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>NumberOfLines = int(SourceCode[0])</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>while LineNumber not in range(1, NumberOfLines + 1):</b>&nbsp;&nbsp;<b># MP2, MP3, MP4</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>try:</b>&nbsp;&nbsp;<b># MP1</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LineNumber = int(raw_input(&quot;Enter line number of code to edit: &quot;) .replace(&quot;\\r&quot;, &quot;&quot;))</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>if LineNumber not in range(1, NumberOfLines + 1):</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>print &quot;Not a valid line number&quot;</b>&nbsp;&nbsp;<b># MP5</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>except:</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>print &quot;Not a valid number&quot;</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;print SourceCode[LineNumber]</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Choice = EMPTY_STRING</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;while Choice != &quot;C&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Choice = EMPTY_STRING</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;while Choice != &quot;E&quot; and Choice != &quot;C&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print &quot;E - Edit this line&quot;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print &quot;C - Cancel edit&quot;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Choice = raw_input(&quot;Enter your choice: &quot;) .replace(&quot;\\r&quot;, &quot;&quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;if Choice == &quot;E&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SourceCode[LineNumber] = raw_input(&quot;Enter the new line: &quot;) .replace(&quot;\\r&quot;, &quot;&quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;DisplaySourceCode(SourceCode)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;return SourceCode</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent2new m-t-1"><b>Alternative method:</b></p>\r\n<p class="indent2new comp-top">def EditSourceCode(SourceCode):</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;LineNumberStr = raw_input(&quot;Enter line number of code to edit: &quot;) .replace(&quot;\\r&quot;, &quot;&quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>Valid = False</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>while not Valid:</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>if LineNumberStr.isdigit() and int(LineNumberStr) &gt; 0 and int(LineNumberStr) &lt;= int(SourceCode[0]):</b>&nbsp;&nbsp;<b># MP1, MP2, MP3, MP4</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Valid = True</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>LineNumber = int(LineNumberStr)</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>else:</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>print &quot;Not a valid line number&quot;</b>&nbsp;&nbsp;<b># MP5</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>LineNumberStr = raw_input(&quot;Enter line number of code to edit: &quot;) .replace(&quot;\\r&quot;, &quot;&quot;)</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;print SourceCode [LineNumber]</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Choice = EMPTY_STRING</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;while Choice != &quot;C&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Choice = EMPTY_STRING</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;while Choice != &quot;E&quot; and Choice != &quot;C&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print &quot;E - Edit this line&quot;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print &quot;C - Cancel edit&quot;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Choice = raw_input(&quot;Enter your choice: &quot;) .replace(&quot;\\r&quot;, &quot;&quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;if Choice == &quot;E&quot;:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SourceCode[LineNumber] = raw_input(&quot;Enter the new line:&quot;) .replace(&quot;\\r&quot;, &quot;&quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;DisplaySourceCode(SourceCode)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;return SourceCode</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent2new"><b>Pascal</b></p>\r\n<p class="indent2new comp-top">procedure EditSourceCode(var SourceCode: TSourceCode);</p>\r\n<p class="indent2new comp">var</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;LineNumber, <b>NumberOfLines</b>: integer;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Choice: string;</p>\r\n<p class="indent2new comp">begin</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>LineNumber := 0;</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>NumberOfLines := StrToInt(SourceCode[0]);</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>while (LineNumber &lt; 1) or (LineNumber &gt;= NumberOfLines) do</b>&nbsp;&nbsp;<b>// MP2, MP3, MP4</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>begin</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>try</b>&nbsp;&nbsp;<b>// MP1</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>write(\'Enter line number of code to edit: \');</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>readln(LineNumber);</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>if (LineNumber &lt; 1) or (LineNumber &gt;= NumberOfLines)</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>then</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>writeln(\'Not a valid line number\');</b>&nbsp;&nbsp;<b>// MP5</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>except</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>writeln(\'Not a valid number\');</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>end;</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>end;</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;writeln(SourceCode[LineNumber]);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Choice := EMPTY_STRING;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;while Choice &lt;&gt; \'C\' do</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;begin</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Choice := EMPTY_STRING;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;while (Choice &lt;&gt; \'E\') and (Choice &lt;&gt; \'C\') do</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;begin</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;writeln(\'E - Edit this line\');</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;writeln(\'C - Cancel edit\');</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;write(\'Enter your choice: \');</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;readln(Choice);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;end;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;if Choice = \'E\'</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;then</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;begin</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;writeln(\'Enter the new line:\');</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;readln(SourceCode[LineNumber]);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;DisplaySourceCode(SourceCode);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;end;</p>\r\n<p class="indent2new comp">end;</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent2new"><b>C#</b></p>\r\n<p class="indent2new comp-top">private static void EditSourceCode(string[] sourceCode)</p>\r\n<p class="indent2new comp">{</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;int lineNumber = 0;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>int numberOfLines = Convert.ToInt32(sourceCode[0]);</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>while (lineNumber &lt; 1 || lineNumber &gt;= numberOfLines)</b> <b>// MP2, MP3, MP4</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>{</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>Try</b> <b>// MP1</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>{</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.Write(&quot;Enter line number of code to edit: &quot;);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lineNumber = Convert.ToInt32(Console.ReadLine());</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>if (lineNumber &lt; 1 || lineNumber &gt;= numberOfLines)</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>{</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Console.WriteLine(&quot;Not a valid line number&quot;);</b> <b>// MP5</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>}</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>}</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>catch (Exception)</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>{</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Console.WriteLine(&quot;Not a valid number&quot;);</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>}</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>}</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Console.WriteLine(sourceCode[lineNumber]);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;string choice = EMPTY_STRING;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;while (choice != &quot;C&quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;{</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;choice = EMPTY_STRING;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;while (choice != &quot;E&quot; &amp;&amp; choice != &quot;C&quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;{</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine(&quot;E - Edit this line&quot;);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine(&quot;C - Cancel edit&quot;);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.Write(&quot;Enter your choice: &quot;);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;choice = Console.ReadLine();</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;}</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;if (choice == &quot;E&quot;)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;{</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine(&quot;Enter the new line:&quot;);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sourceCode[lineNumber] = Console.ReadLine();</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;}</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;DisplaySourceCode(sourceCode);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;}</p>\r\n<p class="indent2new comp">}</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent2new"><b>Java</b></p>\r\n<p class="indent2new comp-top">void editSourceCode(String[] sourceCode) {</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>int lineNumber;</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>do {</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Console.print(&quot;Enter line number of code to edit: &quot;);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>try {</b>&nbsp;&nbsp;<b>// MP1</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>lineNumber = Integer.parseInt(Console.readLine());</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>} catch (Exception e) {</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>lineNumber = 0;</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>}</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>if (lineNumber &lt; 1 || lineNumber &gt; sourceCode.length + 1)</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>{</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Console.println(&quot;Invalid line number please try again.&quot;);</b>&nbsp;&nbsp;<b>// MP5</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>}</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>} while (lineNumber &lt; 1 || lineNumber &gt; sourceCode.length + 1);</b>&nbsp;&nbsp;<b>// MP2, MP3, MP4</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Console.println(sourceCode[lineNumber]);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;String choice = EMPTY_STRING;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;while (!choice.equals(&quot;C&quot;)) {</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;choice = EMPTY_STRING;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;while (!choice.equals(&quot;E&quot;) &amp;&amp; !choice.equals(&quot;C&quot;)) {</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.println(&quot;E - Edit this line&quot;);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.println(&quot;C - Cancel edit&quot;);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.print(&quot;Enter your choice: &quot;);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;choice = Console.readLine();</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;}</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;if (choice.equals(&quot;E&quot;)) {</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.print(&quot;Enter the new line: &quot;);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sourceCode[lineNumber] = Console.readLine();</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;displaySourceCode(sourceCode);</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;}</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;}</p>\r\n<p class="indent2new comp">}</p>\r\n<p class="levelms">1</p>\r\n<p class="mark">[6]</p></h5>', 'examinerreport': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">This question required addition of validation code; the requirement was that any specified line number should exist within the assembly program. Although the lower bound was generally correct, since it would always be 1, the upper bound was commonly hard-coded rather than determined using a variable. Since the length of the assembly program could vary, hard-coding was not enough for the mark.</p>\r\n<p class="indent1new">Approximately half of the students secured either full marks or four out of five for part (a), although very few students were awarded two or three marks. That indicates that this question marks the beginning of the stage in which individual programming marks were cherry-picked due to constraints of time or understanding.</p></h5>', 'notes': '', 'resources': ''}, 'QS99N103': {'question': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">A computer program contains the following fragment:</p>  \r<p class="indent1new">Boolean: LY<br> <b>Integer</b>: Y<br> <span style=\'font-family:Symbol\'>¼</span><br> LY := (Y <b>mod</b> 4 = 0)&nbsp; <b>AND</b> ( <b>NOT</b> (Y <b>mod</b> 100 = 0) <b>OR</b> (Y <b>mod</b> 400 = 0) )</p>  \r<p class="indent1new">(The function A <b>mod</b> B returns the remainder when A is divided by B, eg. 11 <b>mod</b> 3 returns the value 2.)</p>  \r<p class="indent1">(a)&nbsp;&nbsp;&nbsp;&nbsp; What is meant by a Boolean variable?</p>  \r<p class="indent2new answer-toggle">___________________________________________________________________</p>  \r<p class="indent2new answer-toggle">___________________________________________________________________</p>  \r<p class="mark">(1)</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1">(b)&nbsp;&nbsp;&nbsp;&nbsp; What value would be assigned to the variable LY, if the variable Y contains </p>  \r<p class="indent2">(i)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1999?</p>  \r<p class="indent3new answer-toggle">______________________________________________________________</p>  \r<p class="mark">(1)</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent2">(ii)&nbsp;&nbsp;&nbsp;&nbsp; 2000?</p>  \r<p class="indent3new answer-toggle">______________________________________________________________</p>  \r<p class="mark">(1)</p>  \r<p class="mark">(Total 3 marks)</p></h5>', 'markscheme': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">&nbsp;</p>\r<p class="indent1 indentright m-t-0">(a)&nbsp;&nbsp;&nbsp;&nbsp; Variable with only two possible values, e.g. true/false, on/off</p>  \r<p class="levelms">1</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1a indentright" >(b)&nbsp;&nbsp;&nbsp;&nbsp; (i)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FALSE</p>  \r<p class="indent2 indentright">(ii)&nbsp;&nbsp;&nbsp;&nbsp; TRUE</p>  \r<p class="indent3 indentright">LY = F AND (NOT F OR F) = F AND (T OR F) = F AND T = F</p>  \r<p class="indent3 indentright">LY = T AND (NOT T OR T) = T AND (F OR T) = T AND T = T</p>  \r<p class="indent3 indentright"><i>1 mark each</i></p>\r<p class="levelms">2</p>  \r<p class="mark">[3]</p></h5>', 'examinerreport': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">Most candidates knew what a Boolean variable is but few could manipulate them - many clearly guessed the significance of 1999, 2000 and LY and wrote down the (correct) answers apparently conjured out of thin air. Many candidates clearly could not understand the distinction between 1999 mod 400, which is a numeric expression evaluating to 399, and 1999 mod 400 = 0, which is a statement capable of being evaluated as either true or false: consequently these candidates frequently asserted correctly that a Boolean variable is either 0 or 1, then promptly made the Boolean LY into 399 or other clearly impossible values.</p></h5>', 'notes': '', 'resources': ''}, 'QS18S1B09': {'question': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">The diagram shows an incomplete hierarchy chart for part of the <b>Skeleton Program</b>.</p>\r\n<p class="indent1new">With reference to the <b>Skeleton Program</b> and the diagram below, answer parts (a) and (b).</p>\r\n<p class="graph"><img src="AA_COM/QS18S1B09_files_Q/img01.jpg"/>&nbsp;</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1">(a)&emsp;&nbsp;What should be written in box <b>(a)</b> in the diagram?</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="mark">(1)</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1">(b)&emsp;&nbsp;What should be written in box <b>(b)</b> in the diagram?</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="mark">(1)</p>\r\n<p class="mark">(Total 2 marks)</p></h5>', 'markscheme': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="questiona indentright">(a)&emsp;&nbsp;<b>All marks for AO2 (analyse)</b></p>\r\n<p class="indent2new comp-top indentright">GetNextLetter;</p>\r\n<p class="indent2new indentright"><b>R.</b> if any additional code</p>\r\n<p class="indent2new m-t-0 indentright"><b>R.</b> if spelt incorrectly</p>\r\n<p class="indent2new m-t-0 indentright"><b>I.</b> case &amp; spacing</p>\r\n<p class="levelms">1</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1 indentright">(b)&emsp;&nbsp;<b>Mark is for AO2 (analyse)</b></p>\r\n<p class="indent2new comp-top indentright">GetNextSymbol;</p>\r\n<p class="indent2new indentright"><b>R.</b> if any additional code</p>\r\n<p class="indent2new m-t-0 indentright"><b>R.</b> if spelt incorrectly</p>\r\n<p class="indent2new m-t-0 indentright"><b>I.</b> case &amp; spacing</p>\r\n<p class="levelms">1</p> \r\n<p class="mark">[2]</p></h5>', 'examinerreport': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">The hierarchy chart was attempted well by most students.</p></h5>', 'notes': '', 'resources': ''}, 'Q22S1B09P2': {'question': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">State the identifier of a subroutine in the <b>Skeleton Program</b> that contains <b>definite</b> iteration.</p>\r\n<p class="indent1new answer-toggle">_______________________________________________________________________</p>\r\n<p class="indent1new answer-toggle">_______________________________________________________________________</p>\r\n<p class="mark">(Total 1 mark)</p></h5>', 'markscheme': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question"><b>Mark is for AO2 (analyse)</b></p>\r\n<p class="indent1new indentright comp-top">ResetDataStructures / LoadSolution / ResetAnswer / TransferAnswerIntoGrid / DisplayGrid / KeepPuzzle / CheckSolution / DisplayResults;</p>\r\n<p class="indent1new indentright"><b>R.</b> if any additional code</p>\r\n<p class="indent1new indentright m-t-0"><b>R.</b> if spelt incorrectly</p>\r\n<p class="indent1new indentright m-t-0"><b>I</b> case and spacing</p>\r\n<p class="mark">[1]</p></h5>', 'examinerreport': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">This question required students to identify subroutines that contained examples of definite and indefinite iteration. The majority of students secured this mark.</p></h5>', 'notes': '', 'resources': ''}, 'Q22S1B07': {'question': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">The grid size of the puzzle is currently 9 and sub-grids are 3 x 3.</p>\r\n<p class="indent1new">If the grid size were to be increased to 16, the sub-grids would be 4 x 4 and the hexadecimal digits 0 1 2 3 4 5 6 7 8 9 A B C D E F could be used to solve the puzzle.</p>\r\n<p class="indent1new">Describe <b>two</b> changes that would need to be made to the subroutine <span class="comp">DisplayGrid</span> to enable this.</p>\r\n<p class="indent1new">You should not make any changes to the <b>Skeleton Program</b> to answer this question.</p>\r\n<p class="indent1new answer-toggle">_______________________________________________________________________</p>\r\n<p class="indent1new answer-toggle">_______________________________________________________________________</p>\r\n<p class="indent1new answer-toggle">_______________________________________________________________________</p>\r\n<p class="indent1new answer-toggle">_______________________________________________________________________</p>\r\n<p class="mark">(Total 2 marks)</p></h5>', 'markscheme': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question"><b>2 marks for AO3 (design)</b></p>\r\n<p class="indent1new indentright">Row/Column heading numbers need to be extended;</p>\r\n<p class="indent1new indentright m-t-0">Row/Column headers formatted to occupy two positions;</p>\r\n<p class="indent1new indentright m-t-0">Sub-grid lines need to extended horizontally; <b>I.</b> vertically</p>\r\n<p class="indent1new indentright m-t-0">Grid lines need to extended horizontally; <b>I.</b> vertically</p>\r\n<p class="indent1new indentright m-t-0">Sub-grid lines need to be after 4 rows / columns // column / row need to be divisible by 4 for sub-grid lines // the 3s need to be changed to 4s;</p>\r\n<p class="indent1new indentright"><b>R.</b> reference to alterations outside the <span class="comp">DisplayGrid</span> subroutine.</p>\r\n<p class="indent1new indentright"><b>Max 2</b></p>\r\n<p class="mark">[2]</p></h5>', 'examinerreport': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">Many students secured both marks for this question, with only twenty-seven percent failing to pick up any marks.</p>\r\n<p class="indent1new">The question required changes to be described that would apply to a single subroutine of the skeleton program. Some students, in describing changes outside this subroutine, dropped a mark. Others described the same change in two different ways and only gained one mark.</p></h5>', 'notes': '', 'resources': ''}, 'QS171PM': {'question': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question"><b>CAPTURE THE SARRUM</b></p>\r\n<p class="indent1new">The <b>Skeleton Program</b> is for the board game CAPTURE THE SARRUM.</p>\r\n<p class="indent1new">CAPTURE THE SARRUM is an ancient variant of the game of chess. It is a two player game &#8211; one player has the white pieces and the other player has the black pieces. Each player takes it in tum to move one of their pieces; different pieces have different rules that determine how they can move. To win the game a player needs to take (capture) the opponent&#8217;s sarrum. The player using the white pieces always moves first.</p>\r\n<p class="indent1new"><b>Figure 1</b> shows an empty board. The board consists of an 8 &#215; 8 grid of squares. The rows are called <b>ranks</b> and the columns are called <b>files</b>. Each file is labelled with a number between one and eight and each rank is also labelled with a number between one and eight.</p>\r\n<p class="graph"><b>Figure 1</b></p>\r\n<p class="graph"><img src="AA_COM/QS171PM_files_Q/img01.png"/>&nbsp;</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1new">In <b>Figure 2</b> the third file has been shaded.</p>\r\n<p class="graph"><b>Figure 2</b></p>\r\n<p class="graph"><img src="AA_COM/QS171PM_files_Q/img02.png"/>&nbsp;</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1new">In <b>Figure 3</b> the second rank has been shaded.</p>\r\n<p class="graph"><b>Figure 3</b></p>\r\n<p class="graph"><img src="AA_COM/QS171PM_files_Q/img03.png"/>&nbsp;</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1new">There are six different types of piece in the game; the rules for moving each of the pieces are described in <b>Table 1</b>. If a piece moves into a square containing one of the opponent&#8217;s pieces then that piece is taken (it is removed from the board). No piece can move into a square containing another piece of the same colour.</p>\r\n<p class="graph"><b>Table 1</b></p>\r\n<p class="bottom">&nbsp;</p>\r\n<table class="data-table left1">\r\n\t<tr>\r\n\t\t<td class="col-6"><p class="padded text-left"><b>Piece name</b></p></td>\r\n\t\t<td class="col-18"><p class="padded text-left"><b>How the piece moves</b></p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-6"><p class="padded text-left">Sarrum (king)</p></td>\r\n\t\t<td class="col-18 vert-top"><p class="padded text-left">A sarrum can move one square at a time in any  direction.</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-6 vert-top"><p class="padded text-left">Marzaz pani (royal attendant)</p></td>\r\n\t\t<td class="col-18 vert-top"><p class="padded text-left">A marzaz pani can move one square at a time either vertically or horizontally &#8211; it cannot make diagonal moves.</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-6 vert-top"><p class="padded text-left">Nabu (seer)</p></td>\r\n\t\t<td class="col-18 vert-top"><p class="padded text-left">A nabu can move one square at a time along a diagonal &#8211; it cannot make horizontal or vertical moves.</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-6 vert-top"><p class="padded text-left">Etlu (warrior)</p></td>\r\n\t\t<td class="col-18 vert-top"><p class="padded text-left">An etlu can move two squares at a time in either a vertical or horizontal line &#8211; it must move exactly two squares and it cannot make diagonal moves. An etlu can jump over other pieces.</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-6 vert-top"><p class="padded text-left">Gisgigir (chariot)</p></td>\r\n\t\t<td class="col-18 vert-top"><p class="padded text-left">A gisgigir can move any number of squares at a time in either a vertical or horizontal line &#8211; it cannot make diagonal moves. A gisgigir cannot jump over other pieces.</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-6 vert-top"><p class="padded text-left">Redum (soldier)</p></td>\r\n\t\t<td class="col-18 vert-top">\r\n\t\t<p class="padded text-left">A redum can move foiward one square at a time. If the square directly in front  of a redum is empty then the redum can move into that square.</p>\r\n\t\t<p class="padded text-left">If a square that is one rank in front of and directly to the left or right of a redum contains an opponent&#8217;s piece, then the redum can move into that square and will capture the piece.</p>\r\n\t\t<p class="padded text-left">If a redum reaches the back rank (the first rank for a white redum, the eighth rank for a black redum) it is promoted (changes) into a marzaz  pani.</p>\r\n\t\t\r\n\t\t</td>\r\n\t</tr>\r\n</table></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1new"><b>Figure 4</b> shows the position of the pieces at the start of a game of CAPTURE THE SARRUM. Each piece has been represented using the first letter of its name eg <span class="comp">s</span> = sarrum. <span class="comp">A B</span> is used to indicate a black piece and <span class="comp">a W</span> indicates a white piece.</p>\r\n<p class="graph"><b>Figure 4</b></p>\r\n<p class="graph"><img src="AA_COM/QS171PM_files_Q/img04.png"/>&nbsp;</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1new">In <b>Figure 5</b> shaded squares in the diagrams show the legal moves that a piece can make.</p>\r\n<p class="graph"><b>Figure 5</b></p>\r\n<p class="bottom">&nbsp;</p>\r\n<table class="data-table left2">\r\n\t<tr>\r\n\t\t<td class="col-15 no-border"><p class="padded text-left"><img src="AA_COM/QS171PM_files_Q/img05.png"/>&nbsp;</p></td>\r\n\t\t<td class="col-6 no-border"><p class="padded text-left">White&#8217;s sarrum <b>can</b> move one square in any direction.</p></td>\r\n\t</tr>\r\n</table></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><table class="data-table left2">\r\n\t<tr>\r\n\t\t<td class="col-15 no-border"><p class="padded text-left"><img src="AA_COM/QS171PM_files_Q/img06.png"/>&nbsp;</p></td>\r\n\t\t<td class="col-6 no-border"><p class="padded text-left">White&#8217;s marzaz pani <b>can</b> move one square vertically or horizontally.</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-15 no-border"><p class="padded text-left"><img src="AA_COM/QS171PM_files_Q/img07.png"/>&nbsp;</p></td>\r\n\t\t<td class="col-6 no-border"><p class="padded text-left">White&#8217;s marzaz pani <b>cannot</b> move to a square containing another white piece.</p></td>\r\n\t</tr>\r\n</table></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><table class="data-table left2">\r\n\t<tr>\r\n\t\t<td class="col-15 no-border"><p class="padded text-left"><img src="AA_COM/QS171PM_files_Q/img08.png"/>&nbsp;</p></td>\r\n\t\t<td class="col-6 no-border"><p class="padded text-left">White&#8217;s nabu <b>can</b> move one square in a diagonal direction.</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-15 no-border"><p class="padded text-left"><img src="AA_COM/QS171PM_files_Q/img09.png"/>&nbsp;</p></td>\r\n\t\t<td class="col-6 no-border"><p class="padded text-left">White&#8217;s etlu <b>can</b> move two squares in a vertical or horizontal direction.</p></td>\r\n\t</tr>\r\n</table></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><table class="data-table left2">\r\n\t<tr>\r\n\t\t<td class="col-15 no-border"><p class="padded text-left"><img src="AA_COM/QS171PM_files_Q/img10.png"/>&nbsp;</p></td>\r\n\t\t<td class="col-6 no-border"><p class="padded text-left">White&#8217;s etlu <b>cannot</b> move into the same square as another white piece but <b>can</b> move into the same square as a black piece (the black piece will be captured). An etlu <b>can</b> jump over other pieces of either colour.</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-15 no-border"><p class="padded text-left"><img src="AA_COM/QS171PM_files_Q/img11.png"/>&nbsp;</p></td>\r\n\t\t<td class="col-6 no-border"><p class="padded text-left">White&#8217;s gisgigir <b>can</b> move any number of squares in a straight line, either horizontally or vertically.</p></td>\r\n\t</tr>\r\n</table></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><table class="data-table left2">\r\n\t<tr>\r\n\t\t<td class="col-15 no-border"><p class="padded text-left"><img src="AA_COM/QS171PM_files_Q/img12.png"/>&nbsp;</p></td>\r\n\t\t<td class="col-6 no-border"><p class="padded text-left">White&#8217;s gisgigir <b>cannot</b> move to a square occupied by another white piece and it <b>cannot</b> jump over other pieces.</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-15 no-border"><p class="padded text-left"><img src="AA_COM/QS171PM_files_Q/img13.png"/>&nbsp;</p></td>\r\n\t\t<td class="col-6 no-border"><p class="padded text-left">White&#8217;s redum <b>can</b> move one square forward; it <b>cannot</b> move diagonally forward unless it is capturing a black piece.</p></td>\r\n\t</tr>\r\n</table></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><table class="data-table left2">\r\n\t<tr>\r\n\t\t<td class="col-15 no-border"><p class="padded text-left"><img src="AA_COM/QS171PM_files_Q/img14.png"/>&nbsp;</p></td>\r\n\t\t<td class="col-6 no-border"><p class="padded text-left">White&#8217;s redum <b>can</b> either move one square forward or it can move diagonally forward one square to capture the black marzaz pani.</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-15 no-border"><p class="padded text-left"><img src="AA_COM/QS171PM_files_Q/img15.png"/>&nbsp;</p></td>\r\n\t\t<td class="col-6 no-border"><p class="padded text-left">White&#8217;s redum <b>cannot</b> move to the square immediately in front of it as this is occupied by another piece; it <b>can</b> move diagonally forward one square to capture either the black marzaz pani or the black sarrum.</p></td>\r\n\t</tr>\r\n</table></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><table class="data-table left2">\r\n\t<tr>\r\n\t\t<td class="col-15 no-border"><p class="padded text-left"><img src="AA_COM/QS171PM_files_Q/img16.png"/>&nbsp;</p></td>\r\n\t\t<td class="col-6 no-border"><p class="padded text-left">White&#8217;s redum has no legal moves.</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-15 no-border"><p class="padded text-left"><img src="AA_COM/QS171PM_files_Q/img17.png"/>&nbsp;</p></td>\r\n\t\t<td class="col-6 no-border"><p class="padded text-left">Black&#8217;s redum <b>can</b> either move one square forward or it can capture the white etlu - it <b>cannot</b> move to the square containing the black gisgigir.</p></td>\r\n\t</tr>\r\n</table></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1new">When the Skeleton Program is run, the user is given the option to play using a sample game. If they choose to play the sample game then the initial board position will be as shown in <b>Figure 6</b>; otherwise the initial board position will be as shown in <b>Figure 4</b>.</p>\r\n<p class="graph"><b>Figure 6</b></p>\r\n<p class="graph"><img src="AA_COM/QS171PM_files_Q/img18.png"/>&nbsp;</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1new">When the sample game starts it is White\'s move.</p>\r\n<p class="indent1new">To enter a move the player types in the grid reference of the square containing the piece that they would like to move (the start square) and then the grid reference of the square that they would like  to move the selected piece to (the finish square). A grid reference is the number of the file followed by the number of the rank, eg in <b>Figure 6</b> the grid reference 41 indicates the position of Black\'s sarrum. If the move entered is a legal move then the board will be updated and it will now be the other player\'s turn.</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1new"><b>Figure 7</b>, <b>Figure 8</b> and <b>Figure 9</b> show three examples of White entering a move and the positions after these moves, from the start position shown in <b>Figure 6</b>.</p>\r\n<p class="graph"><b>Figure 7</b></p>\r\n<p class="graph">White enters a start square of 13 and a finish square of 23.</p>\r\n<p class="graph"><img src="AA_COM/QS171PM_files_Q/img19.png"/>&nbsp;</p>\r\n<p class="graph">White\'s sarrum has captured Black\'s etlu.</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="graph"><b>Figure 8</b></p>\r\n<p class="graph">White enters a start square of 81 and a finish square of 41.</p>\r\n<p class="graph"><img src="AA_COM/QS171PM_files_Q/img20.png"/>&nbsp;</p>\r\n<p class="graph">White\'s gisgigir has captured Black\'s sarrum and wins the game.</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="graph"><b>Figure 9</b></p>\r\n<p class="graph">White enters a start square of 12 and a finish square of  13.</p>\r\n<p class="graph m-t-0">A message saying \'That is not a legal move &ndash; please try again\' is  displayed.</p>\r\n<p class="graph m-t-0">White then enters a start square of 12 and a finish square of  21.</p>\r\n<p class="graph"><img src="AA_COM/QS171PM_files_Q/img21.png"/>&nbsp;</p>\r\n<p class="graph">White\'s redum has captured Black\'s gisgigir and White\'s redum has reached the</p>\r\n<p class="graph m-t-0">eighth rank and so is promoted to a marzaz pani.</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1new">The game continues until one of the players captures the opponent\'s sarrum. The user is then  given the option to play another game &ndash; if they don\'t choose to play another game then this will exit the <b>Skeleton Program</b>.</p>\r\n<p class="indent1new"><b>Notes</b></p>\r\n<p class="indent1new">Your chosen programming language may use arrays with a lower bound value of <span class="comp">O</span>. If so, array ells with indices of <span class="comp">O</span> are not used.</p></h5>', 'markscheme': '', 'examinerreport': '', 'notes': '', 'resources': ''}}
User: Now, the user will ask questions after this message. Use everything I gave you and the knowledge you have acquired, and from the notes you made, to answer their question in a very concise way that WILL score ALL marks. Just like the notes. For this, your answer will not have the same structure as the revision notes. Think of it as answering an exam question: short, consice, useful, scores ALL marks. Just like the exam questions provided to you, you will not leave your response in a 'notes' manner. You are just answering an exam question: which means it has to be very short unless explicitly specified by the user that it must be long and detailed. So, keep it short, concise, and only a couple of sentences that score ALL marks. Remember, it is an A-Level exam question and you will style it as such: incredibly concise sentences (essentially like bullet points but without the bullet points) that score marks. Most sentences won't even have commas, this does not mean you can't use them. Also do not repeat the question in your answer, just do it. Score all marks, assume how many marks there are based on the question if it is not provided to you. Imagine that for every sentence you make, you score a mark (for simpler questions), for high (>5 mark) questions that may differ.
In summary, you must:
* Answer very concisely. Kind of like bullet points but as a short para. Most of the time, a sentence, or point, will be a mark.
* Do not repeat the question at the start.
* Don't over-do your answer. Please. 1 mark (e.g., usually, 'What' questions) is like one very short sentence usually. Remember the summary from the notes? Your answer will essentially be like that for most questions but a bit (a bit!) more developed. Remember, this is just A-Levels. Use some of the exam questions that I provided as an example of how you should model your answers.
* When you're listing examples, don't list every example in the universe.
* Score all marks. Be helpful.
User: Write the notes you made
Assistant: **Programming Concepts (Spec Points: 3.1.1.2)**

**Assignment:**  
Assigns a value to a variable. Example: `Age = 25`. (from QS00A205: `(a) X := Y+Z`)

**Selection:**  
Allows the program to choose a path based on conditions. Example:  
```If Age < 18 Then  
    Output = "Not old enough to vote"  
Else  
    Output = "Old enough to vote"  
End If```  
(from QS00A205: `(b) IF X > 10 THEN PRINT “GOOD”`)

**Repetition (Iteration):**  
Repeating a sequence of instructions until a certain condition is met. Example:  
```For Counter = 1 To 5  
    Print("Hello")  
Next```  
(from QS00A205: `(c) WHILE X < 10 DO`)

**Definite Iteration:**  
The number of iterations is known before execution.  
(from Q22S1B09P1: `Definite iteration: the number of iterations is known at the time of execution`)

**Indefinite Iteration:**  
The number of iterations depends on a condition that is tested before or after each iteration.  
(from Q22S1B09P1: `Indefinite iteration: the number of iterations depends on a condition tested before or after each iteration`)

**Nested Selection:**  
Implementing conditional logic within another conditional. Example:  
```If condition1 Then  
    If condition2 Then  
        Statement  
    End If  
End If```

**Nested Iteration:**  
Loops within loops. Example:  
```For i = 1 To 5  
    For j = 1 To 5  
        Print(i, j)  
    Next  
Next```

**High-Level Language Examples:**  
- Assignment: `result = a + b`  
- Selection: `When y < 20 THEN display "Below"`  
- Iteration: `For m = 1 to 10 Print("Welcome")`

**Useful Terms**  
- **Variable Declaration:** Define a variable (e.g., `Integer age`)
- **Constant Declaration:** Define an immutable value (e.g., `const PI = 3.14`)
- **Subroutine (Procedure/Function):** A block of code designed to perform a particular task. Example:  
  ```Function add(x,y)  
      Return x + y  
  End Function```

**Definitions:**

- **Sequence:** The order of processing steps.
- **Selection (Choice):** Making decisions based on criteria.
- **Iteration (Repetition):** Repeated execution of instructions.
- **Assignment:** Assigning a value to a variable.
- **Nesting:** Placing one set of instructions within another.
- **Syntax:** Language grammar rules.

**Summary:**
- Programming involves sequences, selections, iterations, and assignment.
- Sequences instruct the correct order.
- Selections allow conditional paths.
- Iterations repeat instructions till a condition is met.

**Try These Exam Questions:**

1. **Q22S1B09P1:** Explain differences between definite and indefinite iteration.  
   **Answer:** Definite iteration: number of iterations known at execution; Indefinite iteration: number depends on a condition tested before/after each iteration.

2. **QS00A205:** Examples of programming statements.  
   **Answer:** Assignment: `X := Y+Z;` Selection: `IF X > 10 THEN PRINT “GOOD”` Repetition: `WHILE X < 10 DO`

3. **QS99N103:** Boolean variables and expressions.  
   **Answer:** Boolean: Two possible values (true/false); LY: 1999 = FALSE, 2000 = TRUE

4. **QS18S1B09:** Hierarchy chart subroutines.  
   **Answer:** GetNextLetter; GetNextSymbol
User: now write it in condensed bullet-points, like short bullet-points like you are answering a question kind of. But score ALL marks in your notes
Assistant: