Recent Question/Assignment

IFN551 Computer Systems Fundamentals
Assignment B
Weighting: 40%
Due Friday 20th April 2022 by 11:59pm
Individual submission via QUT Blackboard only
PREAMBLE
The Little Monkey Computer (LMC) is a cartoonised Assembly language. The concept involves a Monkey working within an enclosed workroom who is to perform instructions set by the programmer. The Monkey has various tools in its workroom to assist, for example: a calculator, a counter and some storage boxes.
LMC is an excellent learning aid to assist you in understanding how a von Neumann -based computer system operates at a fundamental level. Understanding this will assist you in becoming better engineers and software developers. See the lectures and tutorials for more information about the architecture and instructions of LMC.
In this assignment, you are required to demonstrate your ability to interpret and solve a novel problem by using LMC.
To begin, you are required to design an algorithm to solve the problem presented to you. For this, you will write pseudocode and draw a flowchart diagram to articulate your design. Further, you will write a test plan that will help you verify that your program behaves as you expect. For this, consider behaviours such as: what will happen if the user enters an unexpectedly large value, what will happen when the user enters zero, etc.
After designing your algorithm and test plan, you are required to implement the algorithm using the Little Monkey Computer.
There are three (3) questions in this assessment item, of which, the first is separated into sub-questions. See the subsequent pages for these questions. Answer all questions. Marks per question and a marking scheme is specified for each.
Academic integrity is taken very seriously at QUT. Ensure that the work you submit is your own and that you provide sufficient evidence of how you came to your final solution. If we have queries about your solution, you must be prepared to answer these when requested otherwise a grade of zero will be awarded.
You must adhere to the QUT Manual of Policies and Procedures, and agree to the terms below. You can access the QUT MOPP by searching MOPP in the HiQ website.
In submitting this work I confirm that:
- This work represents my individual effort and does not contain plagiarised material.
- I am aware of the University rule that a student must maintain academic integrity as stated and explained in the QUT MOPP Section C/5.3 Academic Integrity.
- I am aware that my assignment may be stored in a reference database, becoming part of the bank of material that assignments will be checked against in the future.
QUESTION 1 (35 MARKS)
• Use Little Monkey Computer v1.4.0.0 (or greater)
• Enter your student ID in the LMC Interpreter when completing this assessment item.
• Failing to include the .lmc file in your submission will result in a grade of zero for Q1.4 • Sufficient LMC file history must be available to demonstrate authenticity.
Please submit Question 1.1, 1.2 and 1.3 using the template provided on Blackboard.
Please submit your LMC file for Question 1.4 directly to Blackboard.
Task 1-A
Write a Little Monkey Computer program that converts a Monkey number into a number using the base-10 number system. The Monkey number system is similar to the Roman number system, however, it has some exceptions and some limitations. You must display the result as output before halting the program.
For example, the Monkey number CXI is 111, and XXXVI is 36.
Roman numeral Natural number
I 1
V 5
X 10
L 50
C 100
D 500
Your program only needs to support the Monkey numerals listed in the table above.
Your program will only be able to calculate a natural number up to and including 999.
If the user enters a Monkey numeral which exceeds this, the output is to be 999.
Six (6) input values are provided by the user, the order of input is important:
The first input is the number of D’s that the Monkey numeral contains.
The second input is the number of C’s that the Monkey numeral contains.
The last input is the number of I’s that the Monkey numeral contains.
For example, if the user provides the inputs 0, 0, 0, 1, 2, 2 then this will be the equivalent of XVVII
Task 1-B:
Write a Little Monkey Computer program that calculates the factorial of a number provided by the user. Display the result as output before halting the program, unless an error code is to be displayed.
If the input value is greater than 6, then, the error code, 998, is displayed.
If the user enters zero, then, the error code, 998, is displayed.
Your program must not simply display pre-calculated values.
For example:
Input value: 0
Result: 998
Input value: 7
Result: 998
Input value: 3 Result: 6

Task 1-C:

Write a Little Monkey Computer program that solves the following piecewise function. Display the result as output before halting the program.
9???? + 7 ???????? 0 = ???? = 5
????(????) = ???? 3 - 3 ???????? 5 ???? = 9
(???? - 3) × 3 ???????? ???? 9
1.1 (8
Write pseudocode to describe your algorithm to solve the designated task.
• Describe the algorithm using natural language, structured using the convention of a normal programming language.
• When necessary, use looping and conditional constructs. • Name symbols (variables) sensibly to make their use clear.
Cormen (2009) wrote an excellent introduction to the conventions of pseudocode (see Part I, chapter 2, section 1.2). You can read this by searching for the text via QUT Library.
Cormen, Thomas H. Leiserson, Charles E. Rivest, Ronald L. Stein Clifford. (2009). Introduction to Algorithms (3rd Edition) - 2.1.2 Pseudocode Conventions. MIT Press.
Marking scheme
High Distinction Distinction Credit Pass Fail
Correctness
(4 marks) The algorithm correctly reflects the problem described in the specification. The algorithm reflects the problem described in the specification but further refinement is needed. The algorithm reflects some components of the problem described in the specification, however, with some error. The algorithm is poorly designed or does not accurately reflect the problem described in the specification. No attempt or the algorithm differs from the specification.
Notation and Using natural Using natural The description of the The language used to No attempt.
readability language, the algorithm language, the algorithm algorithm is difficult to describe the algorithm The language used to
(4 marks) is succinctly described. is described. follow or understand. is difficult to understand describe the algorithm
Logic constructs are Some text-styling is Text-styling is used or does not clearly provides no meaning.
appropriately used. used. minimally. reflect the intended No text-styling is used.
Text-styling, such as Variable naming is Variable naming is design. Variables are not
indentation and weight, consistent. ambiguous. Text-styling causes declared, are incorrect
enhances readability. readability issues. or provide no meaning
Variable naming is Variable names provide to the algorithm.
consistent making their use clear.
no meaning.
1.2 (8
Draw a flowchart diagram to describe your algorithm to solve the designated task.
• Draw your flowchart using Microsoft Office or an online tool like draw.io
• You must use the correct symbols, as set by ANSI, when representing algorithmic constructs. Examples are provided in the tutorial slides.
It is recommended that you use a tool such as LucidChart, Draw.IO or the shapes in Office (PowerPoint is best at this).
Marking scheme
High Distinction Distinction Credit Pass Fail
Correctness The algorithm correctly The algorithm reflects The algorithm reflects The algorithm is poorly No attempt or the
(4 marks) reflects the problem the problem described some components of designed or does not algorithm differs from
described in the in the specification but the problem described accurately reflect the the specification.
specification. further refinement is in the specification, problem described in
needed.
however, with some error. the specification.
Notation and The correct symbol is The correct symbol is In some cases, the Some symbols are No attempt.
readability used for each logic used for each logic correct symbol is used used incorrectly to The diagram provides
(4 marks) construct. construct. to represent a logic represent logic no meaning.
The placement of The placement of construct. constructs or symbols The diagram does not
symbols does not symbols makes for a The placement of some are used inconsistently. match the pseudocode
hinder the readability of diagram that is symbols needs The placement of written in the previous
the diagram and readable. improving. symbols hinders the section.
spacing is appropriately readability of the
used. diagram.

1.3 (4
Draft a test plan to be used as verification method to ensure that your LMC program is correct.
• Tabularise test input value(s) and the expected output(s)
• Consider uncommon cases. For example, when the calculator reaches its maximum value, when negative values are calculated, or when an input is unexpectedly large.
Draft your test plan using the following template (two examples are provided):
High Distinction Distinction Credit Pass Fail
Test cases An appropriate number An adequate number of An adequate number of Test plan is brief. No attempt.
(4 marks) of test cases are listed test cases are listed. test cases are listed. Test plan lacks the
to exhaust all potential Some edge-cases are Consideration for edge- ability to provide insight
cases. Edge-cases are considered. cases is minimal. into determining
considered.
whether the program will function as expected.
Comma-separate the input and output values.
Delete the examples.
Input Value(s) Expected output value(s) Notes
2,4,6 10 All even numbers
1,3,5 9 All odd numbers
Marking scheme
1.4 (15 marks)
Implement an LMC program according to the algorithm you designed in Q1.1 and Q1.2.
Use the test suite you designed in Q1.3 to verify the implementation of your algorithm is correct.
• Only symbolic addressing is to be used; numerical addressing will be disabled.
• LMC program must request the correct number of input(s).
• LMC program must produce the correct number of output(s).
• LMC program must produce the correct output value(s) for all given test cases.
• Code must be tidy (spacing, indentation) and comments are to be used to describe the algorithm. Do not describe the function of each LMC instruction. • Your LMC file should show the full history of how your solution was implemented.
Note: A mark of zero will be given for those test cases where the HLT command is not executed. This may be due to it being missing or, syntax or run-time errors. Errors will not be fixed by the marker.
Marking scheme*
High Distinction Distinction Credit Pass Fail
Features of the
LMC
(5 marks) The appropriate features of LMC are used, including looping and conditional constructs.
Symbolic addressing is used. The appropriate features of LMC are used. Looping or conditional constructs need improvement.
Symbolic addressing is used. Looping construct(s) for vital aspects of the problem are poorly used. Symbolic addressing is used. Looping constructs are emulated using repetition of code or fundamental logical errors are present. Some numerical addressing is used. No attempt.
No symbolic addressing is used.
Behaviour*
(5 marks) All test cases pass. The user is prompted for the correct number of input(s).
The number of output(s) produced matches that described. Most test cases pass. The user is requested to enter an incorrect number of input(s).
The number of outputs produced does not match that described. Some test cases pass. Issues are present with input and output. Most test cases do not pass.
Some test cases cause interpreter errors or execute an excessive number of instructions, most likely due to an infinite-loop.
Fundamental issues with input/output are present. No attempt.
All test cases cause interpreter errors. All test cases fail.
No input is requested when necessary.
No output is produced.
Readability
(5 marks) Code commenting is used to describe the algorithm. Code is spaced using indentation and line-breaks to distinctly separate sections of the program, to separate instructions and comments, and to separate symbols, mnemonics and addressing. Code commenting is used, with some sections needing more detail to describe the algorithm. Code is spaced appropriately to separate instructions and comments, or sections of the program. Code commenting is used but provides minimal description of the algorithm.
Code spacing is used minimally. Code commenting is used but provides no description of the algorithm.
Code is spaced poorly. No code commenting is used.
Code is not spaced.
Implementation** Evidence is provided to demonstrate how the program was implemented. Minimal evidence is provided to demonstrate authenticity of the solution submitted. No evidence to demonstrate implementation of the program is present in the LMC file or plagiarism was detected.
* Your program will be tested against a test suite defined by the marker. Points are awarded at the discretion of the marker.
** Plagiarism check. Penalties may apply. Submitting your original LMC file, which contains all save history, will assist the marker in verifying your work. Any save history in your LMC file that is dated after the due date (or an extended due date) will not be marked. An LMC file that contains very few historical records may result in you being asked to assist the marker in verifying your submission.
QUESTION 2 (9 MARKS)
Write an LMC program for each of the following equations:
????(????) = ???? + ????
????(????) = ????2 + ????
????(????) = ???? ???? + ????
For: ???? ? [1, 10]
Complete the following:
• Select a value for ????. State what your chosen value was.
• Execute each of the programs using your value for ????, and the values for ????.
• On a single diagram, plot the rate of growth for each algorithm.
• Describe the rate of growth for each algorithm. • Provide your solutions using the template provided on Blackboard.
You must test your programs using the Test Suite feature in the LMC IDE. You will need to increase the instruction execution limit to a larger value (by default, it is 300).
Note: you are not plotting ????(????), nor the final value of the program counter, but instead, the number of instructions executed to reach the solution. This is provided in the second last column of the Test Suite output.
Please submit Question 2 using the template provided on Blackboard.
Marking scheme
High Distinction Distinction Credit Pass Fail
Algorithm Algorithms correctly Algorithms are correctly Some algorithms need All algorithms need No attempt or
design, reflect each of the implemented with fixing. Code quality is fixing. Code quality is implementations are
implementation, equations, code is well minor issues. Code poor. poor. not correct.
code readability documented. readability needs
(3 marks) improving.
Plot Plot describes rate of Plot describes rate of Plot incorrectly Plot is missing No attempt or incorrect.
(3 marks) growth for the three growth for some describes rate of necessary features,
equations. All equations. Some growth for some and/or some curves are
necessary features of a overall improvements equations or major missing, and/or are
well-presented plot are present. needed.
improvements needed.
incorrect.
Justification Excellent description. Good description. Descriptions needs An attempt has been No attempt or incorrect.
(3 marks)
fixing.
made, however, needs significant improvements.
QUESTION 3 (7 MARKS)
The following algorithm has been implemented as an LMC program, however, the program does not behave as expected.
A part of your task is to debug the program so that the implementation matches the algorithm.
You must describe the change(s) that you make and provide clarity as to why you made them/it.
Provide a test suite to demonstrate that the fixes are correct.
Hint: the changes required are small. Do not rewrite the entirety or sections of the code.
CountItemsGreaterThanX n ? user-specified number of items x ? user-specified value for X c ? count of items greater than X while n is greater than 0
m ?user-specified item
if m x c = c + 1
n = n - 1
Display the count, c
Below is the code. Unfortunately, the developer has not indented or commented their code, so readability is low. A part of your task is to tidy and comment the code.
The LMC code is available on Blackboard as “Question3.txt”, and is below for your own reference.
It is strongly recommended that you do not copy and paste from here as Office Word is known for incorrectly formatting code; you should use the code available on Blackboard.
IN
STO INPUTCOUNT
IN
STO X
LOOPSTART: LDA LOOPCOUNT
ADD ONE
STO LOOPCOUNT
LDA INPUTCOUNT
SUB LOOPCOUNT
BR CONTINUELOOP
BR LOOPEND
CONTINUELOOP: IN
SUB X
BRP COUNTINC BR LOOPSTART
COUNTINC: LDA NUMITEMSGREATER
ADD ONE
STO NUMITEMSGREATER
BR LOOPSTART
LOPEND: LDA NUMITEMSGREATER
OUT
HLT
INPUTCOUNT: DAT 000
LOOPCOUNT: DAT 000
NUMITEMSGREATER: DAT 000
ONE: DAT 000
X: DAT 000
Please submit Question 3 using the template provided on Blackboard.
of 11
Marking scheme
High Distinction Distinction Credit Pass Fail
Justification
(3 marks) All syntax, run-time and logical errors have been fixed. A succinct description of each is provided. All syntax, run-time and logical errors have been fixed. The description and/or the explanation of the fix is limited. Some errors have been fixed. An explanation is present. All or some errors have been fixed. No description of the fixes.
OR
No errors have been fixed.
Some description provided. No attempt.
Readability
(2 marks) Code commenting is used to described the algorithm. Code is spaced using indentation and line-breaks to distinctly separate sections of the program, to separate instructions and comments, and to separate symbols, mnemonics and addressing. Code commenting is used, with some sections needing more detail to describe the algorithm. Code is spaced appropriately to separate instructions and comments, or sections of the program. Code commenting is used but provides minimal description of the algorithm. Code spacing is used minimally. Code commenting is used but provides no description of the algorithm.
Code is spaced poorly. No code commenting is used.
Code is not spaced.
Test cases
(2 marks) An appropriate number of test cases are listed to exhaust all potential cases. Edge-cases are considered. An adequate number of test cases are listed. Some edge-cases are considered. An adequate number of test cases are listed. Consideration for edge- cases is minimal. Test plan is brief. No attempt. Test plan lacks the ability to provide insight into determining whether the program will function as expected.
of 11
t