CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

Similar documents
UNIVERSITY OF WISCONSIN MADISON

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON. Instructor: Rahul Nayar TAs: Annie Lin, Mohit Verma

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

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

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

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

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

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

Basic Definition INTEGER DATA. Unsigned Binary and Binary-Coded Decimal. BCD: Binary-Coded Decimal

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

Number System. Introduction. Decimal Numbers

UNIT 7A Data Representation: Numbers and Text. Digital Data

Time (self-scheduled): Location Schedule Your Exam: What to bring:

Chapter 3: Arithmetic for Computers

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

Advanced Computer Architecture-CS501

Chapter 1. Digital Systems and Binary Numbers

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

CSC201, SECTION 002, Fall 2000: Homework Assignment #2

Decimal & Binary Representation Systems. Decimal & Binary Representation Systems

Introduction to Computers and Programming. Numeric Values

Chapter 10 Binary Arithmetics

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

Chapter 2 Bits, Data Types, and Operations

Department of Electrical and Computer Engineering The University of Texas at Austin

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

COMP Overview of Tutorial #2

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON. Instructor: Rahul Nayar TAs: Annie Lin, Mohit Verma

A complement number system is used to represent positive and negative integers. A complement number system is based on a fixed length representation

Chapter 4. Operations on Data

N.B. These pastpapers may rely on the knowledge gained from the previous chapters.

Chapter 2 Bits, Data Types, and Operations

Chapter 2 Bits, Data Types, and Operations

COMP2611: Computer Organization. Data Representation

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

DRAM uses a single capacitor to store and a transistor to select. SRAM typically uses 6 transistors.

Signed umbers. Sign/Magnitude otation

UNIVERSITY OF WISCONSIN MADISON

Number Systems. Both numbers are positive

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

CS101 Lecture 04: Binary Arithmetic

unused unused unused unused unused unused

Signed Binary Numbers

Time: 8:30-10:00 pm (Arrive at 8:15 pm) Location What to bring:

Numeric Encodings Prof. James L. Frankel Harvard University

Final Exam Solution Sunday, December 15, 10:05-12:05 PM

Chapter 2 Bits, Data Types, and Operations

Floating Point Arithmetic

Positional notation Ch Conversions between Decimal and Binary. /continued. Binary to Decimal

10.1. Unit 10. Signed Representation Systems Binary Arithmetic

The type of all data used in a C (or C++) program must be specified

Representation of Information

Data Representation. DRAM uses a single capacitor to store and a transistor to select. SRAM typically uses 6 transistors.

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

SIGNED AND UNSIGNED SYSTEMS

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

Principles of Computer Architecture. Chapter 3: Arithmetic

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

CDS130 Mid-term exam: Sample

Inf2C - Computer Systems Lecture 2 Data Representation

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

Binary Addition. Add the binary numbers and and show the equivalent decimal addition.

The type of all data used in a C++ program must be specified

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

IBM 370 Basic Data Types

Introduction to Computer Science-103. Midterm

Introduction to Computer Science. Homework 1

Digital Arithmetic. Digital Arithmetic: Operations and Circuits Dr. Farahmand

Computer Organization and Architecture (CSCI-365) Sample Final Exam

ECE 250 / CS 250 Computer Architecture. C to Binary: Memory & Data Representations. Benjamin Lee

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

CHW 261: Logic Design

Objectives. Connecting with Computer Science 2

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

CS 101: Computer Programming and Utilization

Chapter Three. Arithmetic

Name: CMSC 313 Fall 2001 Computer Organization & Assembly Language Programming Exam 1. Question Points I. /34 II. /30 III.

Computer (Literacy) Skills. Number representations and memory. Lubomír Bulej KDSS MFF UK

Groups of two-state devices are used to represent data in a computer. In general, we say the states are either: high/low, on/off, 1/0,...

World Inside a Computer is Binary

THE LOGIC OF COMPOUND STATEMENTS

MACHINE LEVEL REPRESENTATION OF DATA

Data Representation in Computer Memory

Programming Studio #1 ECE 190

15110 PRINCIPLES OF COMPUTING SAMPLE EXAM 2

Fundamentals of Programming Session 2

The LC3's micro-coded controller ("useq") is nothing more than a finite-state machine (FSM). It has these inputs:

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


CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

Data Representation COE 301. Computer Organization Prof. Muhamed Mudawar

MC1601 Computer Organization

CS 31: Introduction to Computer Systems. 03: Binary Arithmetic January 29

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

M1 Computers and Data

Computer Sc. & IT. Digital Logic. Computer Sciencee & Information Technology. 20 Rank under AIR 100. Postal Correspondence

Portland State University. CS201 Section 5. Midterm Exam. Fall 2018

As stated earlier, the declaration

Transcription:

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON Prof. Gurindar Sohi, Kai Zhao TAs: Annie Lin, Mohit Verma, Neha Mittal, Daniel Griffin, Yuzhe Ma Examination 1 In Class (50 minutes) Monday, September 28, 2016 Weight: 17.5% NO: BOOK(S), NOTE(S), CALCULATORS OR ELECTRONIC DEVICES OF ANY SORT. The exam has nine pages. You must turn in the pages 1-8. Circle your final answers. Plan your time carefully since some problems are longer than others. Use the blank sides of the exam for scratch work. LAST NAME: FIRST NAME: Section: ID#: 1

Problem Maximum Points Points Earned 1 1 2 3 3 2 4 2 5 4 6 4 7 6 8 4 9 4 10 3 Total 33 2

Problem 1 (1 point) Which of the following statements are true? i) In logic circuits, there is only one way to implement any particular function (e.g. addition). ii) There can be many different microarchitectures implementing a single type of ISA. iii) The translation from the unique assembly language of a computer to its ISA is done by an assembler. Select one answer below: a) i & ii b) i & iii c) ii & iii d) i, ii & iii Problem 2 (3 points) Match the following computer abstraction layers with their definitions specified in the table. a) ISA b) Program c) Algorithm d) Microarchitecture e) Devices C A E B D A step by step procedure that is guaranteed to terminate, such that each step is precisely stated and can be carried out by the computer The complete specification of the interface between programs that have been written and the underlying computer hardware that must carry out the work of those programs. Specific hardware technology used to implement logical components of the computer system. (Ex. CMOS/NMOS transistors) A mechanical language that is used to specify a sequence of instructions to a computer. A detailed organization of the implementation of an ISA. 3

Problem 3 (2 points) (a) What is the difference between high level and low level languages? High level languages are easier to comprehend and are machine independent. (b) Why are natural languages unsuitable for programming on a computer? They are ambiguous and thus a computer cannot interpret them. Problem 4 (2 points) A class has 185 students enrolled in it. Each student is to be assigned a unique ID number (in unsigned binary notation). (a) What is the minimum number of bits needed to assign each student a unique binary ID number? 2^7 = 128 2^8 = 256 where 128 < 185 < 256 hence min 8 bits (b) If we were to increase the number of bits by 1, how many more students can be accommodated in the class and still be assigned a unique binary ID number? Number of students that can be accommodated in 9 bits = 2^9 = 512 Number of students that can be accommodated additionally = 327 4

Problem 5 (4 points) (a) Using 8 bits for each number, write the 1 s complement, 2 s complement, and signed magnitude binary number of the decimal numbers in the table below: Decimal 1 s Complement 2 s Complement Signed Magnitude 19 00010011 00010011 00010011-10 11110101 11110110 10001010 (b) Why do computers more often use 2's complement notation over 1's complement notation? It s easier for arithmetic circuits to calculate. 2 s complement has one representation for zero whereas 1 s complement has only 1 Problem 6 (4 Points) Convert the following 32-bit single-precision IEEE floating point number into decimal value, show your work for full credit: 11000001001001100000000000000000 The bits for the IEEE single-precision floating point number (N) are allocated as follows: Sign (1 bit) Exponent (8 bits) Fraction (23 bits) Where the value N = (-1) Sign x 1.Fraction x 2 Exponent-127-10.375 5

Problem 7 (6 points) Perform binary arithmetic for the following numbers as directed. All the numbers are represented in 2 s complement form. (a) Add the following 2 s complement numbers. Write the final result as a 6-bit number. 010110 + 1001 001111 Did an overflow error occur in the previous addition? State how you know. No overflow because overflow cannot occur when adding a positive number with a negative number (b) Subtract the following 2 s complement numbers. Write the final result as a 6-bit number. 010011-010010 000001 Did an overflow error occur in the previous operation? State how you know. No overflow because overflow cannot occur when subtracting a negative number from a negative number (c) Convert the answers for (a) and (b) into decimal numbers. Show your work for full credit. 001111=8+4+2+1=15 000001=1 6

Problem 8 (4 points) (a) Convert the following 3 hexadecimal numbers to unsigned binary. A 0x before a set of symbols (from 0 to F) indicates a hexadecimal number. 0x24 = 0010 0100 0xAA = 1010 1010 0xD7 = 1101 0111 (b) Perform the specified logical operations on the following hexadecimal numbers. Write your result in unsigned binary. (Hint: first convert the hexadecimal to binary, which you did in part (a), and then perform the operations) NOT(0x24 OR (0xAA AND 0xD7)) 0101 1001 (c) Convert the result of part (b) into hexadecimal. 0x59 7

Problem 9 (4 points) The ASCII table on the last page will be useful in solving this problem. You can detach it to make it easier to consult without flipping pages. Consider two strings of two ASCII characters each: 64 and %@. The ASCII characters in the string are the two characters between the quotation marks, and there is no null character terminating the string. (a) First, convert each of these two strings into their corresponding 16-bit binary values. 64 = 3634 = 0011 0110 0011 0100 %@ = 2540 = 0010 0101 0100 0000 (b) Now, suppose that the two 16-bit binary values were added as if they were signed integers in 2 s complement, and the resulting 16 bits treated as they were a string of ASCII characters. What would the resulting ASCII string be? Show your work for full credit. Sum = 0101 1011 0111 0100 =5B74 ASCII string = [t Problem 10 (3 points) Give an example of an integer that can be represented in floating point format (32-bit IEEE format), but cannot be represented as a 32-bit 2 s complement integer. Show its 32-bit IEEE format representation. The biggest 2 s complement integer that can be represented with 32 bits is 2^31-1, so any integer number greater than 2^31-1, but less than 2^128, is the answer to this question. so 2^31, 2^31 +1, 2^31 +2 and 2^32 are some examples. Then convert it to IEEE. 8

9