CMPSCI 145 MIDTERM #2 SPRING 2017 April 7, 2017 Professor William T. Verts NAME PROBLEM SCORE POINTS GRAND TOTAL 100

Similar documents
CMPSCI 145 MIDTERM #2 Solution Key SPRING 2018 April 13, 2018 Professor William T. Verts

CMPSCI 145 MIDTERM #2 SOLUTION KEY SPRING 2015 April 3, 2015 Professor William T. Verts

CMPSCI 145 MIDTERM #2 SOLUTION KEY SPRING 2016 March 30, 2016 Professor William T. Verts

Floating Point Arithmetic

CMPSCI 145 MIDTERM #1 Solution Key. SPRING 2017 March 3, 2017 Professor William T. Verts

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two Solutions 26 February 2014

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two 26 February 2014

CSCI 402: Computer Architectures. Arithmetic for Computers (3) Fengguang Song Department of Computer & Information Science IUPUI.

Number Systems. Both numbers are positive

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers

ECE 2030B 1:00pm Computer Engineering Spring problems, 5 pages Exam Two 10 March 2010

Numeric Encodings Prof. James L. Frankel Harvard University

Floating-point Arithmetic. where you sum up the integer to the left of the decimal point and the fraction to the right.

ECE232: Hardware Organization and Design

ECE 2030D Computer Engineering Spring problems, 5 pages Exam Two 8 March 2012

15213 Recitation 2: Floating Point

COMP2611: Computer Organization. Data Representation

Floating Point Numbers. Lecture 9 CAP

Natural Numbers and Integers. Big Ideas in Numerical Methods. Overflow. Real Numbers 29/07/2011. Taking some ideas from NM course a little further

Floating Point Numbers

Number Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr

Number Systems. Decimal numbers. Binary numbers. Chapter 1 <1> 8's column. 1000's column. 2's column. 4's column

Number Systems. Binary Numbers. Appendix. Decimal notation represents numbers as powers of 10, for example

Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as:

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

Finite arithmetic and error analysis

Floating point. Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties. Next time. !

Data Representation Floating Point

Floating Point. The World is Not Just Integers. Programming languages support numbers with fraction

Floating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Lecture 3

Data Representation Floating Point

ecture 25 Floating Point Friedland and Weaver Computer Science 61C Spring 2017 March 17th, 2017

Integers and Floating Point

CS 61C: Great Ideas in Computer Architecture Performance and Floating Point Arithmetic

Chapter Three. Arithmetic

CS 61C: Great Ideas in Computer Architecture Performance and Floating-Point Arithmetic

Floating Point Arithmetic

Outline. What is Performance? Restating Performance Equation Time = Seconds. CPU Performance Factors

CS 61C: Great Ideas in Computer Architecture Performance and Floating-Point Arithmetic

Real Numbers finite subset real numbers floating point numbers Scientific Notation fixed point numbers

Floating-point representations

Floating-point representations

3 Data Storage 3.1. Foundations of Computer Science Cengage Learning

Floating Point Numbers

Floating Point Numbers

unused unused unused unused unused unused

Floating Point (with contributions from Dr. Bin Ren, William & Mary Computer Science)

EE 109 Unit 19. IEEE 754 Floating Point Representation Floating Point Arithmetic

CS61c Midterm Review (fa06) Number representation and Floating points From your friendly reader

MACHINE LEVEL REPRESENTATION OF DATA

IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1

Signed umbers. Sign/Magnitude otation

Floating Point Arithmetic

Floating Point Puzzles. Lecture 3B Floating Point. IEEE Floating Point. Fractional Binary Numbers. Topics. IEEE Standard 754

Computer Systems Programming. Practice Midterm. Name:

IEEE Standard for Floating-Point Arithmetic: 754

Integers. N = sum (b i * 2 i ) where b i = 0 or 1. This is called unsigned binary representation. i = 31. i = 0

CHW 261: Logic Design

Floating point. Today. IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Next time.

Description Hex M E V smallest value > largest denormalized negative infinity number with hex representation 3BB0 ---

Representing and Manipulating Floating Points. Jo, Heeseung

3.5 Floating Point: Overview

FLOATING POINT NUMBERS

M1 Computers and Data

CS 61C: Great Ideas in Computer Architecture Floating Point Arithmetic

Floating Point. CSE 351 Autumn Instructor: Justin Hsia

Set Theory in Computer Science. Binary Numbers. Base 10 Number. What is a Number? = Binary Number Example

Computer Systems C S Cynthia Lee

Chapter 3: Arithmetic for Computers

CS101 Lecture 04: Binary Arithmetic

Chapter 2 Float Point Arithmetic. Real Numbers in Decimal Notation. Real Numbers in Decimal Notation

Foundations of Computer Systems

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

Floating Point Puzzles The course that gives CMU its Zip! Floating Point Jan 22, IEEE Floating Point. Fractional Binary Numbers.

IEEE-754 floating-point

CS 101: Computer Programming and Utilization

Systems I. Floating Point. Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties

Representing and Manipulating Floating Points

9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation

Floating Point January 24, 2008

Digital Fundamentals

Floating Point. CSE 351 Autumn Instructor: Justin Hsia

1.2 Round-off Errors and Computer Arithmetic

UNIVERSITY OF WISCONSIN MADISON

CDA 3103 Computer Organization Exam 1 (Sep. 22th, 2014)

Under the Hood: Data Representation. Computer Science 104 Lecture 2

INTEGER REPRESENTATIONS

Number Representations

Giving credit where credit is due

MATH 353 Engineering mathematics III

Floating Point Puzzles. Lecture 3B Floating Point. IEEE Floating Point. Fractional Binary Numbers. Topics. IEEE Standard 754

1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM

Floating Point : Introduction to Computer Systems 4 th Lecture, May 25, Instructor: Brian Railing. Carnegie Mellon

Giving credit where credit is due

CO212 Lecture 10: Arithmetic & Logical Unit

NAME: 1a. (10 pts.) Describe the characteristics of numbers for which this floating-point data type is well-suited. Give an example.

System Programming CISC 360. Floating Point September 16, 2008

Binary Addition & Subtraction. Unsigned and Sign & Magnitude numbers

Floating Point Considerations

2 Computation with Floating-Point Numbers

Transcription:

CMPSCI 145 MIDTERM #2 SPRING 2017 April 7, 2017 NAME PROBLEM SCORE POINTS 1 15+5 2 25 3 20 4 10 5 18 6 12 GRAND TOTAL 100

<1> 15 Points Answer 15 of the following problems (1 point each). Answer more than 15 for extra credit. Scoring will be +1 for each correct answer (+½ for partial credit), -1 for each incorrect answer, and 0 for blank answers. Your score will be the sum, but will not go below zero. (For example 15 correct and 5 incorrect will give a total score of 10.) 137 What is the decimal value of the 8-bit unsigned binary number -9 What is the decimal value of the 8-bit sign and magnitude -118 What is the decimal value of the 8-bit one s complement signed -119 What is the decimal value of the 8-bit two s complement signed 89 What is the decimal value of the 2-digit BCD binary number 56 What is the decimal value of the 2-digit XS3 binary number 101000111 What is the binary sum of 10001001 and 10111110? (You may need more than 8 bits.) 0001 0010 0111 What is the BCD sum of 10001001 and 00111000? (You may need more than 8 bits.) Show the result in binary. Denormal In floating-point, what are numbers called where the biased exponent is equal to zero and the mantissa is non-zero? NaN/NotANumber In floating-point, what are numbers called where the biased exponent is all 1-bits and the mantissa is non-zero? Infinity In floating-point, what is the number called where the biased exponent is all 1-bits and the mantissa is zero? Kiss at 1 pt. Two spheres, each of radius 10 units, have centers 20 units Overlap Two spheres, each of radius 10 units, have centers 15 units Miss Two spheres, each of radius 10 units, have centers 25 units Interval Arithmetic Bézier Curve Ray Tracing Sorted Sequential Hierarchical What approach keeps two numbers for each computation, one of which rounds results down and the other rounds results up? What type of cubic curve is tangent at each endpoint to the curve through that endpoint and its corresponding control point? What technique allows us to generate synthetic scenes by passing a line from the eye through each pixel into a 3D model? How must a list of items be configured so that a binary search on that list is possible? One of two traditional methods for accessing a database is called random access. What is the other method? What is the third method of database access, as used in image pyramids? Page 1

<2> 25 Points We are going to invent a new floating-point format, called peculiarprecision which is exactly twelve bits in length. There is a sign bit, five bits for the biased exponent, and six bits for the mantissa, and all coding rules are the same as single, double, half, and quarter precision. A. (4 Points) What is the value of the bias for this format? 2 5-1 -1 = 15 B. (15 Points) Fill in all the boxes below with 0 and 1 bits to form the indicated values: Positive Quiet NaN Negative Infinity Largest Normalized Positive Value Smallest Normalized Positive Value -6.75 C. (6 Points) What are the binary scientific, true binary, and decimal values of the following peculiar-precision number? 1.001101 2 5 100110.1 38.5 Binary Scientific (3 points) True Binary (2 points) Decimal (2 points) Page 2

<3> 20 Points What are the decimal values of the following 16-bit binary number under each of the listed representations? If the value is illegal under the representation, say so. 0000000111100000 01E0 480 1.875 or 1 7 8 1 224 Hexadecimal Unsigned Binary Integer Unsigned Fixed Point, 8 whole and 8 fraction Unsigned Rational, 8 numerator and 8 denominator <4> 10 Points Below are a set of replacement rules that you can apply symbolically to an arithmetic expression. DO NOT ADD ANY NEW RULES TO THIS LIST: #1. Replace X 1 with X (for any X) #2. Replace 1 X with X (for any X) #3. Replace X 0 with 0 (for any X) #4. Replace 0 X with 0 (for any X) #5. Replace X + 0 with X (for any X) #6. Replace 0 + X with X (for any X) #7. Replace X - 0 with X (for any X) #8. Replace X - X with 0 (for any X, both X must be the same) For the following expression, show each step in a symbolic optimization and indicate in each case which rule applies (the first one has been done for you as an example). Take as many steps as necessary to reduce the expression as far as it can be reduced. Step 0: A + (B (C (C 1 0))) + (D D) Step 1: A + (B (C (C 0))) + (D D) Rule #1 Step 2: A + (B (C C)) + (D D) Rule #7 Step 3: A + (B 0) + (D D) Rule #8 Step 4: A + 0 + (D D) Rule #3 Step 5: A + (D D) Rule #5 Step 6: A + 0 Rule #8 Step 7: A Rule #5 Page 3

<5> 18 Points There are two 3D points <4,-3,6> and <9,5,-2>. What are the parametric equations in x, y, and z for the straight line that passes through the first point when t=0 and through the second point when t=1? A. (12 Points): x(t) = 5 t + 4_ y(t) = 8 t + -3_ z(t) = -8 t + 6_ B. (6 Points): What are the coordinates of the 3D point when t=½? <6.5, 1, 2> <6> 12 Points Searching lists. (9 Points) Here is a list of names, in unsorted order. Show the list after each search, using the move-to-front self-organizing list technique (the front of the list is at the left): Tom Fred Carol Sam John Mary Bob A. After searching for John: John Tom Fred Carol Sam Mary Bob B. After searching for Bob: Bob John Tom Fred Carol Sam Mary C. After search for John again: John Bob Tom Fred Carol Sam Mary (3 Points) Suppose I write a function f so that applying f to each name gives its index (position) in the list, such as: f(fred) = 3, f(carol) = 7, f(bob) = 4, etc. D. What is function f called? A Hash Function E. What is it called if two names generate the same index? A Hash Collision F. Using Big-O notation (O(1), O(log2(N)), O(N 2 ), etc.) how fast are most searches using this technique? O(1) Page 4