CS250 Homework Midterm Practice
a) Solve this homework and turnin your handwritten or printed
answers on
during the midterm exam. You will find similar
questions in the midterm exam.
I will post the evening before the exam. I strongly suggest
you to complete your homework on your own before looking at the
solutions.
=====================================================
1. Implement the boolean function for :xsegment b for a 7-segment
decoder. Using four switches w, x, y, z choose the digits 0,
1, 2, 3,4,5,6,7,8,9,A,B,C,D,E,F in the
seven segment display.
a) Write the truth table for the segment b
b) Write the Karnaugh maps for b
c) Using the Karnaugh maps, write the boolean expressions for
segment a and b using a minimum "sum
of products" boolean expression.
b =
d) Draw the schematic of your implementation using NAND gates.
2. Draw a Flip Flop
a) Using NAND gates
b) Using NOR gates
3. In each line write the name of the memory section where
the
variables are stored:
CS250 Spring2008 Midterm
int a = 5; // a is stored in
_____________
int b[20]; // b is stored in _____________
int main() { // main is stored in _____________
{
int x; // x is stored in
_____________
int *p = (int *)malloc(sizeof(int)); // p
points to
memory stored in ___________
}
4. Enumerate the steps needed to load a program.
5. What is a "Dynamic Linker" and a "Static Linker".
6. Perform the following multiplication in binary. Also, show
convert
to decimal the operands and the result.
1001010
x 1101
7. Perform the following division in binary, Also, convert
to
decimal the operands and the result.
1011
| 100101001
8. Represent the number1.25 in binary using the IEEE 754
double
representation. The formula is given:
Val in decimal = (-1)s
x (1.m) x 2(e-bias) where:
bias = 1023
s = bit 63
e = bits 52 to 62
m= bits 0 to 51
Val in binary:
___________________________
CS250 Spring2008 Midterm
9. Explain what is a "Pipe Stall" and how can be avoided.
10. Obtain the representation of number -58 using 8 bits. Verify
that 78 + (-58) is equal to 20 using binary addition and complements
of 2.
11. Write a function "int isBigEndian()" that will return 1 if the
computer is big endian or 0 if it is little endian.
12. What is the difference between Harvard Architecture and Von
Newman Architecture
13. What do CISC and RISC stand for and enumerate the
characteristics of each.
14. Write the following characteristics of the ATMEGA328:
Program Memory (KB):
RAM (KB):
Clock Speed (Hz):
Number of I/O ports:
Number of A/D ports:
14. Rewrite the following program in AVR assembly language. Remember
that int's in AVR are 2 bytes long.
int a = 6;
int b = 3;
int c;
void setup() {
c = a + b;
}
loop()
{
}
15. Rewrite the following program in AVR assembly language. Remember
that int's in AVR are 2 bytes long.
int a = 6;
int b = 4;
int c;
void setup() {
c = a * b;
}
loop()
{
}
16. In x86-64 Assembly language implement the function int addarray(int n, int * array)
that add all the elements of the array
passed as parameter. n is the length of the array.
17. In x86-64 Assembly language implement a program "maxmin" that
prompts two integer numbers fom stdin and then displays the maximum,
minimum and average of both: numbers. Here is an example of the
usage:
bash> maxmin
a=5
b=8
max=8
min=5
avg=6