Recent Question/Assignment

IFN551 Computer Systems Fundamentals
Assignment B
Weighting: 50%
Due Friday 22nd 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)
Select the task according to the last digit of your student ID:
1, 2, Task 1-A
3, 4, Task 1-B
5, 6, Task 1-C
7, 8, Task 1-D
9, 0 Task 1-E
For example: if your student ID is n98765435 then you will do Task C.
Selecting the incorrect task will result in a grade of zero for this question.
See the following pages for the Tasks.
• 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 can convert an n-bit binary number into a number using the base-10 number system. Display the natural number as output before halting the program.
The first input determines the value for n. It is assumed this value will be equal to four, or greater.
For example, if the first input is eight (8) then eight subsequent inputs are requested.
If the subsequent inputs number were 1, 0, 0, 1, 0, 0, 0, 0 then the output would be 9.
n input values are provided by the user, one for each bit:
The first of these is the least-significant bit.
The n’th input is the most-significant bit.
Task 1-C:
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-D:
Write a Little Monkey Computer program that calculates the sum of numbers provided by the user. Display the summation as output before halting the program.
If the user has provided less than or equal to ten input values, then only sum even numbers. Odd numbers are ignored.
If the user has provided more than ten values, then only sum any odd numbers subsequent to the tenth input. The existing summation shall remain.
If the user enters zero, at any point, then the summation is displayed.
For example:
Input values: 3, 3, 4, 0 Result: 4
Input values: 2, 3, 7, 0 Result: 2
Input values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 0 Result: 43
Task 1-E:
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


Question 1.1 (8 marks)
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 readability (4 marks) Using natural language, the algorithm is succinctly described. Logic constructs are appropriately used. Text-styling, such as indentation and weight, enhances readability. Variable naming is consistent making their use clear. Using natural language, the algorithm is described. Some text-styling is used.
Variable naming is consistent.
The description of the algorithm is difficult to follow or understand. Text-styling is used minimally.
Variable naming is ambiguous. The language used to describe the algorithm is difficult to understand or does not clearly reflect the intended design.
Text-styling causes readability issues. Variable names provide no meaning. No attempt.
The language used to describe the algorithm provides no meaning.
No text-styling is used. Variables are not declared, are incorrect or provide no meaning to the algorithm.
Question 1.2 (8 marks)
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
(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 readability (4 marks) The correct symbol is used for each logic construct. The placement of symbols does not hinder the readability of the diagram and spacing is appropriately used. The correct symbol is used for each logic construct. The placement of symbols makes for a diagram that is readable. In some cases, the correct symbol is used to represent a logic construct.
The placement of some symbols needs improving. Some symbols are used incorrectly to represent logic constructs or symbols are used inconsistently. The placement of symbols hinders the readability of the diagram. No attempt.
The diagram provides no meaning.
The diagram does not match the pseudocode written in the previous section.
Question 1.3 (4 marks)
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):
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
High Distinction Distinction Credit Pass Fail
Test cases
(4 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 edgecases 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.
Question 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 design, implementation, code readability
(3 marks) Algorithms correctly reflect each of the equations, code is well documented. Algorithms are correctly implemented with minor issues. Code readability needs improving.
Some algorithms need fixing. Code quality is poor. All algorithms need fixing. Code quality is poor. No attempt or implementations are not correct.
Plot
(3 marks) Plot describes rate of growth for the three equations. All necessary features of a well-presented plot are present. Plot describes rate of growth for some equations. Some overall improvements needed. Plot incorrectly describes rate of growth for some equations or major improvements needed. Plot is missing necessary features, and/or some curves are missing, and/or are incorrect. No attempt or incorrect.
Justification
(3 marks) Excellent description. Good description. Descriptions needs fixing. An attempt has been made, however, needs significant improvements. No attempt or incorrect.
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.
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 edgecases 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.

Looking for answers ?