Download 1 - Suraj @ LUMS

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Abuse of notation wikipedia , lookup

Bra–ket notation wikipedia , lookup

Musical notation wikipedia , lookup

Arithmetic wikipedia , lookup

Large numbers wikipedia , lookup

History of mathematical notation wikipedia , lookup

Addition wikipedia , lookup

Elementary mathematics wikipedia , lookup

Big O notation wikipedia , lookup

Location arithmetic wikipedia , lookup

Positional notation wikipedia , lookup

Transcript
Computer Organization & Assembly Language, Spring 2002-03
CS 223
Quiz 4
21/04/03
Time allowed: 15 min
Name:___________________________
No: __________________
Note: Please show all workings. Use may use the reverse side of this sheet if necessary.
Q1.
Consider an n-bit sequence of ternary numbers (base 3) a n1a n2  a1a0
a) If the number is interpreted as an unsigned integer A, its value will have the
format:
g
n 1
i f
i 0
A   B c d e => A   3i ai (1)
Write an expression for A in the space provided by assigning appropriate values
to B, c, d, e and f.
b) Can you develop a similar expression for A if it is to be interpreted to represent
a number in sign magnitude format?: (2)
Assuming that you have an n bit binary number:
A
n2
2 a
i
i 0
i
if an-1 =0 or A   -
n2
2 a
i
i 0
i
if an-1 =1
c) Can you develop a similar expression for A if it is to be interpreted to represent
a number in two’s complement format?: (2)
Assuming that you have an n bit binary number:
A   -2
n2
n-1
an-1 +
2 a
i
i 0
i
If n were a ternary number then we’d have to decide how to represent negative numbers. For
example we could assume that if an-1 = 0 the number is negative, and if an-1 = 1 or 2 the
number is positive and proceed from here.
Computer Organization & Assembly Language, Spring 2002-03
Q2.
Consider the binary number 1001.011
What is its decimal equivalent? (2)
9.375
Q3.
Consider the 8-bit number A = 1000 0110 in Twos complement notation.
What is the representation for –A in:
a) 8-bit sign magnitude notation? (1.5)
01111010
b) Twos complement notation? (1.5)
01111010
Q4.
A 16-bit floating-point representation has the following format: (5)
1bit – 4 bits – 11 bits where
the first bit represents the sign of the significand
the next 4 bits represent a biased exponent (the bias is 7)
the last 11 bits represent the significand.
How would you represent the number -13.375?
1
1010
10101100000
21/04/03