



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Main points of this past exam are: Unsigned Representation, Adding, Complement Representation, Overflow, Unsigned Representation, Decimal Number, Minimum Number
Typology: Exams
1 / 5
This page cannot be seen from the preview
Don't miss anything!




Spring 2011
Wednesday, February 1 6 , 2011
Name: NetID:
Problem 1 10 points _______________________________
Problem 2 5 points _______________________________
Problem 3 10 points _______________________________
Problem 4 5 points _______________________________
Total 30 points _______________________________
Problem 1 (10 points): Binary representation
Part A (2 points): What is the 8-bit result of adding the following pairs of 8-bit numbers
together?
a ) 01110111 + 00101001 = _________________________
Assuming 8-bit 2’s complement representation, is there overflow? (circle one) yes no
Assuming an unsigned representation, is there overflow? (circle one) yes no
b ) 11100111 + 01110010 = _________________________
Assuming 8-bit 2’s complement representation, is there overflow? (circle one) yes no
Assuming an unsigned representation, is there overflow? (circle one) yes no
Part B (2 points): Convert decimal number - 128 into signed magnitude, 2’s complement, and
1’s complement binary representations using the minimum number of bits.
Signed magnitude: _____________________
2’s complement: _____________________
1’s complement: _____________________
Part C (1 point): How is the number - 4.875 represented in the floating point data type format?
Answer: _________________________________________________
Part D ( 2 points): In homework #1 you calculated the accuracy of the floating point
representation of e. How accurate is the floating point notation when the largest possible number
is represented using this notation (with the exponent field being within the range of 1 to 254)?
Answer: 2
N
, where N =___________________________________
Part E ( 3 points): Using binary integer arithmetic, what 32-bit pattern can be added to this
floating point representation to effectively multiply it by 3? (Hint: 3 = 2 * 1.5)
Answer: _________________________________________________
Problem 3 ( 10 points): Memory
A multi-level cell (MLC) is a memory cell that has more than 2 states, allowing it to store more
bits of information in the same space. In this problem, you will be working with 4-state MLCs
that each store 2 bits of information. Given four 4 - state MLCs, build a 2x4-bit memory unit
using only AND, OR, NOT gates and MUXes:
If you need to merge two 1-bit wires into a single 2-bit wire, or to
split one 2 - bit wire into two 1-bit wires, you can use the following
notation where [0] and [1] indicate # of the 1-bit wire:
merge split
Problem 4 (5 points): C language
Part A (1 points): Assume variables x , y , and z are already declared. Write a C expression to
evaluate
!
!
!
Do not switch the order of operands.
Answer: ___________________________________________________
Part B (2 points): Fill in missing expressions to implement the following formula:
if ( _________________________________________ )
f = 1;
else if ( ____________________________________ )
f = - 1;
else
f = x;
Part C (1 points): Write the output produced by the following code segment:
int x = 10 ;
for (x = 0; x < 5; x++)
printf(“%d=“, x+2);
Answer: ____________________________________________
Part D (1 points): Using only declared variables, write missing arguments in scanf function
call that correspond to the provided format conversion specifications.
int day;
float temp;
char grade;
scanf(“%f %c”, _________________________________________ );
scanf(“%d”, _________________________________________ );