Assignment 1: Computers, data and programming
VerifiedAdded on 2023/01/23
|8
|2156
|89
AI Summary
This assignment includes questions related to computers, data, and programming. It covers topics such as calculating Fibonacci numbers, dealing with interrupts in a computer system, and analyzing the benefits of multiple-bus architecture.
Contribute Materials
Your contribution can guide someone’s learning journey. Share your
documents today.
Assignment 1: Computers, data and programming
Value: 15%
Task
back to top
Total marks: 30
Answer the following Questions
Question 1.
a) Determine the value of base b if (152)b = 0x6A. Please show all steps.
[3 marks]
152b = = b2 x 1 + b1 x 5 + b0 x 2 = b2 + 5b + 2
0x6a = 161 x 6 + 160 x 10 = 96 + 10 = 106
b2 + 5b + 2 = 106
(b + 13) ( b – 8 ) = 0
Base must be +ve number i.e. 8
b) Convert the followings: (Please show all steps; no marks will be awarded if no steps are
shown)
[1.5x4 = 6 marks]
i) 0xBAD into 3-base representation
Convert 0xBAD to decimal and then decimal value to Base 3
0xBAD = 162 x 11 + 161 x 10 + 160 x 13 = 2816 + 160 + 13 = 2989
Converting this to Base 3
2989 / 3 = 996 R 1
996 / 3 = 332 R 0
332 / 3 = 110 R 2
110 / 3 = 36 R 2
36 / 3 = 12 R 0
12 / 3 = 4 R 0
4 / 3 = 1 R 1
1/ 3 = 0 R 1
Write all remainders in reverse order 0x BAD = 110022013
Value: 15%
Task
back to top
Total marks: 30
Answer the following Questions
Question 1.
a) Determine the value of base b if (152)b = 0x6A. Please show all steps.
[3 marks]
152b = = b2 x 1 + b1 x 5 + b0 x 2 = b2 + 5b + 2
0x6a = 161 x 6 + 160 x 10 = 96 + 10 = 106
b2 + 5b + 2 = 106
(b + 13) ( b – 8 ) = 0
Base must be +ve number i.e. 8
b) Convert the followings: (Please show all steps; no marks will be awarded if no steps are
shown)
[1.5x4 = 6 marks]
i) 0xBAD into 3-base representation
Convert 0xBAD to decimal and then decimal value to Base 3
0xBAD = 162 x 11 + 161 x 10 + 160 x 13 = 2816 + 160 + 13 = 2989
Converting this to Base 3
2989 / 3 = 996 R 1
996 / 3 = 332 R 0
332 / 3 = 110 R 2
110 / 3 = 36 R 2
36 / 3 = 12 R 0
12 / 3 = 4 R 0
4 / 3 = 1 R 1
1/ 3 = 0 R 1
Write all remainders in reverse order 0x BAD = 110022013
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
ii) 3217 into 2-base (binary) representation
3217 / 2 = 1608 R 1
1608 / 2 = 804 R 0
804 / 2 = 402 R 0
402 / 2 = 201 R 0
201 / 2 = 100 R 1
100 / 2 = 50 R 0
50 / 2 = 25 R 0
25 / 2 = 12 R 1
12 / 2 = 6 R 0
6 / 2 = 3 R 0
3 / 2 = 1 R 1
1 / 2 = 0 R 1
3217 = 110010010001b
iii) 1235 into octal representation
1235 / 8 = 154 R 3
154 / 8 = 19 R 2
19 / 8 = 2 R 3
2 / 8 = 0 R 2
1235 = 23238
iv) 21.218 into decimal representation
c) Given a (very) tiny computer that has a word size of 3 bits, what are the lowest value
(negative number) and the highest value (positive number) that this computer can represent in
each of the following representations?
[3 marks]
i) One's complement
ii) Two's complement
iii) Signed Magnitude
3217 / 2 = 1608 R 1
1608 / 2 = 804 R 0
804 / 2 = 402 R 0
402 / 2 = 201 R 0
201 / 2 = 100 R 1
100 / 2 = 50 R 0
50 / 2 = 25 R 0
25 / 2 = 12 R 1
12 / 2 = 6 R 0
6 / 2 = 3 R 0
3 / 2 = 1 R 1
1 / 2 = 0 R 1
3217 = 110010010001b
iii) 1235 into octal representation
1235 / 8 = 154 R 3
154 / 8 = 19 R 2
19 / 8 = 2 R 3
2 / 8 = 0 R 2
1235 = 23238
iv) 21.218 into decimal representation
c) Given a (very) tiny computer that has a word size of 3 bits, what are the lowest value
(negative number) and the highest value (positive number) that this computer can represent in
each of the following representations?
[3 marks]
i) One's complement
ii) Two's complement
iii) Signed Magnitude
Highest Positive Value Highest Negative Value
One's complement 2(3-1) -1= + 3 - (2(3-1) -1) = -3
Two's complement 2(3-1) -1 = + 3 - (2(3-1)) = -4
Signed Magnitude 2(3-1) -1= + 3 - (2(3-1) -1) = -3
Question 2.
a) The Fibonacci numbers are the numbers in the following integer sequence, called the
Fibonacci sequence, and are characterised by the fact that every number after the first two is
the sum of the two preceding ones: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 114, … etc.
By definition, the first two numbers in the Fibonacci sequence are 0 and 1, and each
subsequent number is the sum of the previous two. We define Fib(0)=0, Fib(1)=1, Fib(2)=1,
Fib(3)=2, Fib(4)=3, etc. The first 22 Fibonacci numbers given below:
Fib(0
)
Fib(1
)
Fib(2) Fib(3) Fib(4
)
Fib(5) Fib(6) Fib(7) Fib(8) Fib(9) Fib(10)
0 1 1 2 3 5 8 13 21 34 55
Fib(11
)
Fib(12
)
Fib(13
)
Fib(14
)
Fib(15
)
Fib(16
)
Fib(17
)
Fib(18
)
Fib(19
)
Fib(20
)
Fib(21
)
89 144 233 377 610 987 1597 2584 4181 6765 10946
Write a MARIE program to calculate Fib(n), where the user inputs n. For example, if the user inputs
7, the program outputs the value 13; if the user inputs 15, the program outputs the value 610; if the
user inputs 20, the program outputs the value 6765 and so on. You need to write and run the
program using MARIE simulator. Please include appropriate comments to make your code readable.
[8 marks]
/*******************************************************
/ The Fibonacci numbers program
/*******************************************************
ORG 0
One's complement 2(3-1) -1= + 3 - (2(3-1) -1) = -3
Two's complement 2(3-1) -1 = + 3 - (2(3-1)) = -4
Signed Magnitude 2(3-1) -1= + 3 - (2(3-1) -1) = -3
Question 2.
a) The Fibonacci numbers are the numbers in the following integer sequence, called the
Fibonacci sequence, and are characterised by the fact that every number after the first two is
the sum of the two preceding ones: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 114, … etc.
By definition, the first two numbers in the Fibonacci sequence are 0 and 1, and each
subsequent number is the sum of the previous two. We define Fib(0)=0, Fib(1)=1, Fib(2)=1,
Fib(3)=2, Fib(4)=3, etc. The first 22 Fibonacci numbers given below:
Fib(0
)
Fib(1
)
Fib(2) Fib(3) Fib(4
)
Fib(5) Fib(6) Fib(7) Fib(8) Fib(9) Fib(10)
0 1 1 2 3 5 8 13 21 34 55
Fib(11
)
Fib(12
)
Fib(13
)
Fib(14
)
Fib(15
)
Fib(16
)
Fib(17
)
Fib(18
)
Fib(19
)
Fib(20
)
Fib(21
)
89 144 233 377 610 987 1597 2584 4181 6765 10946
Write a MARIE program to calculate Fib(n), where the user inputs n. For example, if the user inputs
7, the program outputs the value 13; if the user inputs 15, the program outputs the value 610; if the
user inputs 20, the program outputs the value 6765 and so on. You need to write and run the
program using MARIE simulator. Please include appropriate comments to make your code readable.
[8 marks]
/*******************************************************
/ The Fibonacci numbers program
/*******************************************************
ORG 0
/*** Get user input
INPUT
STORE count
/*** Fibonacci Sequence
/*** final = numa + numb
/*** Loop till count hits 0
generator, LOAD count
SUBT ONE
STORE count
/*** check if count zero then print results
SKIPCOND 800
JUMP printfunc
/*** here if count not zero
LOAD ZERO
ADD numa
ADD numb
STORE final
/*** need to get new values for next loop
/*** new fib value become fibn and old fib n becomes fib n-1
LOAD numb
STORE numa
LOAD final
STORE numb
/*** check count and exit when 0
JUMP generator
printfunc, LOAD final
OUTPUT
INPUT
STORE count
/*** Fibonacci Sequence
/*** final = numa + numb
/*** Loop till count hits 0
generator, LOAD count
SUBT ONE
STORE count
/*** check if count zero then print results
SKIPCOND 800
JUMP printfunc
/*** here if count not zero
LOAD ZERO
ADD numa
ADD numb
STORE final
/*** need to get new values for next loop
/*** new fib value become fibn and old fib n becomes fib n-1
LOAD numb
STORE numa
LOAD final
STORE numb
/*** check count and exit when 0
JUMP generator
printfunc, LOAD final
OUTPUT
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
End, HALT / HALT process
/>>>>> Variable and Constants
ZERO, DEC 0
ONE, DEC 1
numa, DEC 0
numb, DEC 1
final, DEC 0
count, DEC 0
b) For some values of n, your program will not produce correct results. You can check this by
gradually increasing the values of n and checking for the correct outputs. What is the maximum
value of n for which your program produces a correct result? Why? Please comment on this
[3 marks].
Fib(23) was 28657. After that Program started printing negative values. Reason is use of two’
complement representation of numbers in MARIE.
Question 3.
a) What are the 'interrupts' in a computer system? Describe the approaches to deal with
multiple interrupts in a system.
[4 marks]
Interrupt is a mechanism to make CPU aware of the pending request from an external device.
When a device wants to communicate with CPU, it generates an interrupt expecting the CPU
to take a branch to service routine of that interrupt and service the request from device. It
helps to allow asynchronous inputs be processed by CPU as and when they arrive.
In CPU that supports multiple interrupts, if only 1 interrupt is generated at a time, the CPU
can service it easily and return to main program. However if more than one interrupt appear
at the same time, then CPU has to choose one among the many. Since CPU can service only
one interrupt at a time. Then CPU resolves this contention by using priority mechanism. The
/>>>>> Variable and Constants
ZERO, DEC 0
ONE, DEC 1
numa, DEC 0
numb, DEC 1
final, DEC 0
count, DEC 0
b) For some values of n, your program will not produce correct results. You can check this by
gradually increasing the values of n and checking for the correct outputs. What is the maximum
value of n for which your program produces a correct result? Why? Please comment on this
[3 marks].
Fib(23) was 28657. After that Program started printing negative values. Reason is use of two’
complement representation of numbers in MARIE.
Question 3.
a) What are the 'interrupts' in a computer system? Describe the approaches to deal with
multiple interrupts in a system.
[4 marks]
Interrupt is a mechanism to make CPU aware of the pending request from an external device.
When a device wants to communicate with CPU, it generates an interrupt expecting the CPU
to take a branch to service routine of that interrupt and service the request from device. It
helps to allow asynchronous inputs be processed by CPU as and when they arrive.
In CPU that supports multiple interrupts, if only 1 interrupt is generated at a time, the CPU
can service it easily and return to main program. However if more than one interrupt appear
at the same time, then CPU has to choose one among the many. Since CPU can service only
one interrupt at a time. Then CPU resolves this contention by using priority mechanism. The
interrupt with higher priority is serviced first and then any pending interrupts are serviced in
order of decreasing priority.
b) Analyse the benefits of using a multiple-bus architecture compared to a single-bus
architecture for a computer system.
Architectures with multiple buses allow CPU to execute instructions without stalling. They
help CPU access multiple devices. Further having different types of bus allows CPU to
integrate devices with various capacities and capabilities. All devices need not follow the
same protocol. For example, memory needs to have different set of buses while a serial
device will need different type of bus signals. Having multiple buses allow all kinds of
devices to communicate with processor.
[3 marks]
Rationale
This assessment task will assess the following learning outcome/s:
be able to investigate and describe the essential elements of a computer and their
functionalities.
be able to apply an understanding of data representations and calculations to practical
situations.
be able to develop an elementary computer program.
Marking criteria and standards
Criteria HD (85%-
100%)
DI (75%-
84%) CR (65%-74%) PS (50%-64%) FL (0%-49%)
Comprehensio
n of data
representation
and application
of computer
math
calculations
All
calculations
were correct.
Appropriate
mathematical
symbols were
used, and all
steps/working
s were shown.
Almost all
Calculations
were
correct
except a
minor error.
Most of the
calculations are
correct.
However, few
steps were
omitted. The
methods used
to solve the
problem were
correct, but
there were one
or two
miscalculations.
At least half of
the
calculations
were correct.
Some
incorrect
answers were
the result of
errors at
some stage of
the
calculation,
which
propagated
with the next
steps. Some
of the steps
showed the
No attempt
or most of
the
calculations
were
incorrect.
Failed to
show the
steps of
calculation.
Either the
answers
were
incorrect or
the steps
were wrong.
order of decreasing priority.
b) Analyse the benefits of using a multiple-bus architecture compared to a single-bus
architecture for a computer system.
Architectures with multiple buses allow CPU to execute instructions without stalling. They
help CPU access multiple devices. Further having different types of bus allows CPU to
integrate devices with various capacities and capabilities. All devices need not follow the
same protocol. For example, memory needs to have different set of buses while a serial
device will need different type of bus signals. Having multiple buses allow all kinds of
devices to communicate with processor.
[3 marks]
Rationale
This assessment task will assess the following learning outcome/s:
be able to investigate and describe the essential elements of a computer and their
functionalities.
be able to apply an understanding of data representations and calculations to practical
situations.
be able to develop an elementary computer program.
Marking criteria and standards
Criteria HD (85%-
100%)
DI (75%-
84%) CR (65%-74%) PS (50%-64%) FL (0%-49%)
Comprehensio
n of data
representation
and application
of computer
math
calculations
All
calculations
were correct.
Appropriate
mathematical
symbols were
used, and all
steps/working
s were shown.
Almost all
Calculations
were
correct
except a
minor error.
Most of the
calculations are
correct.
However, few
steps were
omitted. The
methods used
to solve the
problem were
correct, but
there were one
or two
miscalculations.
At least half of
the
calculations
were correct.
Some
incorrect
answers were
the result of
errors at
some stage of
the
calculation,
which
propagated
with the next
steps. Some
of the steps
showed the
No attempt
or most of
the
calculations
were
incorrect.
Failed to
show the
steps of
calculation.
Either the
answers
were
incorrect or
the steps
were wrong.
basic
understanding
the
numbering
system.
Simulating and
investigating of
internal
operations of
CPU and
it'sinstruction
execution
(programming
skills)
The code
meets the
specification
. Code is well
documented
with
comments.
The program
produces
correct
outputs in
every input
situations.
Code meets
specification
and is well
documented
with
comments.
Minor errors
in
explanations
.
Code meets
specification.
Most of the
time produces
correct results,
however does
not produce
correct results
for special
inputs. Little
documentatio
n and
comments.
Code meets
specification
but has errors
in operation.
Little
commenting.
Basic idea is
expressed by
the codes and
explanations.
Code does not
meet the
specification.
Comprehensio
n of internal
elements of
computer
organisation
Answers are
corrects. All
steps are
correctly
shown.
All codes are
accurately
written.
All answers
are correct
with a minor
error. All
codes are
correct
except a
minor error.
Few minor
errors in
calculating the
address
spaces. The
steps show the
clear
understanding
of the address
space
calculation.
All codes
written
correctly
however the
order were not
maintained
correctly.
The final
result is not
correct,
however the
calculations
show the
basic
understandin
g of the
instruction set
architecture.
More than
half of the
codes are
correct.
No attempt or
incorrect
calculations
showing no or
minimum
understandin
g of the topic.
Codes do not
meet the
specification.
Presentation
Please also adhere to the following formatting rules:
1. For Q2(a) you need to submit a *.mas file.
understanding
the
numbering
system.
Simulating and
investigating of
internal
operations of
CPU and
it'sinstruction
execution
(programming
skills)
The code
meets the
specification
. Code is well
documented
with
comments.
The program
produces
correct
outputs in
every input
situations.
Code meets
specification
and is well
documented
with
comments.
Minor errors
in
explanations
.
Code meets
specification.
Most of the
time produces
correct results,
however does
not produce
correct results
for special
inputs. Little
documentatio
n and
comments.
Code meets
specification
but has errors
in operation.
Little
commenting.
Basic idea is
expressed by
the codes and
explanations.
Code does not
meet the
specification.
Comprehensio
n of internal
elements of
computer
organisation
Answers are
corrects. All
steps are
correctly
shown.
All codes are
accurately
written.
All answers
are correct
with a minor
error. All
codes are
correct
except a
minor error.
Few minor
errors in
calculating the
address
spaces. The
steps show the
clear
understanding
of the address
space
calculation.
All codes
written
correctly
however the
order were not
maintained
correctly.
The final
result is not
correct,
however the
calculations
show the
basic
understandin
g of the
instruction set
architecture.
More than
half of the
codes are
correct.
No attempt or
incorrect
calculations
showing no or
minimum
understandin
g of the topic.
Codes do not
meet the
specification.
Presentation
Please also adhere to the following formatting rules:
1. For Q2(a) you need to submit a *.mas file.
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
2. Please compose the answers of rest of the questions 3 in a document file (doc or docx format).
Please do not submit in pdf formats. Please upload the document in the Turnitin within deadline.
3. You may put the mas file and document file in a folder, compress the folder and upload the
compressed file to the Turnitin. You may also upload the two files separately.
4. The first page (cover page) of the document file should have the following information
clearly mentioned:
a. Your full name
b. Your Student ID
c. Subject Code (ITC544)
d. Assessment item number and name (Assignment 1: Computers, data and programming)
5. Each page should have page numbers in “page x of y” format (including the cover page).
6. You DO NOT need to provide any references for any of the questions.
Please do not submit in pdf formats. Please upload the document in the Turnitin within deadline.
3. You may put the mas file and document file in a folder, compress the folder and upload the
compressed file to the Turnitin. You may also upload the two files separately.
4. The first page (cover page) of the document file should have the following information
clearly mentioned:
a. Your full name
b. Your Student ID
c. Subject Code (ITC544)
d. Assessment item number and name (Assignment 1: Computers, data and programming)
5. Each page should have page numbers in “page x of y” format (including the cover page).
6. You DO NOT need to provide any references for any of the questions.
1 out of 8
Related Documents
Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
© 2024 | Zucol Services PVT LTD | All rights reserved.