{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Computer Science 61CL - Fall 2000 - Patterson - Midterm 1

# Computer Science 61CL - Fall 2000 - Patterson - Midterm 1 -...

This preview shows pages 1–4. Sign up to view the full content.

CS61C, Midterm 1, Fall 2000 CS61C, Fall 2000 Midterm 1 Professor D. Patterson Question #0: Sign-in Question (-1 point if not followed): Fill out the front page correctly and write your login at the top of each of the pages. Circle your login initials so we can read them. Question #1: I am a computer (Parts of a Computer) (3 points) (a) Name the five components of a computer: (b) Consider your body, and how it is like a computer system. For each component you listed to the left, give one example of a body part that corresponds to that component. You may not use the same body part more than twice. 1. 1. 2. 2. 3. 3. 4. 4. 5. 1. Question #2: Minding your p's and q's (Pointers) (5 points) Below is a segment of C code: char *p, *q, x = 'a', y = 'b'; p = &x; q = &y; *q = *p++; q = p; To answer the following questions, you may use any \$t register. Assume the address of x is 1000, address of y is 1004, p is associated with register \$s0, q with \$s1 . Please keep your code brief. i. [1 point] What is the MAL code for p = &x ; ii. [1 point] What is the MAL code for q = &y ; file:///C|/Documents%20and%20Settings/Jason%20Rafte...20Fall%202000%20-%20Patterson%20-%20Midterm%201.htm (1 of 9)1/27/2007 6:35:28 PM

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CS61C, Midterm 1, Fall 2000 iii. [1 point] What is the MAL code for *q = *p++ ; iv. [1 point] What is the MAL code for q = p ; v. [1 point] What is the value of q at then end of this section of code? Question #3: My numbers are changing! (Pilable Data) (5 points) A = 0x20C89000 (a) [1 point] Give the binary equivalent of A: _______________________________________________________________________ For the following 3 questions (b, c, d) you may leave parts of your answers as signed sums of powers of two [e.g. -(2^2+...2^19)]. Do not leave any part of your answers in hex. No hex! (b) [1 point] Give the decimal equivalent of A if A is interpreted as an integer in 2's-complement notation: _______________________________________________________________________ (c) [1 point] Give the decimal equivalent of A if A is interpreted as a single-precision IEEE 754 floating point number: _______________________________________________________________________ (d) [2 points] Give the MAL instruction equivalent of A if A is interpreted as an instruction in machine language format: _______________________________________________________________________ Remember, no hex! Question #4: Can a C integer float? (Floating Point) (2 points) (a) Can all int in C (for the MIPS Instruction Set) be converted to a single precision floating point number and back to integer without changing the value of the integer? Why or why not? (b) Can an int in C (for the MIPS Instruction Set) be converted to a double precision floating point file:///C|/Documents%20and%20Settings/Jason%20Rafte...20Fall%202000%20-%20Patterson%20-%20Midterm%201.htm (2 of 9)1/27/2007 6:35:28 PM
CS61C, Midterm 1, Fall 2000 number and back to integer without changing the value of the integer? Why or why not? Question #5: Is the Internet really this fast? (Networks) (10 points) You are writing a program to send an array X from machine A to machine B over a network. Let us assume that ints are 32 bits and chars are 8 bits, and the operating system on computer A implements a function void send(char *machineName, char *sendbuf, int nbytes);

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 9

Computer Science 61CL - Fall 2000 - Patterson - Midterm 1 -...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online