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

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

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

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

Floating Point Arithmetic

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

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

Numeric Encodings Prof. James L. Frankel Harvard University

Finite arithmetic and error analysis

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

Number Systems. Both numbers are positive

ECE232: Hardware Organization and Design

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

Floating-point representations

Floating-point representations

15213 Recitation 2: Floating Point

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

COMP2611: Computer Organization. Data Representation

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

Floating Point Numbers

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

Floating Point Numbers. Lecture 9 CAP

Computer Arithmetic Floating Point

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

The Perils of Floating Point

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

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

Floating Point Numbers

Floating Point Numbers

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

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

Foundations of Computer Systems

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

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

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

Module 2: Computer Arithmetic

Integers and Floating Point

3 Data Storage 3.1. Foundations of Computer Science Cengage Learning

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

Data Representation Floating Point

Introduction to Computer Systems Recitation 2 May 29, Marjorie Carlson Aditya Gupta Shailin Desai

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

unused unused unused unused unused unused

Floating Point Arithmetic

Data Representation Floating Point

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

MACHINE LEVEL REPRESENTATION OF DATA

3.5 Floating Point: Overview

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

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

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

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

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

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

CS 6210 Fall 2016 Bei Wang. Lecture 4 Floating Point Systems Continued

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

Floating Point. CSE 351 Autumn Instructor: Justin Hsia

Course Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation

Data Representation 1

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

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

Floating-Point Arithmetic

IEEE Standard for Floating-Point Arithmetic: 754

MIPS Integer ALU Requirements

CO212 Lecture 10: Arithmetic & Logical Unit

Divide: Paper & Pencil

CS101 Lecture 04: Binary Arithmetic

FLOATING POINT NUMBERS

Module 12 Floating-Point Considerations

Signed umbers. Sign/Magnitude otation

Floating Point Representation in Computers

Floating Point January 24, 2008


Chapter Three. Arithmetic

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

Floating Point Arithmetic

Floating Point. CSE 351 Autumn Instructor: Justin Hsia

1.2 Round-off Errors and Computer Arithmetic

CHW 261: Logic Design

Floating Point. CSE 351 Autumn Instructor: Justin Hsia

Floating Point Representation. CS Summer 2008 Jonathan Kaldor

VTU NOTES QUESTION PAPERS NEWS RESULTS FORUMS Arithmetic (a) The four possible cases Carry (b) Truth table x y

MATH 353 Engineering mathematics III

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

Floating-Point Numbers in Digital Computers

Floating Point Numbers

Module 12 Floating-Point Considerations

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

2 Computation with Floating-Point Numbers

Chapter 2. Data Representation in Computer Systems

Operations On Data CHAPTER 4. (Solutions to Odd-Numbered Problems) Review Questions

Digital Fundamentals

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

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

CS429: Computer Organization and Architecture

Floating Point Considerations

Exponential Numbers ID1050 Quantitative & Qualitative Reasoning

Giving credit where credit is due

Representing and Manipulating Floating Points. Jo, Heeseung

Transcription:

CMPSCI 145 MIDTERM #2 Solution Key SPRING 2018 April 13, 2018

<1> 10 Points Answer 10 of the following problems (1 point each). Answer more than 10 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: 10 correct and 5 incorrect will give a total score of 5.) 131-3 -124-125 83 50 11000001 0001 0010 0001 Interval Arithmetic Bézier Curve Ray Tracing Sorted Sequential Access Hierarchical Access C What is the decimal value of the 8-bit unsigned binary number 10000011? What is the decimal value of the 8-bit sign and magnitude binary number 10000011? What is the decimal value of the 8-bit one s complement signed binary number 10000011? What is the decimal value of the 8-bit two s complement signed binary number 10000011? What is the decimal value of the 2-digit BCD binary number 10000011? What is the decimal value of the 2-digit XS3 binary number 10000011? What is the binary sum of 10000011 and 00111110? What is the BCD sum of 10000011 and 00111000? (You may need more than 8 bits.) Show the result in binary. 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? Show how to symbolically reduce the following expression: (C + (B ((D/D) * B) + (A * (E E)))) Page 1

<2> 25 Points We are going to invent a new floating-point format, called Strange- Precision which is exactly fourteen bits in length. There is a sign bit, six bits for the biased exponent, and seven bits for the mantissa, and all coding rules are the same as single, double, half, and quarter precision. A. (1 Point) What is the value of the bias for this format? 2 6-1 -1 = 2 5-1 = 31 B. (24 Points 3 Points each 1 point for every 5 bit errors) Fill in all the boxes below with 0 and 1 bits to form the indicated values. Leave no box blank. Positive Infinity Quiet NaN (X can be either 0 or 1 or X) Largest Positive Normalized Number -1.0 Smallest Positive Normalized Number Largest Positive DeNormal Smallest Positive Non-Zero DeNormal Zero Page 2

<3> 20 Points Convert the number 13.1 into Strange Precision. A. (3 Points) What is 13 in binary? 1101 B. (4 Points) What is 0.1 in binary (10 bits to the right of the decimal point)? 0.0001100110011001100110011-1 for fewer than 10 fraction bits. C. (2 Points) What is the True Binary of 13.1 (10 bits to the right of the decimal)? 1101.0001100110011001100110011-1 for fewer than 10 fraction bits. D. (4 Points) What is the Binary Scientific form of the answer in Part C? 1.1010001100110011001100110011 2 3-1 for fewer than 10 fraction bits. E. (2 Points) What is the Decimal Value of the Biased Exponent? 31 + 3 = 34 F. (5 Points) Fill in the Strange Precision number below with the correct bits. If you need to round the fraction to fit, use Round to Nearest, Round Half Away from Zero rounding. 1 point for sign bit, 2 points for exponent, 2 points for mantissa. Note that the number in binary is 0-100010-1010001 when the fraction is truncated (round towards zero), but because the first discarded bit is a 1 we round up the last bit, which carries into the next to the last bit. Subtract 1 point for truncating instead of rounding. Page 3

<4> 25 Points There are two 3D points <-3,2,0> and <6,4,9>. 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 2 Points each): x(t) = 9 t + -3 y(t) = 2 t + 2 z(t) = 9 t + 0 B. (3 Points 1 point each): What are the coordinates of the 3D point when t = +½? < 1½, 3, 4½ > C. (4 Points 1 point each, 1 free point for any answer): What are the coordinates of the 3D point when t = -½? < -7½, 1, -4½ > D. (6 Points 1 Point each): Set up a LaGrange equation for a straight line to go through two points P0 and P1, where the line hits P0 when t = -1 and hits P1 when t = +2. Page 4

<5> 20 Points Searching lists. Here is a list of names, in unsorted order. Show the list after each search, using the Promote-One-Slot self-organizing linear list technique (the front of the list is at the left): Tom Fred Carol John Sam Mary Bob A. (2 Points) After searching for Carol: B. (2 Points) After searching for John: C. (2 Points) After searching for Carol again: Tom Carol Fred John Sam Mary Bob Tom Carol John Fred Sam Mary Bob Carol Tom John Fred Sam Mary Bob D. (2 Points) What is the worst-case search time for this list using linear search? (That is, what is the maximum number of comparisons that must be made to find an item in this particular list, or determine that the item is not present?) O(N) = 7 comparisons E. (3 Points) If the list were sorted, what is the worst-case search time for a binary search for this list? (That is, what is the maximum number of comparisons that must be made to find an item in this particular list, or determine that the item is not present?) O(log2(N)) = 3 comparisons F. (2 Points) What is the worst-case search time for a hash function that uses a list of these names? O(1) = 1 comparison G. (2 Points) What is it called if two names hash to the same index? Collision H. (5 Points) Short answer: Explain how the American Soundex code is a hash function. American Soundex reduces a surname to a code that represents a particular file folder in which to place the documentation for that person (unlike most hashing techniques, Soundex expects collisions so that related people go to the same folder). (Accept anything reasonable.) Page 5