fbpx

Get Cheapest Assignment in Australia, UK, US, UAE, Canada and NZ Order Now

IFN551 Computer Systems Fundamentals

0 Comments

IFN551 Computer Systems Fundamentals

Assignment B

Weighting: 50%

Due Friday 3rd September 2021 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 (40 MARKS)

Select the task according to the last digit of your student ID: 0, 5,                                Task 1-A

1, 8,                        Task 1-B

2, 6,                        Task 1-C

4, 7,                        Task 1-D

3, 9                         Task 1-E

For example: if your student ID is n98765435 then you will do Task A. 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 numeralNatural number
I1
V5
X10
L50
C100
D500

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 DistinctionDistinctionCreditPassFail
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 andUsing naturalUsing naturalThe description of theThe language used toNo attempt.
readabilitylanguage, the algorithmlanguage, the algorithmalgorithm is difficult todescribe the algorithmThe language used to
(4 marks)is succinctly described.is described.follow or understand.is difficult to understanddescribe the algorithm
 Logic constructs areSome text-styling isText-styling is usedor does not clearlyprovides no meaning.
 appropriately used.used.minimally.reflect the intendedNo text-styling is used.
 Text-styling, such asVariable naming isVariable naming isdesign.Variables are not
 indentation and weight,consistent.ambiguous.Text-styling causesdeclared, are incorrect
 enhances readability.  readability issues.or provide no meaning
 Variable naming is  Variable names provideto the algorithm.
 consistent making their  no meaning. 
 use clear.    

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 DistinctionDistinctionCreditPassFail
CorrectnessThe algorithm correctlyThe algorithm reflectsThe algorithm reflectsThe algorithm is poorlyNo attempt or the
(4 marks)reflects the problemthe problem describedsome components ofdesigned or does notalgorithm differs from
 described in thein the specification butthe problem describedaccurately reflect thethe specification.
 specification.further refinement isin the specification,problem described in 
  needed.however, with somethe specification. 
   error.  
Notation andThe correct symbol isThe correct symbol isIn some cases, theSome symbols areNo attempt.
readabilityused for each logicused for each logiccorrect symbol is usedused incorrectly toThe diagram provides
(4 marks)construct.construct.to represent a logicrepresent logicno meaning.
 The placement ofThe placement ofconstruct.constructs or symbolsThe diagram does not
 symbols does notsymbols makes for aThe placement of someare used inconsistently.match the pseudocode
 hinder the readability ofdiagram that issymbols needsThe placement ofwritten in the previous
 the diagram andreadable.improving.symbols hinders thesection.
 spacing is appropriately  readability of the 
 used.  diagram. 

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,610All even numbers
1,3,59All odd numbers

Marking scheme

 High DistinctionDistinctionCreditPassFail
Test casesAn appropriate numberAn adequate number ofAn adequate number ofTest plan is brief.No attempt.
(4 marks)of test cases are listedtest cases are listed.test cases are listed. Test plan lacks the
 to exhaust all potentialSome edge-cases areConsideration for edge- ability to provide insight
 cases. Edge-cases areconsidered.cases is minimal. into determining
 considered.   whether the program
     will function as
     expected.

Question 1.4                                                                                                                                                        (20 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 DistinctionDistinctionCreditPassFail
Features of the LMC (7 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* (8 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 (5 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 DistinctionDistinctionCreditPassFail
AlgorithmAlgorithms correctlyAlgorithms are correctlySome algorithms needAll algorithms needNo attempt or
design,reflect each of theimplemented withfixing. Code quality isfixing. Code quality isimplementations are
implementation,equations, code is wellminor issues. Codepoor.poor.not correct.
code readabilitydocumented.readability needs   
(1.5 marks) improving.   
PlotPlot describes rate ofPlot describes rate ofPlot incorrectlyPlot is missingNo attempt or incorrect.
(1.5 marks)growth for the threegrowth for somedescribes rate ofnecessary features, 
 equations. Allequations. Somegrowth for someand/or some curves are 
 necessary features of aoverall improvementsequations or majormissing, and/or are 
 well-presented plot areneeded.improvements needed.incorrect. 
 present.    
JustificationExcellent description.Good description.Descriptions needsAn attempt has beenNo attempt or incorrect.
(2 marks)  fixing.made, however, needs 
    significant 
    improvements. 

QUESTION 3 (5 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.

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.

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 DistinctionDistinctionCreditPassFail
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.

Leave a Reply

Your email address will not be published. Required fields are marked *