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: 143 Basic operations in programming languagesINTRODUCTION There are a number of basic operations that you can perform on text and numeric data when programming. These fall into four main categories: arithmetic operations, relational operations, Boolean operations and string handling. In this chapter all of these basic operations are explained with simple examples to illustrate each. The examples are based on Visual Basic and there is also a look-up table at the end the chapter to show these how these basic operations could be implemented in Python and C#.LEARNING OBJECTIVES In this chapter you will learn: •the correct syntax for writing basic programming code•how to construct arithmetic operations, Boolean operations andrela tional operations•how to handle basic string operations •how Visual Basic, Python and C# implement these operations.
 When programming, the syntax for each operation will vary depending on which language you are using. In practice, when creating full programs you will be using many of these operations in combination to perform particular tasks. In Sections Two and Three, you will see many of these basic operations being used in context. When programming, values are likely to come from a variable  or constant, or be gener ated as part of the program. For example, an assignment statement that adds two numbers together may use three variables called Answer, FirstNumber and SecondNumber: Answer = FirstNumber + SecondNumber5 = 3 + 2SPECIFICATION COVERAGE 3.1.1.3 Arithmetic operations in a programming language3.1.1.4 Relational operations in a programming language3.1.1.5 Boolean operations in a programming language3.1.1.7 String-handling operations in a programming language3.1.1.8 Random number generation in a programming languageKEYWORD Variable: a data item whose value will  change during the execution of the program.ARITHMETIC OPERATIONS 15Note that in some languages these operations can be carried out on numeric values or text strings. For example: txtAnswer = txtFirstVariable + txtSecondVariableDavidSmith = David + SmithThis has implications for the programmer as you might expect a simple addition of 2 + 2 to equal 4. However, 2 + 2 could also result in the answer 22 if the programmer has not defined the values as integers. This is one reason why it is good practice to declare variables at the beginning of every program, so that the program knows how to handle the data. ●Arithmetic operationsMost of these are the standard mathematical operations that you use everyday such as add, subtract, multiply and divide. ●Addition: The sum of two or more values. Example: 5 = 3 + 2 orAns wer = FirstNumber + SecondNumber .
 ●Subtraction: One value minus another. Example: 2 = 5 – 3 orAns wer = FirstNumber - SecondNumber .
 ●Multiplication: The product of two values. Example: 6 = 3 * 2 orAnswer = FirstNumber * SecondNumber . ●Division of real numbers: A real number is one with a fractional part so may result in an answer with a fractional part. Example: 3.1 = 6.2/2 or Answer = FirstNumber / SecondNumber  (where all variableshave been declared as Real or Float). ●Division of integers: An integer is a whole number and therefore maygener ate a number with a remainder. Example: 3r1 = 7/2 or Answer= FirstNumber / SecondNumber  (where all variables have been declared as Integer). The DIV operation can also be used in the formatAnswer = FirstNumber DIV SecondNumber  in which case thequotient and remainder are calculated simultaneously. ●Modulo operation: The modulo or MOD operator is used to divide onenumber by another to find the remainder. Example: 1 = 7 MOD 2 or Answer = FirstNumber MOD SecondNumber as 7/2 = 3r1. ●Exponentiation: Repeated multiplication of a base number in the formBn where B is the base number and n is the number of times to repeat the multiplication. For example 2 4 is 2 × 2 × 2 × 2. Example: 16 = 2 ^ 4or Answer = FirstNumber ^ SecondNumber .
 ●Rounding: Replacing the real value with a simpler representation thatis clos e to the original value. For example, 2.315432 becomes 2.3.
 There are various methods for rounding  within each programming language such as rounding up and down, or rounding to a specific number of decimal places. Example: 2 = Round(2.3) or Answer =Round(FirstNumber) . ●Truncating: Shortening a value by cutting it off after a certain numberof di gits. It is the equivalent of rounding down. There are variousmethods for truncating  within each programming language. Example: 2 = Trun cate (2.345) or Answer = Truncate(FirstNumber) where FirstNumber is a decimal value.
 ●Random number generation: Creating a number to be used in a programthat is random. There are several methods of doing this. Often the number is set to be generated between two fixed values. There areKEYWORD Arithmetic operation: common expr essions such as +, –, /, ×.
 KEYWORDSRounding: reducing the number of digitsused to represent a number while maintaining a value that is approximately equivalent. Truncating: the process of cutt ing off a number after a certain number of characters or decimal places.163 Basic operations in programming languagesvarious methods within each programming language. For example: 0.123 = Rnd ()  or Answer = Rnd() . Random numbers are a very useful tool for programmers. Typical applications include: – Creating a range of test data to be used on a new program– Producing data to use in computer simulations– Creating random events and movements in computer games– Selecting a random sample from a dataset. However, as most random number generation  techniques usedin prog ramming languages start from a seed value and then use analgorithm to create the random number, it means that the numbercannot be truly random as the algorithm used will produce an elementof structure to the results. Consequently, random numbers generatedby programming languages are often referred to as pseudo-random numbers . This is perfectly adequate for the purposes listed above but in other circumstances, such as encryption, this level of randomness would not be sufﬁcient.
 ●Relational operations work by making comparisons between two dataitems. Th ey consist of operands and operators where the operands are thevalues and the operator is the comparison being made. For example, inthe operation A > B, A and B are the operands and > is the operator. Mostprogramming languages recognise the standard method for representingthese operators as shown in Table 3.1.KEYWORDS Random number generation: a function  that produces a completely random number. Pseudo-random  number generator: common  in progr amming languages, a function that produces a random number that is not 100% random.
 KEYWORDRelational operations: expressions that compare two values such as equal to or greater than.
 Relational operations are often performed in order to create selection statements. For example: If A > 1 Then...  means if A is 2 or more then the next action is carried out. In common with all operations, the comparisons could also be made between textual data as well as numerical data.
 ●Boolean operations  are those which result in either a TRUE or a FALSE answer. Boolean algebra is used in logic circuits and is an underlying principle to how modern computers work. It is also fundamental to theprocess of searching data whether that is in a database, or on the web. Oncethe Boolean operation has been evaluated, a further action is then taken. Forexample, on a database search, a subset of data would be created containingrecords that met the search criteria. The examples below are based on ascenario where an online dataset is being searched to find a new car.KEYWORDBoolean operations: expressions that result in a TRUE or FALSE value.Relational operator SignEqual to = or == Not equal to < >or != Less than <Greater than > Less than or equal to Greater than or equal to Table 3.1 Table of relational operatorsSTRING-HANDLING FUNCTIONS 17The four basic operations are: ●AND: This is known as a conjunction as it adds together the data. Forexam ple, using the search phrase “Four Door AND Less than 3 years old” would return a value of TRUE only if both conditions were met, so thecar would need to have four doors AND be less than 3 years old. ●OR: This is known as a disjunction, which means that a TRUE result isprodu ced if any of the conditions are met. For example, in the search phrase “Four Door OR Three Door”, only one of the conditions needs to bemet to get a TRUE result, so all three- and four-door cars would be listed.
 ●NOT: This is known as a negation as it reverses the input. For example,“NOT Ford” would result in data that did NOT contain the word Ford. ●XOR: This is known as an exclusive OR and means that a TRUE resultis prod uced when one or the other condition is met but not both. For example, “Sunroof XOR Air conditioning” would result in data wherethe car either had a sunroof or air conditioning, but not both. XORoperations are used extensively when creating logic gates and there ismore on this in Chapter 30.
 You may have noticed that it is possible to embed relational operators within Boolean operations. For example, “Four Door AND Less than 3 years old” uses the less than  operator. It is also possible to join lots of Boolean operations together to produce the desired outcome. For example, a very specific search might be: “Four Door AND Less than 3 years old AND Ford OR Vauxhall NOT Fiat”. ●String-handling functionsAt the beginning of the chapter we saw that it is possible to carry outoperations on numbers and text data. This section looks specifically at theway in which text can be handled. To be more precise, this section looksat how strings can be handled. A string is a sequence of characters and canactually be made up of text, numbers and symbols. There are many situationswhere you will need to work with strings to produce the desired outcome, forexample, searching for strings of characters or combining strings together. KEYWORD String-handling functions: actions that can be carried out on sequences of characters.Figure 3.1 Venn diagrams to represent the four basic Boolean operations.B A ANDB AORB A XORB A NOTKEYWORDSAND: Boolean operation that outputs true if both inputs are  true.
 OR: Boolean operation that outputs true if either of its inputs are true.NOT: Boolean operation that inverts the result so true  becomes false and false becomes true. XOR: Boolean operation that is true if ei ther input is true but not if both inputs are true.183 Basic operations in programming languages●Length: The length of the string is how many characters are used to storea parti cular item of data. The string length is often variable although there is usually an upper limit placed on its size. There are variousoperations that you can carry out using the string length. For example,you may want to set the maximum length or calculate the length of aparticular string of data. For example: Dim LastName As String  is used to define a string data type and Len (Variable1)  calculates thelength of data value stored in Variable1 . ●Position: Within a text string it is possible to identify the position ofevery cha racter. This is useful when you want to extract particularcharacters from the string or identify substrings within the data. Thereare various operations that you can carry out. For example, to find thestart position of a particular string of characters within another string: Txt = "JohnSmith22HighStreetLeicester"AddressPosition = InStr(txt,"22HighStreet")This would return a value of 10 in this example as that is the positionwhere the address data starts within the string being searched. Thisassumes that the start position is 1. Some languages take the startposition as 0, in which case this would return a value of 9. ●Substring: A substring is a string contained within another string as shownin the e xample above. Various techniques can be used to extract data fromanywhere in a string to create a substring providing the start and endposition are known or the start position and length are known. For example: txt= "JohnSmith22HighStreetLeicester"txtAddress = str.Substring (10,21)This would create the substring “22HighStreetLeicester” and store it in avariable called txtAddress . It does this by starting at position 10 of the string and then extracting the next 21 characters.
 ●Concatenation: This is the process of adding strings together to createanother st ring. For example: txtFirstName = "John"txtLastName = "Smith"txtFullName = txtFirstName + txtLastName This would create the value “JohnSmith” stored in a variable calledtxtFullName . ●Character codes: Every character that you can use on a computer includingall the keyboard characters has a corresponding character code , which is used to id entify it. This might be an ASCII code or Unicode (see Chapter 26).
 This can be used in various ways, for example, if you need to convert a textvalue to a numeric value in order to carry out a calculation on it. You mightdo this when encrypting data. For example: asc(Variable1)  returns the ASCII code value of the value stored inVariable1  where Variable1  is a text character.  chr(Variable1)  returns the text character where Variable1  is anASCII code.  chrW(Variable1)  returns the Unicode code value of Variable1where Variable1  is a text character.In addition to converting strings to character codes, there are a number of other conversions that a programmer might need to do in order to manipulate the data further. Most programming languages include specific functions to carry out these conversions.KEYWORD Character code: a binary repre sentation of a particular letter, number or special character.EXAMPLES OF COMMON OPERATIONS  IN PYTHON AND C#19●String to Integer / Integer to String: An integer is a whole number. Somepro gramming languages convert between the two automatically if the two variables are declared correctly. For example: Dim i as IntegerDim s as Stringi = 1s = i This would result in s (a string) becoming 1 (an integer). The same code could be used to reverse the process.
 ●String to Float / Float to String: A float is also called a real number andis any number including those with a fractional part. In Visual Basic, a function exists to carry out this conversion: Convert.ToDouble(x) will convert the text string x into a Doubledata type, used by Visual Basic to store real numbers.  Convert.ToString(n)  will convert the real number n into a string.
 ●String to Date-time / Date-Time to String: Date-time is usually storedwith built-in formatting such as dd.mm.yyyy and hh: mm: ss. To manipulate individual parts of the data, it can be converted into a string. Most programming languages have built-in functions. For example, inVisual Basic: DateTime.ToString(date)  converts the date and time into a stringString.ToDateTime(String)  converts a string into date-time format. ●Examples of common operationsin Python and C# Table 3.2 gives some examples of how these common operations can bexecuted in both Python and C#. Note that there will be other ways ofimplementing these operations based on the specific requirements of theprogram being written. You will notice that there are some commonalities between programminglanguages and some operations that are handled completely differently.203 Basic operations in programming languagesTable 3.2 Common operations in Python and C# Operation or functionPython example C# example Add c = a + b c = a + bSubtract c = a – b c = a – b Multiply c = a * b c = a * b Divide real number c = a / b c = a / bDivide integer c = a//b Int c = a / b Modulo c = a % b c = a % bExponentiation c = a ** b or exp(n) math.Pow (a,b) Round round (x[,n]) math.Round()Truncate round (x[, n])Truncates according to the size inputmath.Truncate (a, n)Truncates the value of a to n placesRandom number generationrandom() random() Substring var1 = "JohnSmith"print var1[0: 4] Prints “ John”string input = "JohnSmith"string sub = input.Substring (0, 4)Returns the value “John”Concatenation c = a + b c = a + b Convert character to character codeChr()  gives the character code value of the characterOrd()  gives the integer value of the characterEncoding,ASCII,GetBytes ()  converts a character to an ASCII codeconvert.ToChar()  converts an ASCII code to a characterConvert string to integer int()  converts a string to an integer str() converts an integer to a string.ToInt32  converts a string to a 32-bit integer.ToString  converts an integer to a string where the variable before the dot is an integerConvert string to date-time time.strftime(format[,t])  converts a string into a time with a specified formatConvertToDateTime(dateString)  converts date-time to stringDateTime.Parse()  converts the string contained in the brackets into a date-time formatConvert string to float float()  converts string to float str()  converts float to string.ToFloat converts a string to a float where the value before the dot is a string.ToString  converts a float to a string where the variable before the dot is an integerPractice questions can be found at the end of the section on pages 46 and 47.
 EXAMPLES OF COMMON OPERATIONS  IN PYTHON AND C#21TASKS1 Write an example of a calculation using each of the arithmetic operators. 2 What is the difference between a division of a real/float and the  division of an integer?3 Most calculations will get their values from variables. Why are variables  used in programming rather than just typing the raw values?4 Use examples to explain the difference between truncation and rounding.
 5 Why might random numbers be used?6 What is the difference between an OR statement and an XOR statement? Give an example.7 How can you create a substring from a string? 8 What formats can strings be converted into?9 Why are random numbers generated in programming languages not entirely random? STUDY / RESEARCH TASKS1 Write code for a calculator app that allows the user to enter one or  two numbers and then carry out all of the main arithmetic operations.2 Write code for an app that allows the user to input two numbers and  then carry out each of the relational operators returning an output of TRUE or FALSE.3 Write code for an app that extracts the vowels from the alphabet. 4 Write code for an app that takes the numbers 1–10 and extracts them  into odd and even numbers. 5 Research how Google uses Boolean operators to create accurate search results.6 Is it possible to produce a completely random number?KEY POINTS •The syntax of a languagedescribes the rules that you must follow.
 •Arithmetic operations includecommon processes such as add, subtract, multiply anddivide.
 •Other arithmetic operationsinclude rounding, truncating and exponentiation.
 •Most languages include arandomnumber generator. •Relational operationscompare two or more valuesto produce a result. •Boolean operations return atrue or  false value and includeAND, OR, NOT and XOR. •Different types of operationscan becombined to create more complex expressions.
 •String handling is the processof identifying and extracting sequences of characters froma string of characters.
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.5 Boolean operations in a programming language
Content
Additional information
Be familiar with and be able to use:
NOT
AND
OR
XOR.

3.1.1.7 String-handling operations in a programming language
Content
Additional information
Be familiar with and be able to use:
length
position
substring
concatenation
character → character code
character code → character
string conversion operations.
Expected string conversion operations:
string to integer
string to float
integer to string
float to string
date/time to string
string to date/time.

3.1.1.8 Random number generation in a programming language
Content
Additional information
Be familiar with, and be able to use, random number generation.

3.1.1.4 Relational operations in a programming language
Content
Additional information
Be familiar with and be able to use:
equal to
not equal to
less than
greater than
less than or equal to
greater than or equal to.

3.1.1.3 Arithmetic operations in a programming language
Content
Additional information
Be familiar with and be able to use:
addition
subtraction
multiplication
real/float division
integer division, including remainders
exponentiation
rounding
truncation.


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.e': [{'index1': '|D.A$|D.C$|', 'index2': '|3$|', 'index3': '2$', 'index4': 'S1$.1.e | S4$.1.a | L1$.1.e | L4$.1.a', 'index5': '|', 'index6': 'QSPL1A01', 'qid': 'QSPL1A01', 'des': 'Logic puzzle: murder mystery', 'index7': '', 'marks': '3 marks', 'time': '4', 'ttext': 'Programming concepts | Practical programming', 'fld': 'AA_COM', 'fil': 'QSPA1A01', 'year': 2014, 'res': '', 'flag1': 0}, {'index1': '|A$|C.E$|', 'index2': '|3$|', 'index3': '2$', 'index4': 'S1$.1.e | L1$.1.e', 'index5': '|', 'index6': 'QSPL211', 'qid': 'QSPL211', 'des': 'Boolean equations', 'index7': '', 'marks': '6 marks', 'time': '9', 'ttext': 'Theory of computing | Logic and logic gates', 'fld': 'AA_COM', 'fil': 'QSPA211', 'year': 2014, 'res': '', 'flag1': 0}, {'index1': '|C.E$|D.A$|', 'index2': '|3$|', 'index3': '3$', 'index4': 'S1$.1.e | S5$.4.a | L1$.1.e | L5$.4.a', 'index5': '|', 'index6': 'QS00N208', 'qid': 'QS00N208', 'des': 'Logical operations', 'index7': '', 'marks': '4 marks', 'time': '6', 'ttext': 'Logic and logic gates | Programming concepts', 'fld': 'AA_COM', 'fil': 'QS00N208', 'year': 0, 'res': '', 'flag1': 0}, {'index1': '|C.E$|', 'index2': '|3$|', 'index3': '3$', 'index4': 'S1$.1.e | L1$.1.e', 'index5': '|', 'index6': 'QS00N402', 'qid': 'QS00N402', 'des': 'Machine operations masking', 'index7': '', 'marks': '2 marks', 'time': '3', 'ttext': 'Logic and logic gates', 'fld': 'AA_COM', 'fil': 'QS00N402', 'year': 0, 'res': '', 'flag1': 0}], 'S1$.1.g': [{'index1': '|D.A$|K$|', 'index2': '|2$|', 'index3': '3$', 'index4': 'S1$.1.g | S1$.1.k | S2$.1.c', 'index5': '|12$|', 'index6': 'Q20S1B09', 'qid': 'Q20S1B09', 'des': 'State purpose of a parameter and describe how data processed in Skeleton Program', 'index7': '', 'marks': '4 marks', 'time': '5', 'ttext': 'Programming concepts | Preliminary material', 'fld': 'AA_COM', 'fil': 'Q20S1B09', 'year': 2020, 'res': '/RESOURCES/AA_COM/RESOURCES/AS_P1_Section_B_Summer2020.html', 'flag1': None}, {'index1': '|B.A$|', 'index2': '|1$|', 'index3': '2$', 'index4': 'S1$.1.g | S5$.5 | S5$.5.a | S5$.5.b | S5$.5.c | L1$.1.g | L5$.5.a | L5$.5.b | L5$.5.c', 'index5': '|', 'index6': 'QS121A02', 'qid': 'QS121A02', 'des': 'ASCII conversion; parity bit', 'index7': '', 'marks': '4 marks', 'time': '4', 'ttext': 'Character representation', 'fld': 'AA_COM', 'fil': 'QS121A02', 'year': 2012, 'res': '', 'flag1': 0}], 'S1$.1.h': [{'index1': '|D.A$|D.B$|', 'index2': '|3$|', 'index3': '2$', 'index4': 'S1$.1.b | S1$.1.h | S2$.1 | L1$.1.b | L1$.1.h | L2$.1', 'index5': '|', 'index6': 'QS11306', 'qid': 'QS11306', 'des': 'Simulation', 'index7': '', 'marks': '5 marks', 'time': '8', 'ttext': 'Programming concepts | Algorithms', 'fld': 'AA_COM', 'fil': 'QS11306', 'year': 2011, 'res': '', 'flag1': 0}], 'S1$.1.d': [{'index1': '|D.A$|D.B$|', 'index2': '|2$|', 'index3': '2$', 'index4': 'S1$.1.b | S1$.1.d | S2$.1.b | S4$.1.b', 'index5': '|', 'index6': 'Q23S1A02', 'qid': 'Q23S1A02', 'des': 'Trace table; pseudo-code', 'index7': '', 'marks': '5 marks', 'time': '7', 'ttext': 'Programming concepts | Algorithms', 'fld': 'AA_COM', 'fil': 'Q23S1A02', 'year': 2023, 'res': '', 'flag1': 0}, {'index1': '|D.D$|K$|', 'index2': '|2$|', 'index3': '3$', 'index4': 'S1$.1 | S1$.1.d | S1$.1.e | S4$.1.b', 'index5': '|1$|', 'index6': 'Q23S1B10', 'qid': 'Q23S1B10', 'des': 'Explain code; conditions', 'index7': '', 'marks': '2 marks', 'time': '3', 'ttext': 'Data structures | Preliminary material', 'fld': 'AA_COM', 'fil': 'Q23S1B10', 'year': 2023, 'res': '/RESOURCES/AA_COM/RESOURCES/2023_AS_SectionB_resources.html', 'flag1': 0}, {'index1': '|D.A$|K$|', 'index2': '|2$|', 'index3': '3$', 'index4': 'S1$.1.b | S1$.1.d | S4$.1.b', 'index5': '|1$|', 'index6': 'Q23S1B11', 'qid': 'Q23S1B11', 'des': 'Explain code; for; loop; if; while; iteration', 'index7': '', 'marks': '6 marks', 'time': '8', 'ttext': 'Programming concepts | Preliminary material', 'fld': 'AA_COM', 'fil': 'Q23S1B11', 'year': 2023, 'res': '/RESOURCES/AA_COM/RESOURCES/2023_AS_SectionB_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$|K$|', 'index2': '|2$|', 'index3': '2$', 'index4': 'S1$.1.b | S1$.1.d', 'index5': '|12$|', 'index6': 'Q20S1B10', 'qid': 'Q20S1B10', 'des': 'Explain the purpose of a subroutine in the Skeleton Program', 'index7': '', 'marks': '2 marks', 'time': '2', 'ttext': 'Programming concepts | Preliminary material', 'fld': 'AA_COM', 'fil': 'Q20S1B10', 'year': 2020, 'res': '/RESOURCES/AA_COM/RESOURCES/AS_P1_Section_B_Summer2020.html', 'flag1': None}], 'S1$.1.c': [{'index1': '|D.A$|D.C$|D.D$|H.B$|K$|', 'index2': '|2$|', 'index3': '1$', 'index4': 'S1$.1.a | S1$.1.b | S1$.1.c | S1$.1.d | S1$.1.e | S1$.1.k | S2$.1.b | S3$.1.d | S4$.1.a', 'index5': '|1$|', 'index6': 'Q23S1C14', 'qid': 'Q23S1C14', 'des': 'Modify code for ExecuteJSR; return address; parameter; subroutine; array', 'index7': '', 'marks': '5 marks', 'time': '7', 'ttext': 'Programming concepts | Practical programming | Data structures | Testing | Preliminary material', 'fld': 'AA_COM', 'fil': 'Q23S1C14', 'year': 2023, 'res': '/RESOURCES/AA_COM/RESOURCES/2023_AS_SectionC_resources.html', 'flag1': 0}, {'index1': '|D.A$|D.B$|D.D$|', 'index2': '|2$|', 'index3': '2$', 'index4': 'S1$.1 | S1$.1.b | S1$.1.c | S1$.1.j | S1$.1.l | S2$.1.b | S4$.1.b', 'index5': '|', 'index6': 'Q22S1A01', 'qid': 'Q22S1A01', 'des': 'Complete trace table for algorithm that uses data in a list and DIV; list; array', 'index7': '', 'marks': '5 marks', 'time': '7', 'ttext': 'Programming concepts | Algorithms | Data structures', 'fld': 'AA_COM', 'fil': 'Q22S1A01', 'year': 2023, 'res': '', 'flag1': None}, {'index1': '|D.A$|D.B$|', 'index2': '|2$|', 'index3': '3$', 'index4': 'S1$.1.b | S1$.1.c | S4$.1.b', 'index5': '|', 'index6': 'Q20S1A02', 'qid': 'Q20S1A02', 'des': 'Complete trace table for algorithm to add numbers; identify error in algorithm', 'index7': '', 'marks': '5 marks', 'time': '6', 'ttext': 'Programming concepts | Algorithms', 'fld': 'AA_COM', 'fil': 'Q20S1A02', 'year': 2020, 'res': '', 'flag1': None}, {'index1': '|B.B$|', 'index2': '|1$|', 'index3': '3$', 'index4': 'S1$.1.c | S5$.4.a | S5$.4.b | L1$.1.c | L5$.4.a | L5$.4.b', 'index5': '|', 'index6': 'QS121A01', 'qid': 'QS121A01', 'des': 'Binary addition', 'index7': '', 'marks': '3 marks', 'time': '3', 'ttext': 'Number representation', 'fld': 'AA_COM', 'fil': 'QS121A01', 'year': 2012, 'res': '', '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}]}

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: {'QSPA1A01': {'question': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">The famous detective John Stout was called in to solve a perplexing murder mystery. He determined the following facts.</p>\r<p class="indent2">a&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Nathan, the murdered man, was killed by a blow on the head.</p>\r<p class="indent2 m-t-0">b&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Either Suzanne or Martin was in the dining room at the time of the murder.</p>\r<p class="indent2 m-t-0">c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Peter was in the kitchen at the time of the murder, then Ian killed Nathan using poison.</p>\r<p class="indent2 m-t-0">d&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Suzanne was in the dining room at the time of the murder, then Steve killed Nathan.</p>\r<p class="indent2 m-t-0">e&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Peter was not in the kitchen at the time of the murder, then Martin was not in the dining room when the murder was committed.</p>\r<p class="indent2 m-t-0">f&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If Martin was in the dining room at the time the murder was committed, then Paul killed Nathan.</p>\r<p class="indent2 m-t-0">g&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If Kevin was in the hall at the time of the murder, then Suzanne killed Nathan by a blow to the neck with a saucepan.</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1">(a) &nbsp;&nbsp;&nbsp;&nbsp;Who murdered Nathan?</p>\r<p class="indent2"><b>A</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Paul</p>\r<p class="indent2 m-t-0"><b>B</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Steve</p>\r<p class="indent2 m-t-0"><b>C</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Suzanne</p>\r<p class="indent2 m-t-0"><b>D</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ian</p>\r<p class="indent2 m-t-0"><b>E</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;It is not possible for John Stout to solve the crime.</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;Explain how you know your answer to (a) is correct.</p>\r<p class="indent2new answer-toggle">Use the space below for rough working.</p>\r<p class="indent2new answer-toggle">&nbsp;</p>\r<p class="indent2new answer-toggle">&nbsp;</p>\r<p class="indent2new answer-toggle">&nbsp;</p>\r<p class="indent2new answer-toggle">&nbsp;</p>\r<p class="indent2new answer-toggle">&nbsp;</p>\r<p class="indent2new answer-toggle">___________________________________________________________________</p>\r<p class="indent2new answer-toggle">___________________________________________________________________</p>\r<p class="indent2new answer-toggle">___________________________________________________________________</p>\r<p class="indent2new answer-toggle">___________________________________________________________________</p>\r<p class="mark">(2)</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 m-t-0">(a) &nbsp;&nbsp;&nbsp;&nbsp;<b>Mark is for AO2 (apply)</b><br><b>1 mark</b>: B;</span></p>\r<p class="levelms">1</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1 indentright">(b) &nbsp;&nbsp;&nbsp;&nbsp;<b>All marks AO2 (analyse)</b><br>Nathan was not killed with poison (rule a);</p>\r<p class="indent2 indentright m-t-0">therefore Peter was not in the kitchen (rule c);</p>\r<p class="indent2 indentright m-t-0">therefore Martin was not in the dining room (rule e);</p>\r<p class="indent2 indentright m-t-0">therefore Suzanne was in the dining room (rule b);</p>\r<p class="indent2 indentright m-t-0">therefore Steve murdered Nathan (rule d).</p>\r<p class="indent2new indentright"><b>Mark as follows:</b></p>\r<p class="indent2 indentright m-t-0"><b>1 mark:</b> Any correct point from the list above;</p>\r<p class="indent2 indentright m-t-0"><b>1 mark:</b> Any two further correct points from the list above;</p>\r<p class="levelms">2</p> \r<p class="mark">[3]</p></h5>', 'examinerreport': '', 'notes': '', 'resources': ''}, 'QSPA211': {'question': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">&nbsp;</p>\r<p class="indent1 m-t-0">(a) &nbsp;&nbsp;&nbsp;&nbsp;The table below lists six Boolean equations. Three of them are correct, the others are not. Shade the lozenges next to the <b>three</b> equations that are correct.</p>\r<p class="bottom">&nbsp;</p>\r<table class=MsoTableGrid cellspacing=0 cellpadding=5 style=\'margin-top:0.0cm; margin-left:120.0pt;border-collapse:collapse;\'> \r\t<tr>\r\t\t<td style=\'width:120.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=boxl><b>Equation</b></p></td>\r\t\t<td style=\'width:140.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=boxl><b>Correct? (Shade three)</b></p></td>\r\t</tr>\r\t<tr>\r\t\t<td style=\'width:120.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=boxl>A &#x22C5;<img style="position:relative; top:1.0pt;" src="AA_COM/QSPA211_files_Q/img03.png"/> = 1</p></td>\r\t\t<td style=\'width:140.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><img style="vertical-align:middle;" src="AA_COM/QSPA211_files_Q/img02.png"/></p></td>\r\t</tr>\r\t<tr>\r\t\t<td style=\'width:120.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=boxl>A + B = <img style="position:relative; top:2.0pt;" src="AA_COM/QSPA211_files_Q/img04.png"/></p></td>\r\t\t<td style=\'width:140.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><img style="vertical-align:middle;" src="AA_COM/QSPA211_files_Q/img02.png"/></p></td>\r\t</tr>\r\t<tr>\r\t\t<td style=\'width:120.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=boxl>A + 1 = 1</p></td>\r\t\t<td style=\'width:140.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><img style="vertical-align:middle;" src="AA_COM/QSPA211_files_Q/img02.png"/></p></td>\r\t</tr>\r\t<tr>\r\t\t<td style=\'width:120.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=boxl>A &#x22C5;( A + B ) = A</p></td>\r\t\t<td style=\'width:140.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><img style="vertical-align:middle;" src="AA_COM/QSPA211_files_Q/img02.png"/></p></td>\r\t</tr>\r\t<tr>\r\t\t<td style=\'width:120.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=boxl>A + ( A &#x22C5;B ) = B</p></td>\r\t\t<td style=\'width:140.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><img style="vertical-align:middle;" src="AA_COM/QSPA211_files_Q/img02.png"/></p></td>\r\t</tr>\r\t<tr>\r\t\t<td style=\'width:120.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=boxl>A &#x22C5;1 = 1</p></td>\r\t\t<td style=\'width:140.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><img style="vertical-align:middle;" src="AA_COM/QSPA211_files_Q/img02.png"/></p></td>\r\t</tr>\r</table>\r<p class="mark">(3)</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1">(b) &nbsp;&nbsp;&nbsp;&nbsp;Use Boolean algebra to simplify the following expression:</p>\r<p class="graph"><img align="middle;" src="AA_COM/QSPA211_files_Q/img01.png"/>&nbsp;</p>\r<p class="indent2new">Show your working.</p>\r<p class="indent2new answer-toggle">___________________________________________________________________</p>\r<p class="indent2new answer-toggle">___________________________________________________________________</p>\r<p class="indent2new answer-toggle">___________________________________________________________________</p>\r<p class="indent2new answer-toggle">___________________________________________________________________</p>\r<p class="indent2new answer-toggle">___________________________________________________________________</p>\r<p class="rightnew answer-toggle">Answer ___________________________</p>\r<p class="mark">(3)</p> \r<p class="mark">(Total 6 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;&nbsp;<b>All marks AO1 (understanding)</b></p>\r<p class="bottom">&nbsp;</p>\r<table class=MsoTableGrid cellspacing=0 cellpadding=5 style=\' margin-left:60.0pt;border-collapse:collapse;\'> \r\t<tr>\r\t\t<td valign="top" style=\'width:80.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=boxl><b>Equation</b></p></td>\r\t\t<td style=\'width:80.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=boxl><b>Correct?<br/>(Shade three)</b></p></td>\r\t</tr>\r\t<tr>\r\t\t<td style=\'width:80.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=boxl>A &#x0387; <img align=top  src="AA_COM/MSPA211_files_M/img01.png"/> = 1</p></td>\r\t\t<td style=\'width:80.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box>&nbsp;</p></td>\r\t</tr>\r\t<tr>\r\t\t<td style=\'width:80.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=boxl>A + B = <img align=top src="AA_COM/MSPA211_files_M/img02.png"/></p></td>\r\t\t<td style=\'width:80.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><img align=top  src="AA_COM/MSPA211_files_M/img03.png"/></p></td>\r\t</tr>\r\t<tr>\r\t\t<td style=\'width:80.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=boxl>A + 1 = 1</p></td>\r\t\t<td style=\'width:80.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><img align=top  src="AA_COM/MSPA211_files_M/img03.png"/></p></td>\r\t</tr>\r\t<tr>\r\t\t<td style=\'width:80.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=boxl>A &#x0387; (A + B) = A</p></td>\r\t\t<td style=\'width:80.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><img align=top  src="AA_COM/MSPA211_files_M/img03.png"/></p></td>\r\t</tr>\r\t<tr>\r\t\t<td style=\'width:80.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=boxl>A + (A &#x0387; B) = B</p></td>\r\t\t<td style=\'width:80.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box>&nbsp;</p></td>\r\t</tr>\r\t<tr>\r\t\t<td style=\'width:80.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=boxl>A &#x0387; 1 = 1</p></td>\r\t\t<td style=\'width:80.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box>&nbsp;</p></td>\r\t</tr>\r</table>\r<p class="indent2new indentright"><b>If more than three lozenges shaded then take the number of incorrect answers from the number of correct answers to arrive at the total mark</b></p>\r<p class="levelms">3</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1 indentright">(b) &nbsp;&nbsp;&nbsp;&nbsp;<b>All marks AO2 (apply)</b></p>\r<p class="indent2new indentright">Example solution:</p>\r<p class="indent2new indentright"><img align="middle;" src="AA_COM/MSPA211_files_M/img04.png"/>&nbsp;</p>\r<p class="indent2new indentright">= A &#x0387; B + B&#x0387;<img align="middle;" src="AA_COM/MSPA211_files_M/img01.png"/>&nbsp;</p>\r<p class="indent2new indentright">= B&#x0387;( + <img align="middle;" src="AA_COM/MSPA211_files_M/img01.png"/>)</p>\r<p class="indent2new indentright">= B &#x0387; 1</p>\r<p class="indent2new indentright">= B</p>\r<p class="indent2new indentright"><b>In any attempted solution award:</b></p>\r<p class="indent2new indentright"><b>1 mark</b> for an application of DeMorgan\'s law</p>\r<p class="indent2new indentright m-t-0"><b>1 mark</b> for an application of a Boolean identity or expanding the brackets</p>\r<p class="indent2new indentright m-t-0"><b>1 mark</b> for correct answer</p>\r<p class="indent2new indentright m-t-0"><b>A</b> alternative methods of solution but must use Boolean algebra not truth table</p>\r<p class="levelms">3</p> \r<p class="mark">[6]</p></h5>', 'examinerreport': '', 'notes': '', 'resources': ''}, 'QS00N208': {'question': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">What would be the result of performing <b>each</b> of the following logical operations?</p>  \r<p class="indent1">(a)&nbsp;&nbsp;&nbsp;&nbsp; NOT 01001111</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; 00110000 OR 00000010</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">(c)&nbsp;&nbsp;&nbsp;&nbsp; 11000001 AND 00010011</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">(d)&nbsp;&nbsp;&nbsp;&nbsp; 00000101 XOR 10001110</p>  \r<p class="indent2new answer-toggle">___________________________________________________________________</p>  \r<p class="mark">(1)</p>  \r<p class="mark">(Total 4 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">(i)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10110000</p>  \r<p class="levelms">1</p>  \r<p class="indent1 indentright" style=\'margin-left:64.35pt;text-indent:-36.0pt\'>(ii)<span style=\'font:7.0pt "Times New Roman"\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>00110010</p>  \r<p class="levelms">1</p>  \r<p class="indent1 indentright" style=\'margin-left:64.35pt;text-indent:-36.0pt\'>(iii)<span style=\'font:7.0pt "Times New Roman"\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>00000001</p>  \r<p class="levelms">1</p>  \r<p class="indent1 indentright">(iv)&nbsp;&nbsp;&nbsp;&nbsp; 10001011</p>  \r<p class="levelms">1</p>  \r<p class="mark">[4]</p></h5>', 'examinerreport': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">Those candidates that were prepared for this question usually got full marks. The XOR operation proved the most difficult.</p></h5>', 'notes': '', 'resources': ''}, 'QS00N402': {'question': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">The diagram below shows two masking operations.</p>  \r<p class="graph"><img id="Picture 1" src="AA_COM/QS00N402_files_Q/image001.png">&nbsp;</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1">(a)&nbsp;&nbsp;&nbsp;&nbsp; Give the content of Result 1 when Mask 1 is applied to Test using the AND operation.</p>  \r<p class="indent2new answer-toggle">___________________________________________________________________</p>  \r<p class="mark">(1)</p>  \r<p class="indent1">(b)&nbsp;&nbsp;&nbsp;&nbsp; What logical operation must be used to produce Result 2 when Mask 2 is applied to Set?</p>  \r<p class="indent2new answer-toggle">___________________________________________________________________</p>  \r<p class="mark">(1)</p>  \r<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">&nbsp;</p>\r<p class="indent1 indentright m-t-0">(a)&nbsp;&nbsp;&nbsp;&nbsp; 00001000</p>  \r<p class="levelms">1</p>  \r<p class="indent1 indentright">(b)&nbsp;&nbsp;&nbsp;&nbsp; Or / XOr</p>  \r<p class="levelms">1</p>  \r<p class="mark">[2]</p></h5>', 'examinerreport': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">Almost all candidates answered this correctly. Those who did get it wrong seemed to have little knowledge of masking.</p></h5>', 'notes': '', 'resources': ''}, 'Q20S1B09': {'question': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question m-b-1">This question refers to the subroutines <span class="comp">Graphics</span> and <span class="comp">LoadFile</span></p>\r\n<p class="indent1">(a)&emsp;&nbsp;State what values are passed in the parameter <span class="comp-top">Header</span> to the subroutine <span class="comp">LoadFile</span> when <span class="comp">LoadFile</span> is called for the <b>first</b> time in the subroutine <span class="comp">Graphics</span></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;Explain how the content of <span class="comp">HeaderLine</span> is processed after it has been assigned a value.</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="mark">(3)</p>\r\n<p class="mark">(Total 4 marks)</p></h5>', 'markscheme': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="questiona">(a)&emsp;&nbsp;<b>Mark is for AO2 (analyse)</b> </p>\r\n<p class="indent2new indentright">The default values of the file header;</p>\r\n<p class="indent2new indentright m-t-0">Empty string, <span class="comp">MAX_WIDTH, MAX_HEIGHT</span>, empty string;</p>\r\n<p class="indent2new indentright"><b>A.</b> \'\'\'\' / \'\' / <span class="comp">EMPTY_STRING</span> for empty string</p>\r\n<p class="indent2new indentright m-t-0"><b>A.</b> 100 for <span class="comp">MAX_WIDTH</span> and/or <span class="comp">MAX_HEIGHT</span></p>\r\n<p class="indent2new indentright"><b>Max 1</b></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>3 marks for AO2 (analyse)</b> </p>\r\n<p class="indent2new indentright">The string is split into separate parts;</p>\r\n<p class="indent2new indentright m-t-0">Delimited by a comma;</p>\r\n<p class="indent2new indentright m-t-0">Each part is assigned to a field of the header record;</p>\r\n<p class="indent2new indentright m-t-0"><b>A.</b> File type is used to determine which subroutine is called;</p>\r\n<p class="indent2new indentright"><b>Max 3</b></p>\r\n<p class="levelms">3</p>\r\n<p class="mark">[4]</p></h5>', 'examinerreport': '', 'notes': '', 'resources': ''}, 'QS121A02': {'question': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">The ASCII system uses 7 bits to represent a character. The ASCII code in denary for the numeric character &#x2018;0&#x2019; is 48; other numeric characters follow on from this in sequence.</span></p>\r<p class="indent1">(a) &nbsp;&nbsp;&nbsp;&nbsp;Using 7 bits, express the ASCII code for the character &#x2018;2&#x2019; in binary.</p>\r<p class="indent2new">Characters are transmitted using an 8-bit code that includes a single parity bit in the most significant bit. A parity bit is added for error checking during data transmission.</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;Using odd parity, what 8-bit code is sent for the numeric character &#x2018;0&#x2019;&#x003F;</p>\r<p class="indent2new answer-toggle">___________________________________________________________________</p>\r<p class="mark">(2)</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1new">Hamming code is an alternative to the use of a single parity bit.</p>\r<p class="indent1">(c) &nbsp;&nbsp;&nbsp;&nbsp;State <b>one</b> advantage of using Hamming code instead of a single parity bit.</p>\r<p class="indent2new answer-toggle">___________________________________________________________________</p>\r<p class="indent2new answer-toggle">___________________________________________________________________</p>\r<p class="mark">(1)</p> \r<p class="mark">(Total 4 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; 011 0010;</span></p>\r<p class="indent2new indentright m-t-0"><b>R</b> If not 7 bits</p>\r<p class="levelms">1</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1 indentright">(b) &nbsp;&nbsp;&nbsp;&nbsp;1011 0000</p>\r<p class="indent2new indentright"><b>Mark as follows:</b><br/>Correct data bits;<br/>Correct parity bit for the candidate&#x2019;s data bits;<br/><b>R</b> If not 8 bits</p>\r<p class="levelms">2</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1 indentright">(c) &nbsp;&nbsp;&nbsp;&nbsp;Error correction (not just error detection) (for single errors);<br/>Can detect when two errors have occurred in data transmission;<br/>Reduces the need for the retransmission of data;<br/>Decreases the likelihood of an undetected error // improved error detection;<br/>Can locate an error (not just detect that an error has occurred);</p>\r<p class="levelms">Max 1</p> \r<p class="mark">[4]</p></h5>', 'examinerreport': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">This question was generally well-answered. For part (a), some students did not use the number of bits specified in the question and some used even parity instead of odd parity. Part (b) was the first COMP1 question about Hamming code. Many students were able to give an advantage of Hamming code although occasionally answers were too vague, eg, "It can detect errors" and there were some students who clearly had no understanding of the topic and were just guessing eg, "It uses less memory."</span></p></h5>', 'notes': '', 'resources': ''}, 'QS11306': {'question': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">A computer simulation is to be used to imitate the flow of students through a school canteen. The simulation will be based on a model developed by the school&#x2019;s canteen manager and a Computing student.</span></p>\r<p class="indent1">(a) &nbsp;&nbsp;&nbsp;&nbsp;In the context of simulation, explain what a model is.</p>\t\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;Students must queue at a particular serving point in the canteen if they wish to purchase hot food.</p>\r<p class="indent2new">The Computing student intends to represent the queue of students waiting to be served as a dynamic data structure using a linked list.</p>\r<p class="indent2">(i)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Explain what pointers the student will need to create and what they will be used for.</p>\r<p class="indent3new answer-toggle">______________________________________________________________</p>\r<p class="indent3new answer-toggle">______________________________________________________________</p>\r<p class="indent3new answer-toggle">______________________________________________________________</p>\r<p class="indent3new answer-toggle">______________________________________________________________</p>\r<p class="mark">(2)</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent2">(ii)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Teachers are able to bypass the students in the queue by walking past them. However, a teacher may not always go directly to the very front of the queue as it may contain teachers already. In which case, the teacher joins the queue at the point just behind the other teachers.</p>\r<p class="indent3new">What type of queue would the Computing student use to represent this situation&#x003F;</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="indent1">(c) &nbsp;&nbsp;&nbsp;&nbsp;The Computing student decides that she will need to use the random number generator in the programming language that she is using to develop the simulation.</p>\r<p class="indent2new"> Give <b>one</b> example of something that she might need to use random numbers for when producing this simulation.</p>\r<p class="indent2new answer-toggle">___________________________________________________________________</p>\r<p class="indent2new answer-toggle">___________________________________________________________________</p>\r<p class="mark">(1)</p> \r<p class="mark">(Total 5 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; </span> An abstraction / leaving out non-essential details // A mathematical <br>representation of reality;</p>\r<p class="levelms">1</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1 indentright">(b) &nbsp;&nbsp;&nbsp;&nbsp;<i>1 mark for naming or describing <b>two</b> pointers from this list:</i></p>\r<p class="indent2 indentright">&#x2022;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Front/start/head pointer</p>\r<p class="indent2 indentright m-t-0">&#x2022;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Next node pointer</p>\r<p class="indent2 indentright m-t-0">&#x2022;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Previous node pointer</p>\r<p class="indent2 indentright m-t-0">&#x2022;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rear/end/tail pointer</p>\r<p class="indent3new indentright m-t-0"><b>R</b> Next free space pointer</p>\r<p class="indent2new indentright"><i>1 mark for stating the purpose of <b>one</b> of the pointers that have been named:</i></p>\r<p class="indent2 indentright">&#x2022;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(Front/start/head pointer) to indicate where to remove items from // who should be served next // who is currently being served; <br><b>NE</b> to points to start of list</p>\r<p class="indent2 indentright m-t-0">&#x2022;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(Next node pointer) to link items in list together // to show order of list // so items can be inserted into middle of list // to traverse list;</p>\r<p class="indent2 indentright m-t-0">&#x2022;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(Previous node pointer) to link items in list together // to show order of list // so items can be inserted into middle of list // to traverse list backwards;</p>\r<p class="indent2 indentright m-t-0">&#x2022;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(Read / end / tail pointer) to indicate where to add new items to // so new people can be added to queue <br><b>NE</b> to point to end of list</p>\r<p class="indent3new indentright m-t-0"><b>A</b> Contextualised answers which refer to queue instead of list or adding people to a queue.<br/><b>R</b> Answers which clearly relate to the use of a fixed-size array.</p>\r<p class="levelms">2</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent2 indentright">(ii)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Priority (queue);</p>\r<p class="levelms">1</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1 indentright">(c) &nbsp;&nbsp;&nbsp;&nbsp;Allow any reasonable example that would require randomness e.g. time next person joins queue, inter-person arrival time, time to be served, choice of meal, type (student / teacher) of next person to arrive;<br/><b>R</b> number of students / teachers / people in queue</p>\r<p class="levelms">1</p> \r<p class="mark">[5]</p></h5>', 'examinerreport': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">Part (a): This question part was poorly answered with many candidates giving vague responses or explaining what a simulation is rather than a model. In this context, a model is an abstraction of the real-world problem that leaves out unnecessary details. Some candidates confused a model with a prototype.</span></p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1new">Part (b)(i): Again, this question part was poorly answered. A significant number of candidates appeared to have no understanding of what was being asked, although more than half got at least one mark. Candidates who made a reasonable attempt at an answer often named two pointers, but then offered inadequate explanations of their purpose. For example, the purpose of the pointer to the end of the list is to enable new items to be added to the list, not simply to know where the end is.</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1new">Part (b)(ii): Some candidates correctly identified that a priority queue was required, but many invented new types of queues.</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1new">Part (c): This question part was well answered with many candidates giving well thought out answers such as determining whether the next person entering the cafeteria was a student or teacher or generating a time taken to serve the person at the front of the queue. The most common incorrect answer was the number of people / students / teachers in a queue. In each case, the number in a queue would be a consequence of other randomly determined occurrences rather than determined randomly itself.</p></h5>', 'notes': '', 'resources': ''}, 'Q23S1A02': {'question': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">The algorithm, represented using pseudo-code in the figure below, describes a method to rearrange four numbers in a data structure.</p>\r\n<p class="indent4new comp-top">Numbers[0] <span class="font18">&#8592;</span> 45</p>\r\n<p class="indent4new comp">Numbers[1] <span class="font18">&#8592;</span> 19</p>\r\n<p class="indent4new comp">Numbers[2] <span class="font18">&#8592;</span> 62</p>\r\n<p class="indent4new comp">Numbers[3] <span class="font18">&#8592;</span> 12</p>\r\n<p class="indent4new comp">FOR X <span class="font18">&#8592;</span> 1 TO 3</p>\r\n<p class="indent4new comp">&emsp;&emsp;Y <span class="font18">&#8592;</span> X &minus; 1</p>\r\n<p class="indent4new comp">&emsp;&emsp;N <span class="font18">&#8592;</span> Numbers[X]</p>\r\n<p class="indent4new comp">&emsp;&emsp;WHILE Y &gt; &minus;1 AND N &lt; Numbers[Y]</p>\r\n<p class="indent4new comp">&emsp;&emsp;&emsp;&emsp;Numbers[Y + 1] <span class="font18">&#8592;</span> Numbers[Y]</p>\r\n<p class="indent4new comp">&emsp;&emsp;&emsp;&emsp;Y <span class="font18">&#8592;</span> Y &minus; 1</p>\r\n<p class="indent4new comp">&emsp;&emsp;ENDWHILE</p>\r\n<p class="indent4new comp">&emsp;&emsp;Numbers[Y + 1] <span class="font18">&#8592;</span> N</p>\r\n<p class="indent4new comp">ENDFOR</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1new">Complete the table below by hand-tracing the algorithm in the figure above.</p>\r\n<p class="indent1new">You may not need to use all the rows in the table below.</p>\r\n<p class="indent1new">The first row of the table below has already been completed for you.</p>\r\n<p class="bottom">&nbsp;</p>\r\n<table class="data-table left3">\r\n\t<tr>\r\n\t\t<td class="col-2 tablegrey" rowspan="2"><p class="padded"><span class="comp-top"><b>X</b></span></p></td>\r\n\t\t<td class="col-2 tablegrey" rowspan="2"><p class="padded"><span class="comp-top"><b>Y</b></span></p></td>\r\n\t\t<td class="col-2 tablegrey" rowspan="2"><p class="padded"><span class="comp-top"><b>N</b></span></p></td>\r\n\t\t<td class="col-2 tablegrey" colspan="4"><p class="padded"><span class="comp-top"><b>Numbers</b></span></p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2 tablegrey"><p class="padded"><span class="comp-top"><b>[0]</b></span></p></td>\r\n\t\t<td class="col-2 tablegrey"><p class="padded"><span class="comp-top"><b>[1]</b></span></p></td>\r\n\t\t<td class="col-2 tablegrey"><p class="padded"><span class="comp-top"><b>[2]</b></span></p></td>\r\n\t\t<td class="col-2 tablegrey"><p class="padded"><span class="comp-top"><b>[3]</b></span></p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2 tablegrey"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2 tablegrey"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2 tablegrey"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2 tablegrey"><p class="padded"><span class="comp-top">45</span></p></td>\r\n\t\t<td class="col-2 tablegrey"><p class="padded"><span class="comp-top">19</span></p></td>\r\n\t\t<td class="col-2 tablegrey"><p class="padded"><span class="comp-top">62</span></p></td>\r\n\t\t<td class="col-2 tablegrey"><p class="padded"><span class="comp-top">12</span></p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n</table>\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="question"><b>5 marks for AO2 (apply)</b></p>\r\n<p class="indent1new"><img src="AA_COM/M23S1A02_files_M/img01.jpg"/>&nbsp;</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1new"><b>1 mark</b> for area A correct;</p>\r\n<p class="indent1new m-t-0"><b>1 mark</b> for area B correct;</p>\r\n<p class="indent1new m-t-0"><b>1 mark</b> for area C correct;</p>\r\n<p class="indent1new m-t-0"><b>1 mark</b> for area D correct;</p>\r\n<p class="indent1new m-t-0"><b>1 mark</b> for area E correct;</p>\r\n<p class="indent1new">Award a mark if the values in an area are correct regardless of which row they are on so long as they are in the correct overall sequence in a column.</p>\r\n<p class="indent1new"><b>I.</b> duplicated values instead of blanks</p>\r\n<p class="indent1new"><b>Max 4</b> if any errors</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">Just under forty percent of students attained full marks in this question, which required completion of a trace table in accordance with a pseudo-code algorithm. The most common error here was entering the correct value in the wrong column, which might be due to errors of transposition rather than any misconceptions.</p></h5>', 'notes': '', 'resources': ''}, 'Q23S1B10': {'question': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">This question refers to the subroutine <span class="comp">PassTwo</span>.</p>\r\n<p class="indent1new">State <b>two</b> conditions that need to be met for error code 6 to be reported during the assembly process of the program.</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 AO2 (analyse)</b></p>\r\n<p class="indent1new indentright"><span class="comp">Operand</span> is not empty / an empty string;</p>\r\n<p class="indent1new indentright m-t-0"><span class="comp">Operand</span> is not an existing label <span class="comp">// Operand</span> is not in the symbol table; <b>NE</b>. invalid operand</p>\r\n<p class="indent1new indentright m-t-0"><span class="comp">Operand</span> is not (the string representation of) a number;</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">This question continued to examine students&#x2019; understanding of the error codes within the skeleton program, and the majority were awarded both marks on offer. In circumstances where one mark was obtained but two points had been made, there was often a re-phrasing of the first point in an attempt to pick up the second mark.</p></h5>', 'notes': '', 'resources': ''}, 'Q23S1B11': {'question': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">This question refers to the subroutine <span class="comp">ExtractOperand</span>.</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1">(a)&emsp;&nbsp;Describe the purpose of the FOR loop <b>and</b> the IF statement <b>inside</b> it.</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="mark">(2)</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1">(b)&emsp;&nbsp;Describe the purpose of the IF statement <b>after</b> the FOR loop.</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="mark">(2)</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1">(c)&emsp;&nbsp;Describe why a WHILE loop might have been a better choice than a FOR loop.</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="mark">(2)</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>2 marks for AO2 (analyse)</b></p>\r\n<p class="indent2new indentright">Check each character in the line / operand; <b>A</b>. iterate over each character in the line / operand</p>\r\n<p class="indent2new indentright m-t-0">Store the position of an &#x2018;*&#x2019; // store position of comment symbol if there is one</p>\r\n<p class="indent2new indentright m-t-0">// store position of the start of a comment;</p>\r\n<p class="levelms">2</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1 indentright">(b)&emsp;&nbsp;<b>2 marks for AO2 (analyse)</b></p>\r\n<p class="indent2new indentright">If there is an &#x2018;*&#x2019; // if there is a comment (symbol);</p>\r\n<p class="indent2new indentright m-t-0">Only use the characters to left of &#x2018;*&#x2019; // remove the comment (from the string);</p>\r\n<p class="levelms">2</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1 indentright">(c)&emsp;&nbsp;<b>2 marks for AO2 (analyse)</b></p>\r\n<p class="indent2new indentright">When code encounters a &#x2018;*&#x2019; // When code encounters a comment (symbol);</p>\r\n<p class="indent2new indentright m-t-0">Can <b>stop</b> iteration when */comment is encountered // no need to examine to the end of the string;</p>\r\n<p class="indent2new indentright"><i><b>Alternative answer:</b> </i></p>\r\n<p class="indent2new indentright">If there are multiple asterisks, it finds the first one (rather than the last one); Additional asterisks within the comment will not affect assembly;</p>\r\n<p class="indent2new indentright"><b>R.</b> a variable (<span class="comp">ThisPosition</span>) to hold the position wouldn\'t be needed</p>\r\n<p class="levelms">2</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 comprised three parts, each of which asked about some aspect of the same subroutine. In previous exams, this might have been presented as a single six mark question rather than a series of related three-mark questions, and in such questions the scale of the required answer presented a challenge to some students.</p>\r\n<p class="indent1new">This format provided some structure, and most student marks were concentrated between two and five out of six. Where marks were not awarded, it was quite common for an otherwise creditworthy answer to be placed next to the wrong question. This suggests that marks were lost due to a misunderstanding of the question rather than a misunderstanding of the code.</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': ''}, 'Q20S1B10': {'question': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question m-b-1">This question refers to the subroutine <span class="comp">ConvertChar</span></p>\r\n<p class="indent1new">With reference to the fact that 0 represents the darkest greyscale (black) and 255 represents the lightest greyscale (white), explain the purpose of <span class="comp">ConvertChar</span></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>All marks for AO2 (analyse)</b> </p>\r\n<p class="indent1new indentright">Each range of greyscale values is assigned a different ASCII character;</p>\r\n<p class="indent1new indentright m-t-0"><b>A.</b> Omission of range if an example range is given</p>\r\n<p class="indent1new indentright">The lighter greyscales have less dense/smaller coverage</p>\r\n<p class="indent1new indentright m-t-0">// the darker greyscales have denser/larger coverage</p>\r\n<p class="indent1new indentright m-t-0">// the characters used give an effect appropriate for the greyscale value;</p>\r\n<p class="mark">[2]</p></h5>', 'examinerreport': '', 'notes': '', 'resources': ''}, 'Q23S1C14': {'question': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">This question adds a memory address check to the <b>Skeleton Program</b>.</p>\r\n<p class="indent1new">Each time a <span class="comp">JSR</span> opcode is executed the return address is stored in memory. The memory location used for this could already contain an instruction or data.</p>\r\n<p class="indent1new">If storing a return address will overwrite an instruction or data, then an appropriate error message should be output using the <span class="comp">ReportRunTimeError</span> subroutine. The original code in the <span class="comp">ExecuteJSR</span> subroutine should only be carried out if there is no error.</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 <span class="comp">ExecuteJSR</span> subroutine. If storing a return address would overwrite an instruction or data, the <span class="comp">ReportRunTimeError</span> subroutine should be called with an appropriate error message.</p>\r\n<p class="indent1new">One method of completing this task would require the addition of extra parameter(s) to the <span class="comp">ExecuteJSR</span> subroutine.</p>\r\n<p class="indent1new"><b>Task 2</b></p>\r\n<p class="indent1new m-t-0">If your solution requires additional parameter(s) for the <span class="comp">ExecuteJSR</span> subroutine amend the call to <span class="comp">ExecuteJSR</span> in the <span class="comp">Execute</span> subroutine.</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><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">&#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>prog3</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">ExecuteJSR</span> and the entire subroutine <span class="comp">Execute</span> if you have made changes in <b>Task 2</b>.</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 the final frame and the contents of the stack before execution terminates.</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>2 marks for AO3 (design) and 2 marks for AO3 (programming)</b></p>\r\n<p class="indent2new indentright"><b>Marking guidance:</b></p>\r\n<p class="indent2new indentright"><b>Evidence of AO3 design &#x2013; 2 points:</b></p>\r\n<p class="indent2new indentright">Evidence of design to look for in response:</p>\r\n<p class="indent2 indentright">1)&emsp;&ensp;&nbsp;Check in <span class="comp-top">ExecuteJSR</span> that stack does not overwrite instruction / data;</p>\r\n<p class="indent2 indentright m-t-0">2)&emsp;&ensp;&nbsp;Recognise that instructions for <span class="comp">JSR</span> should only be executed if no error;</p>\r\n<p class="indent2new indentright"><b>Note:</b> AO3 (design) points are for selecting appropriate techniques to use to solve the problem, so should be credited whether the syntax of programming language statements is correct or not and regardless of whether the solution works.</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent2new indentright"><b>Evidence of AO3 programming &#x2013; 2 points:</b></p>\r\n<p class="indent2new indentright">Evidence of programming to look for in response:</p>\r\n<p class="indent2 indentright">3)&emsp;&ensp;&nbsp;Correct value for number of program lines passed into subroutine // check that memory location pointed to by <span class="comp-top">TOS</span> is empty;</p>\r\n<p class="indent2 indentright m-t-0">4)&emsp;&ensp;&nbsp;<span class="comp">ReportRunTimeError</span> called with suitable message in appropriate place;</p>\r\n<p class="indent2new indentright"><b>Max 3</b> if code does not function correctly</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">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 comp-top">****** Frame 7 ***********************************************</p>\r\n<p class="indent2new indentright comp">* Current Instruction Register: JSR 7</p>\r\n<p class="indent2new indentright comp">Run time error: Memory Address Error</p>\r\n<p class="indent2new indentright comp">Stack contents:</p>\r\n<p class="indent2new indentright comp">&nbsp;----</p>\r\n<p class="indent2new indentright comp">|&nbsp;&nbsp;3 |</p>\r\n<p class="indent2new indentright comp">| 14 |</p>\r\n<p class="indent2new indentright comp">&nbsp;----</p>\r\n<p class="indent2new indentright comp">Execution terminated</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 ExecuteJSR(ByRef Memory() As AssemblerInstruction, ByRef Registers() As Integer, ByVal Address As Integer, <b>ByVal MaxLines As Integer</b>)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;Dim StackPointer As Integer = Registers(TOS) - 1</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>If StackPointer &lt;= MaxLines Then</b>&nbsp;&nbsp;\'MP1</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>ReportRunTimeError(&quot;Memory Address Error&quot;, Registers)</b>&nbsp;&nbsp;\'MP4</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>Else</b>&nbsp;&nbsp;\'MP2</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Memory(StackPointer).OperandValue = Registers(PC)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Registers(PC) = Address</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Registers(TOS) = StackPointer</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>End If</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;DisplayStack(Memory, Registers)</p>\r\n<p class="indent2new comp">End Sub</p>\r\n<p class="indent2new comp-top">&nbsp;&nbsp;Sub Execute(ByVal SourceCode() As String, ByVal Memory() As AssemblerInstruction)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Dim Registers() As Integer = {0, 0, 0, 0, 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;Dim FrameNumber As Integer = 0</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;Dim OpCode As String = Memory(Registers(PC)).OpCode</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;While OpCode &lt;&gt; &quot;HLT&quot;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FrameNumber += 1</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;Dim Operand As Integer = 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) += 1</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Select Case OpCode</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)</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)</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)</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)</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)</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, <b>Int(SourceCode(0))</b>)&nbsp;&nbsp;\'MP3</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)</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)</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)</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()</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)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End Select</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If Registers(ERR) = 0 Then</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;Else</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;End If</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;End While</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;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 ExecuteJSR(Memory, Registers, Address<b>, MaxLines</b>):</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;StackPointer = Registers[TOS] - 1</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>if StackPointer &lt;= MaxLines:</b>&nbsp;&nbsp;<b># MP1</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>ReportRunTimeError(&quot;Memory Address Error&quot;, Registers)</b>&nbsp;&nbsp;<b># MP4</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>else:</b>&nbsp;&nbsp;<b># MP2</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Memory[StackPointer].OperandValue = Registers[PC]</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Registers[PC] = Address</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Registers[TOS] = StackPointer</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;DisplayStack(Memory, Registers)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;return Memory, Registers</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<b>, int(SourceCode[0])</b>)&nbsp;&nbsp;<b># MP3</b></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()</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 m-t-1"><b>Alternative method:</b></p>\r\n<p class="indent2new comp-top">def ExecuteJSR(Memory, Registers, Address):</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;StackPointer = Registers[TOS] - 1</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>if Memory[StackPointer].OperandString != &quot;&quot; or Memory[StackPointer].OpCode != &quot;&quot;:</b>&nbsp;&nbsp;<b># MP1, MP3</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>ReportRunTimeError(&quot;Memory Address Error&quot;, Registers)</b>&nbsp;&nbsp;<b># MP4</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>else:</b>&nbsp;&nbsp;<b>#MP2</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Memory[StackPointer].OperandValue = Registers[PC]</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Registers[PC] = Address</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Registers[TOS] = StackPointer</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;DisplayStack(Memory, Registers)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;return Memory, Registers</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 ExecuteJSR(Memory, Registers, Address<b>, MaxLines</b>):</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;StackPointer = Registers[TOS] - 1</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>if StackPointer &lt;= MaxLines:</b>&nbsp;&nbsp;<b># MP1</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>ReportRunTimeError(&quot;Memory Address Error&quot;, Registers)</b>&nbsp;&nbsp;<b># MP4</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>else:</b>&nbsp;&nbsp;<b># MP2</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Memory[StackPointer].OperandValue = Registers[PC]</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Registers[PC] = Address</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Registers[TOS] = StackPointer</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;DisplayStack(Memory, Registers)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;return Memory, Registers</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, <b>int(SourceCode[0])</b>)&nbsp;&nbsp;<b># MP3</b></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()</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 m-t-1"><b>Alternative method:</b></p>\r\n<p class="indent2new comp-top">def ExecuteJSR(Memory, Registers, Address):</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;StackPointer = Registers[TOS] - 1</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>if Memory[StackPointer].OperandString != &quot;&quot; or Memory[StackPointer].OpCode != &quot;&quot;:</b>&nbsp;&nbsp;<b># MP1, MP3</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>ReportRunTimeError(&quot;Memory Address Error&quot;, Registers)</b>&nbsp;&nbsp;<b># MP4</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>else:</b>&nbsp;&nbsp;<b>#MP2</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Memory[StackPointer].OperandValue = Registers[PC]</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Registers[PC] = Address</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;Registers[TOS] = StackPointer</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;DisplayStack(Memory, Registers)</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;return Memory, Registers</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 ExecuteJSR(var Memory: TMemory; var Registers: TRegisters; Address: integer<b>; MaxLines: integer</b>);</p>\r\n<p class="indent2new comp"><b>var</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>StackPointer: integer;</b></p>\r\n<p class="indent2new comp"><b>begin</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>StackPointer := Registers[TOS] - 1;</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>if StackPointer &lt;= MaxLines</b>&nbsp;&nbsp;<b>// MP1</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>then</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>ReportRunTimeError(\'Memory Address Error\', Registers)</b>&nbsp;&nbsp;<b>// MP4</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>else</b>&nbsp;&nbsp;<b>// MP2</b></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;Memory[StackPointer].OperandValue := Registers[PC];</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registers[PC] := Address;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registers[TOS] := StackPointer;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;end;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;DisplayStack(Memory, Registers)</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, <b>StrToInt(SourceCode[0])</b>);&nbsp;&nbsp;<b>// MP3</b></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();</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 m-t-1"><b>Alternative method:</b></p>\r\n<p class="indent2new comp-top">procedure ExecuteJSR(var Memory: TMemory; var Registers: TRegisters; Address: integer);</p>\r\n<p class="indent2new comp">var</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;StackPointer: integer;</p>\r\n<p class="indent2new comp">begin</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;StackPointer := Registers[TOS] - 1;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>if (Memory[StackPointer].OperandString &lt;&gt; EMPTY_STRING) or Memory[StackPointer].OpCode &lt;&gt; EMPTY_STRING</b>&nbsp;&nbsp;<b>// MP1, MP3</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>then</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>ReportRunTimeError(\'Memory Address Error\', Registers)</b>&nbsp;&nbsp;<b>// MP4</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>else</b>&nbsp;&nbsp;<b>// MP2</b></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;Memory[StackPointer].OperandValue := Registers[PC];</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registers[PC] := Address;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Registers[TOS] := StackPointer;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;end;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;DisplayStack(Memory, Registers)</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 ExecuteJSR(AssemblerInstruction[] memory, int[] registers, int address<b>, int maxLines</b>)</p>\r\n<p class="indent2new comp">{</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;int stackPointer = registers[TOS] - 1;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>if (stackPointer &lt;= maxLines)</b>&nbsp;&nbsp;<b>// MP1</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>{</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>ReportRunTimeError(&quot;Memory Address Error&quot;, registers);</b>&nbsp;&nbsp;<b>// MP4</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>}</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>else</b>&nbsp;&nbsp;<b>// MP2</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>{</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;memory[stackPointer].operandValue = registers[PC];</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;registers[PC] = address;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;registers[TOS] = stackPointer;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;}</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;DisplayStack(memory, registers);</p>\r\n<p class="indent2new comp">}</p>\r\n<p class="indent2new comp-top">&nbsp;&nbsp;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<b>, Convert.ToInt32(sourceCode[0])</b>); break;&nbsp;&nbsp;<b>// MP3</b></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(); break;</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 m-t-1"><b>Alternative method:</b></p>\r\n<p class="indent2new comp-top">private static void ExecuteJSR(AssemblerInstruction[] memory, int[] registers, int address)</p>\r\n<p class="indent2new comp">{</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;int stackPointer = registers[TOS] - 1;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>if (memory[stackPointer].operandString != &quot;&quot;)</b>&nbsp;&nbsp;<b>// MP1, MP3</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>{</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>ReportRunTimeError(&quot;Memory Address Error&quot;, registers);</b>&nbsp;&nbsp;<b>// MP4</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>}</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>else</b>&nbsp;&nbsp;<b>// MP2</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>{</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;memory[stackPointer].operandValue = registers[PC];</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;registers[PC] = address;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;registers[TOS] = stackPointer;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>}</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;DisplayStack(memory, registers);</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 executeJSR(AssemblerInstruction[] memory, int[] registers, int address, <b>int maxLines</b>) {</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;int stackPointer = registers[TOS] - 1;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>if (stackPointer &lt;= maxLines) {</b>&nbsp;&nbsp;<b>// MP1</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>reportRunTimeError(&quot;Memory Address Error&quot;, registers);</b>&nbsp;&nbsp;<b>// MP4</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>} else {</b>&nbsp;&nbsp;<b>// MP2</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;memory[stackPointer].operandValue = registers[PC] ;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;registers[PC] = address;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;registers[TOS] = stackPointer;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>}</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;displayStack(memory, registers);</p>\r\n<p class="indent2new comp-top">}</p>\r\n<p class="indent2new comp-top">&nbsp;&nbsp;void execute(String[] sourceCode, AssemblerInstruction[] memory) {</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;int[] registers = {0, 0, 0, 0, 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;int frameNumber = 0;</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.equals(&quot;HLT&quot;)) {</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;frameNumber += 1;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.println();</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;int operand = memory[registers[PC]].operandValue;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&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;&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;&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, <b>Integer.parseInt(sourceCode[0])</b>);&nbsp;&nbsp;<b>// MP3</b></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;&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(); break;</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;&nbsp;&nbsp;default:</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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;&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;} else {</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.println(&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 m-t-1"><b>Alternative Answer:</b></p>\r\n<p class="indent2new comp-top">void executeJSR(AssemblerInstruction[] memory, int[] registers, int address) {</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;int stackPointer = registers[TOS] - 1;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>if</b></p>\r\n<p class="indent2new comp"><b>(!memory[stackPointer].operandString.equals(EMPTY_STRING)|| !memory[stackPointer].opCode.equals(EMPTY_STRING))</b>&nbsp;&nbsp;<b>// MP1, MP3</b><b>{</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;<b>reportRunTimeError(&quot;Memory Address Error&quot;, registers);</b>&nbsp;&nbsp;<b>// MP4</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>} else {</b>&nbsp;&nbsp;<b>// MP2</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;memory[stackPointer].operandValue = registers[PC] ;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;registers[PC] = address;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;&nbsp;&nbsp;registers[TOS] = stackPointer;</p>\r\n<p class="indent2new comp">&nbsp;&nbsp;<b>}</b></p>\r\n<p class="indent2new comp">&nbsp;&nbsp;displayStack(memory, registers);</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 skipped more than any other question.</p>\r\n<p class="indent1new">Of those who made an attempt, three quarters secured either full marks or three out of four on part (a). A range of different approaches was taken, including some not anticipated by the mark scheme. These were always given credit, some obtaining full marks, and this underscores the fact that there are usually many correct answers to a programming question, not just one.</p></h5>', 'notes': '', 'resources': ''}, 'Q22S1A01': {'question': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">The algorithm, represented using pseudo-code in the figure below, describes a method to access numbers in the data structure, <span class="comp">List</span>, shown in <b>Table 1</b>.</p>\r\n<p class="indent3new comp-top">SUBROUTINE A(S, X, Y)</p>\r\n<p class="indent3new comp">&emsp;&nbsp;P <span class="font18">&#8592;</span> -1</p>\r\n<p class="indent3new comp">&emsp;&nbsp;WHILE P = -1 AND X &lt;= Y</p>\r\n<p class="indent3new comp">&emsp;&nbsp;&emsp;&nbsp;Z <span class="font18">&#8592;</span> (X + Y) DIV 2</p>\r\n<p class="indent3new comp">&emsp;&nbsp;&emsp;&nbsp;IF List[Z] = S THEN</p>\r\n<p class="indent3new comp">&emsp;&nbsp;&emsp;&nbsp;&emsp;&nbsp;P <span class="font18">&#8592;</span> Z</p>\r\n<p class="indent3new comp">&emsp;&nbsp;&emsp;&nbsp;ELSE</p>\r\n<p class="indent3new comp">&emsp;&nbsp;&emsp;&nbsp;&emsp;&nbsp;IF List[Z] &lt; S THEN</p>\r\n<p class="indent3new comp">&emsp;&nbsp;&emsp;&nbsp;&emsp;&nbsp;&emsp;&nbsp;X <span class="font18">&#8592;</span> Z + 1</p>\r\n<p class="indent3new comp">&emsp;&nbsp;&emsp;&nbsp;&emsp;&nbsp;ELSE</p>\r\n<p class="indent3new comp">&emsp;&nbsp;&emsp;&nbsp;&emsp;&nbsp;&emsp;&nbsp;Y <span class="font18">&#8592;</span> Z &#x2013; 1</p>\r\n<p class="indent3new comp">&emsp;&nbsp;&emsp;&nbsp;&emsp;&nbsp;ENDIF</p>\r\n<p class="indent3new comp">&emsp;&nbsp;&emsp;&nbsp;ENDIF</p>\r\n<p class="indent3new comp">&emsp;&nbsp;ENDWHILE</p>\r\n<p class="indent3new comp">&emsp;&nbsp;RETURN P</p>\r\n<p class="indent3new comp">ENDSUBROUTINE</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1new">The <span class="comp-top">DIV</span> operator calculates the whole number part resulting from an integer division, for example, <span class="comp-top">10 DIV 3 = 3</span></p>\r\n<p class="indent1new">Complete <b>Table 2</b> by hand-tracing the algorithm in the figure above when the following statement is executed.</p>\r\n<p class="graph comp-top">Result <span class="font18">&#8592;</span> A(38, 0, 18)</p>\r\n<p class="indent1new">You may not need to use all the rows in <b>Table 2</b>.</p>\r\n<p class="indent1new">The first row of <b>Table 2</b> has already been completed for you.</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="bottom">&nbsp;</p>\r\n<table class="data-table left0">\r\n\t<tr>\r\n\t\t<td colspan="19" class="no-border"><p class="no-padding"><b>Table 1</b></p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td colspan="19" class="no-border"><p class="no-padding text-left comp"><b>List</b></p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-1 no-border"><p class="no-padding comp">[0]</p></td>\r\n\t\t<td class="col-1 no-border"><p class="no-padding comp">[1]</p></td>\r\n\t\t<td class="col-1 no-border"><p class="no-padding comp">[2]</p></td>\r\n\t\t<td class="col-1 no-border"><p class="no-padding comp">[3]</p></td>\r\n\t\t<td class="col-1 no-border"><p class="no-padding comp">[4]</p></td>\r\n\t\t<td class="col-1 no-border"><p class="no-padding comp">[5]</p></td>\r\n\t\t<td class="col-1 no-border"><p class="no-padding comp">[6]</p></td>\r\n\t\t<td class="col-1 no-border"><p class="no-padding comp">[7]</p></td>\r\n\t\t<td class="col-1 no-border"><p class="no-padding comp">[8]</p></td>\r\n\t\t<td class="col-1 no-border"><p class="no-padding comp">[9]</p></td>\r\n\t\t<td class="col-1 no-border"><p class="no-padding comp">[10]</p></td>\r\n\t\t<td class="col-1 no-border"><p class="no-padding comp">[11]</p></td>\r\n\t\t<td class="col-1 no-border"><p class="no-padding comp">[12]</p></td>\r\n\t\t<td class="col-1 no-border"><p class="no-padding comp">[13]</p></td>\r\n\t\t<td class="col-1 no-border"><p class="no-padding comp">[14]</p></td>\r\n\t\t<td class="col-1 no-border"><p class="no-padding comp">[15]</p></td>\r\n\t\t<td class="col-1 no-border"><p class="no-padding comp">[16]</p></td>\r\n\t\t<td class="col-1 no-border"><p class="no-padding comp">[17]</p></td>\r\n\t\t<td class="col-1 no-border"><p class="no-padding comp">[18]</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-1"><p class="no-padding comp-top">2</p></td>\r\n\t\t<td class="col-1"><p class="no-padding comp-top">8</p></td>\r\n\t\t<td class="col-1"><p class="no-padding comp-top">12</p></td>\r\n\t\t<td class="col-1"><p class="no-padding comp-top">18</p></td>\r\n\t\t<td class="col-1"><p class="no-padding comp-top">25</p></td>\r\n\t\t<td class="col-1"><p class="no-padding comp-top">29</p></td>\r\n\t\t<td class="col-1"><p class="no-padding comp-top">36</p></td>\r\n\t\t<td class="col-1"><p class="no-padding comp-top">42</p></td>\r\n\t\t<td class="col-1"><p class="no-padding comp-top">49</p></td>\r\n\t\t<td class="col-1"><p class="no-padding comp-top">51</p></td>\r\n\t\t<td class="col-1"><p class="no-padding comp-top">57</p></td>\r\n\t\t<td class="col-1"><p class="no-padding comp-top">61</p></td>\r\n\t\t<td class="col-1"><p class="no-padding comp-top">68</p></td>\r\n\t\t<td class="col-1"><p class="no-padding comp-top">71</p></td>\r\n\t\t<td class="col-1"><p class="no-padding comp-top">79</p></td>\r\n\t\t<td class="col-1"><p class="no-padding comp-top">83</p></td>\r\n\t\t<td class="col-1"><p class="no-padding comp-top">84</p></td>\r\n\t\t<td class="col-1"><p class="no-padding comp-top">91</p></td>\r\n\t\t<td class="col-1"><p class="no-padding comp-top">97</p></td>\r\n\t</tr>\r\n</table>\r\n<p class="bottom">&nbsp;</p>\r\n<table class="data-table left3">\r\n<tr>\r\n\t\t<td colspan="14" class="no-border"><p class="no-padding"><b>Table 2</b><br/>&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2 tablegrey2"><p class="padded comp-top"><b>S</b></p></td>\r\n\t\t<td class="col-2 tablegrey2"><p class="padded comp-top"><b>X</b></p></td>\r\n\t\t<td class="col-2 tablegrey2"><p class="padded comp-top"><b>Y</b></p></td>\r\n\t\t<td class="col-2 tablegrey2"><p class="padded comp-top"><b>P</b></p></td>\r\n\t\t<td class="col-2 tablegrey2"><p class="padded comp-top"><b>Z</b></p></td>\r\n\t\t<td class="col-4 tablegrey2"><p class="padded comp-top"><b>List[Z]</b></p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2 tablegrey2"><p class="padded comp-top">38</p></td>\r\n\t\t<td class="col-2 tablegrey2"><p class="padded comp-top">0</p></td>\r\n\t\t<td class="col-2 tablegrey2"><p class="padded comp-top">18</p></td>\r\n\t\t<td class="col-2 tablegrey2"><p class="padded comp-top">&minus;1</p></td>\r\n\t\t<td class="col-2 tableblack"><p class="padded comp-top">&nbsp;</p></td>\r\n\t\t<td class="col-4 tableblack"><p class="padded comp-top">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-4"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-4"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-4"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-4"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-4"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-4"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-4"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-4"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-4"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-4"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-2"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-4"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-2" colspan="5"><p class="padded comp-top"><b>Result</b>:</p></td>\r\n\t\t<td class="col-4"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n</table>\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="question"><b>5 marks for AO2 (apply)</b>  </p>\r\n<p class="graph"><img src="AA_COM/M22S1A01_files_M/img01.jpg"/>&nbsp;</p>\r\n<p class="indent1new indentright"><b>1 mark</b> for each correct set of values in the correct sequence (boxed in red);</p>\r\n<p class="indent1new indentright"><b>Max 4</b> if any errors</p>\r\n<p class="indent1new indentright"><b>A.</b> entries within a boxed area sharing a row (e.g. 9 and 8 on the same row).</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1new indentright"><b>Alternative Answer Layout:</b></p>\r\n<p class="indent1new indentright m-t-0"><b>1 mark</b> for each correct set of values in the correct sequence (4 sets boxed in red, 1 set in disjointed boxes in green and shaded light grey);</p>\r\n<p class="graph"><img src="AA_COM/M22S1A01_files_M/img02.jpg"/>&nbsp;</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">Most students were able to secure either four or five marks on the trace table question. Where students secured four marks, the mark that was dropped was the final mark. This required the result of the algorithm to be given.</p></h5>', 'notes': '', 'resources': ''}, 'Q20S1A02': {'question': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">A sentinel value is a special value <b>after</b> the end of a series of data values. It is a terminator for the series of data values but is not treated as part of the series. A sentinel value is used when you do not know how many data values are in the series.</p>\r\n<p class="indent1new">The algorithm, represented using pseudo-code below, is an attempt at a method to add numbers that are input as a series terminated by the sentinel value -1</p>\r\n<p class="indent3new comp-top">X <span class="font18">&#8592;</span> 0</p>\r\n<p class="indent3new comp">Result <span class="font18">&#8592;</span> 0</p>\r\n<p class="indent3new comp">WHILE X &#8800; -1</p>\r\n<p class="indent3new comp">&emsp;&nbsp;INPUT X</p>\r\n<p class="indent3new comp">&emsp;&nbsp;Result <span class="font18">&#8592;</span> Result + X</p>\r\n<p class="indent3new comp">ENDWHILE</p>\r\n<p class="indent3new comp">OUTPUT Result</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1">(a)&emsp;&nbsp;Complete the table below by hand-tracing the algorithm shown above. You may not need to use all the rows in the table.</p>\r\n<p class="indent2new">The first row of the table has already been completed for you.</p>\r\n<p class="indent2new">The sequence of numbers for input is: <span class="comp">4, 6, 3, 2, -1</span></p>\r\n<p class="bottom">&nbsp;</p>\r\n<table class="data-table left4">\r\n\t<tr>\r\n\t\t<td class="col-3 tablegrey"><p class="padded comp-top"><b>X</b></p></td>\r\n\t\t<td class="col-5 tablegrey"><p class="padded comp-top"><b>Result</b></p></td>\r\n\t\t<td class="col-7 tablegrey"><p class="padded comp-top"><b>Output</b></p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-3 tablegrey"><p class="padded"><span class="comp-top">0</span></p></td>\r\n\t\t<td class="col-5 tablegrey"><p class="padded"><span class="comp-top">0</span></p></td>\r\n\t\t<td class="col-7 tablegrey"><p class="padded"><span class="comp-top">-</span></p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-3"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-5"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-7"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-3"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-5"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-7"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-3"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-5"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-7"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-3"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-5"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-7"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-3"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-5"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-7"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-3"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-5"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-7"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-3"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-5"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-7"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-3"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-5"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-7"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-3"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-5"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-7"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-3"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-5"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-7"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n</table>\r\n<p class="mark">(3)</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1">(b)&emsp;&nbsp;Comment on the result of the trace and describe how the algorithm should be modified.</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="indent2new answer-toggle">___________________________________________________________________</p>\r\n<p class="mark">(2)</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>3 marks for AO2 (apply)</b></p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="bottom">&nbsp;</p>\r\n<table class="data-table left2">\r\n\t<tr>\r\n\t\t<td class="col-3 tablegrey"><p class="padded"><span class="comp"><b>X</b></span></p></td>\r\n\t\t<td class="col-4 tablegrey"><p class="padded"><span class="comp"><b>Result</b></span></p></td>\r\n\t\t<td class="col-5 tablegrey"><p class="padded"><span class="comp"><b>Output</b></span></p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-3 tablegrey"><p class="padded"><span class="comp">0</span></p></td>\r\n\t\t<td class="col-4 tablegrey"><p class="padded"><span class="comp">0</span></p></td>\r\n\t\t<td class="col-5 tablegrey"><p class="padded"><span class="comp">-</span></p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-3"><p class="padded"><span class="comp">4</span></p></td>\r\n\t\t<td class="col-4"><p class="padded"><span class="comp">4</span></p></td>\r\n\t\t<td class="col-5"><p class="padded"><span class="comp">&nbsp;</span></p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-3"><p class="padded"><span class="comp">6</span></p></td>\r\n\t\t<td class="col-4"><p class="padded"><span class="comp">10</span></p></td>\r\n\t\t<td class="col-5"><p class="padded"><span class="comp">&nbsp;</span></p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-3"><p class="padded"><span class="comp">3</span></p></td>\r\n\t\t<td class="col-4"><p class="padded"><span class="comp">13</span></p></td>\r\n\t\t<td class="col-5"><p class="padded"><span class="comp">&nbsp;</span></p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-3"><p class="padded"><span class="comp">2</span></p></td>\r\n\t\t<td class="col-4"><p class="padded"><span class="comp">15</span></p></td>\r\n\t\t<td class="col-5"><p class="padded"><span class="comp">&nbsp;</span></p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-3"><p class="padded"><span class="comp">&minus;1</span></p></td>\r\n\t\t<td class="col-4"><p class="padded"><span class="comp">14</span></p></td>\r\n\t\t<td class="col-5"><p class="padded"><span class="comp">14</span></p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-3"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-4"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-5"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-3"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-4"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-5"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-3"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-4"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-5"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-3"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-4"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-5"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td class="col-3"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-4"><p class="padded">&nbsp;</p></td>\r\n\t\t<td class="col-5"><p class="padded">&nbsp;</p></td>\r\n\t</tr>\r\n</table>\r\n<p class="indent2new indentright m-b-0"><b>1 mark</b> for correct <span class="comp">X</span> column (4, 6, 3, 2, -1);</p>\r\n<p class="indent2new indentright m-t-0 m-b-0"><b>1 mark</b> for correct <span class="comp">Result</span> column (4, 10, 13, 15);</p>\r\n<p class="indent2new indentright m-t-0"><b>1 mark</b> for final <span class="comp">Result</span> value (14) and <span class="comp">Output</span> column (14);</p>\r\n<p class="indent2new indentright"><b>Max 2</b> if any errors</p>\r\n<p class="levelms">3</p></h5><h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="indent1 indentright">(b)&emsp;&nbsp;<b>2 marks for AO2 (analyse)</b> </p>\r\n<p class="indent2new indentright">The result is wrong // The sentinel value should not have been used in the calculation; Subtract the last value // input first value before the <span class="comp">WHILE</span> loop and swap the instructions within the <span class="comp">WHILE</span> loop // add 1 to result after loop is finished;</p>\r\n<p class="indent2new indentright"><b>A.</b> not add the value if it is the sentinel value</p>\r\n<p class="levelms">2</p>\r\n<p class="mark">[5]</p></h5>', 'examinerreport': '', 'notes': '', 'resources': ''}, 'QS121A01': {'question': '<h5 class=\'contentSeparator\' style=\'page-break-inside: avoid;\'><div class=\'qnumber-hidden\'></div><p class="question">The table below is a partially complete representation of the rules for adding together two bit values. The first two columns represent the two bit values to add. The first row has been completed and represents the binary addition rule <span style="font-family:Courier New;">0 &#x002B; 0 = 0.</span></span> Carry occurs when the answer cannot be stored in 1 bit.</span></p>\r<table class=MsoTableGrid cellspacing=0 cellpadding=0 style=\'margin-top:0.5cm;margin-left:60.0pt;border-collapse:collapse;border:0\'> \r\t<tr>\r\t\t<td valign=top style=\'width:70.0pt;border-top :solid windowtext 0.0pt; border-right:solid windowtext 0.0pt; border-bottom:solid windowtext 1.0pt; border-left:solid windowtext 0.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><b>&nbsp;</b></p></td>\r\t\t<td valign=top style=\'width:70.0pt;border-top :solid windowtext 0.0pt; border-right:solid windowtext 1.0pt; border-bottom:solid windowtext 1.0pt; border-left:solid windowtext 0.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><b>&nbsp;</b></p></td>\r\t\t<td valign=top style=\'width:70.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><b>Answer</b></p></td>\r\t\t<td valign=top style=\'width:80.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><b>Carry</b></p></td> \r\t</tr>\r\t<tr>\r\t\t<td valign=top style=\'width:70.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><span class="comp">0</span></p></td>\r\t\t<td valign=top style=\'width:80.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><span class="comp">0</span></p></td> \r\t\t<td valign=top style=\'width:70.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><span class="comp">0</span></p></td>\r\t\t<td valign=top style=\'width:80.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><span class="comp">0</span></p></td> \r\t</tr>\r\t<tr>\r\t\t<td valign=top style=\'width:70.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><span class="comp">0</span></p></td>\r\t\t<td valign=top style=\'width:80.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><span class="comp">1</span></p></td> \r\t\t<td valign=top style=\'width:70.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><span class="comp">&nbsp;</span></p></td>\r\t\t<td valign=top style=\'width:80.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><span class="comp">&nbsp;</span></p></td> \r\t</tr>\r\t<tr>\r\t\t<td valign=top style=\'width:70.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><span class="comp">1</span></p></td>\r\t\t<td valign=top style=\'width:80.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><span class="comp">0</span></p></td> \r\t\t<td valign=top style=\'width:70.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><span class="comp">&nbsp;</span></p></td>\r\t\t<td valign=top style=\'width:80.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><span class="comp">&nbsp;</span></p></td> \r\t</tr>\r\t\t<td valign=top style=\'width:70.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><span class="comp">1</span></p></td>\r\t\t<td valign=top style=\'width:80.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><span class="comp">1</span></p></td> \r\t\t<td valign=top style=\'width:70.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><span class="comp">&nbsp;</span></p></td>\r\t\t<td valign=top style=\'width:80.0pt;border:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;\'><p class=box><span class="comp">&nbsp;</span></p></td> \r\t</tr>\r</table>\r<p class="indent1new">Complete the table above to show the <b>Answer</b> and <b>Carry</b> values for the given binary addition rules.</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="indent2new indentright m-t-0"><img align="middle;" src="AA_COM/MS121A01_files_M/img01.png">&nbsp;</p></span></p>\r<p class="indent2new indentright"><b>A</b> 10 instead of 0 in the Answer column for the final row of the table</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">The majority of students got full marks for this question.</span></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': ''}}
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. Exam questions must include the marks, the full question content and the answers
Assistant: