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

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

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

Data Representation and Binary Arithmetic. Lecture 2

Fundamentals of Programming (C)

Chapter 2 Bits, Data Types, and Operations

UNIVERSITY OF WISCONSIN MADISON

Chapter 2 Bits, Data Types, and Operations

Chapter 2 Number System

Number Representations

Chapter 2 Bits, Data Types, and Operations

CPS 104 Computer Organization and Programming Lecture-2 : Data representations,

Numbers and Computers. Debdeep Mukhopadhyay Assistant Professor Dept of Computer Sc and Engg IIT Madras

Chapter 2 Bits, Data Types, and Operations

Fundamentals of Programming

Bits and Bytes. Data Representation. A binary digit or bit has a value of either 0 or 1; these are the values we can store in hardware devices.

ASSIGNMENT 5 TIPS AND TRICKS

Chapter 3. Information Representation

1.1. INTRODUCTION 1.2. NUMBER SYSTEMS

DATA REPRESENTATION. Data Types. Complements. Fixed Point Representations. Floating Point Representations. Other Binary Codes. Error Detection Codes

Chapter 2 Bits, Data Types, and Operations

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

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

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

EE 109 Unit 3. Analog vs. Digital. Analog vs. Digital. Binary Representation Systems ANALOG VS. DIGITAL

Number System (Different Ways To Say How Many) Fall 2016

Number Systems Base r

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

EE 109 Unit 2. Analog vs. Digital. Analog vs. Digital. Binary Representation Systems ANALOG VS. DIGITAL

Number Systems for Computers. Outline of Introduction. Binary, Octal and Hexadecimal numbers. Issues for Binary Representation of Numbers

Unit 3. Analog vs. Digital. Analog vs. Digital ANALOG VS. DIGITAL. Binary Representation

Do not start the test until instructed to do so!

Unit 3, Lesson 2 Data Types, Arithmetic,Variables, Input, Constants, & Library Functions. Mr. Dave Clausen La Cañada High School

plc numbers Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

The Binary Number System

Oberon Data Types. Matteo Corti. December 5, 2001

Chapter 8. Characters and Strings

Lecture (09) x86 programming 8

2a. Codes and number systems (continued) How to get the binary representation of an integer: special case of application of the inverse Horner scheme

CS341 *** TURN OFF ALL CELLPHONES *** Practice NAME

3.1. Unit 3. Binary Representation

Data Representa5on. CSC 2400: Computer Systems. What kinds of data do we need to represent?

PureScan - ML1. Configuration Guide. Wireless Linear Imager Wireless Laser scanner - 1 -

Data Representa5on. CSC 2400: Computer Systems. What kinds of data do we need to represent?

Binary Numbers. The Basics. Base 10 Number. What is a Number? = Binary Number Example. Binary Number Example

CSE-1520R Test #1. The exam is closed book, closed notes, and no aids such as calculators, cellphones, etc.

CSE-1520R Test #1. The exam is closed book, closed notes, and no aids such as calculators, cellphones, etc.

Positional Number System

Introduction to Decision Structures. Boolean & If Statements. Different Types of Decisions. Boolean Logic. Relational Operators

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 02, FALL 2012

Do not start the test until instructed to do so!

CMSC 313 Lecture 03 Multiple-byte data big-endian vs little-endian sign extension Multiplication and division Floating point formats Character Codes

Fundamental Data Types

Exercises Software Development I. 03 Data Representation. Data types, range of values, internal format, literals. October 22nd, 2014

Do not start the test until instructed to do so!

EE 109 Unit 2. Binary Representation Systems

Number Systems II MA1S1. Tristan McLoughlin. November 30, 2013

Experiment 3. TITLE Optional: Write here the Title of your program.model SMALL This directive defines the memory model used in the program.

EXPERIMENT 8: Introduction to Universal Serial Asynchronous Receive Transmit (USART)

Table of Contents Sleep Settings How to Configure the Scanner. 7 Chapter 2 System Setup

5/17/2009. Digitizing Discrete Information. Ordering Symbols. Analog vs. Digital

FD-011WU. 2D Barcode Reader User Guide V1.6CC

Chemistry Hour Exam 2

EXPERIMENT 7: Introduction to Universal Serial Asynchronous Receive Transmit (USART)

Simple Data Types in C. Alan L. Cox

User s Manual. Xi3000 Scanner. Table of Contents

CSE 30 Spring 2006 Final Exam

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 02, FALL 2012

Source coding and compression

4/14/2015. Architecture of the World Wide Web. During this session we will discuss: Structure of the World Wide Web

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 02, SPRING 2013

Variables and data types

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

Chapter 1. Hardware. Introduction to Computers and Programming. Chapter 1.2

Xi2000-BT Series Configuration Guide

Configuration Manual PULSAR C CCD SCANNER. Table of Contents

CSE 30 Spring 2007 Final Exam

8.2 User Defined Protocol Communication

UNIT 2 NUMBER SYSTEM AND PROGRAMMING LANGUAGES

Hardware. ( Not so hard really )

CSE 30 Fall 2007 Final Exam

n NOPn Unary no operation trap U aaa NOP Nonunary no operation trap i

This is great when speed is important and relatively few words are necessary, but Max would be a terrible language for writing a text editor.

MK D Imager Barcode Scanner Configuration Guide

marson MT8200S 2D Handheld Scanner User Manual V / 6 / 25 - I -

RS-232 Control of the Advantage EQ281/8, EQ282/8 and Advantage SMS200

CPSC 301: Computing in the Life Sciences Lecture Notes 16: Data Representation

CSE 30 Winter 2009 Final Exam

RS-422 Code-Operated Switches

CSE 30 Fall 2006 Final Exam

S-Series Sensor ASCII Protocol v8.1.0

Connecting UniOP to Datalogic Barcode Readers

CSC 8400: Computer Systems. Represen3ng and Manipula3ng Informa3on. Background: Number Systems

CSE 30 Fall 2012 Final Exam

Introduction to Computer Engineering. CS/ECE 252, Spring 2017 Rahul Nayar Computer Sciences Department University of Wisconsin Madison

CSE 30 Fall 2013 Final Exam

Midterm Exam, Fall 2015 Date: October 29th, 2015

CSE 30 Winter 2014 Final Exam

Midterm CSE 131 Winter 2012

RS-232 Digital Relay I/O

Review. Single Pixel Filters. Spatial Filters. Image Processing Applications. Thresholding Posterize Histogram Equalization Negative Sepia Grayscale

Transcription:

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON Prof. Gurindar Sohi TAs: Junaid Khalid and Pradip Vallathol Midterm Examination 1 In Class (50 minutes) Friday, September 28, 2012 Weight: 17.5% NO: BOOK(S), NOTE(S), OR CALCULATORS OF ANY SORT. The exam has nine pages. Circle your final answers. Plan your time carefully since some problems are longer than others. You must turn in the pages 1-7. LAST NAME: FIRST NAME: ID# - 1 -

Problem Maximum Points Points Earned 1 1 2 2 3 4 4 3 5 2 6 2 7 3 8 2 9 3 10 1 11 2 12 1 13 4 Total 30-2 -

Problem 1: A picture is represented by a collection of pixels. Consider a picture format in which each pixel can be only one of 7 different shades. What is the minimum number of bits I would need to store a picture which contains 1024 pixels? (1 Point) Minimum number of bits to represent 7 shades = 3 bits So for 1024 pixels, number of bits = 1024 x 3 = 3072 bits Problem 2: Consider a number 32 in an octal number system (base 8). What would be its representation in decimal? (2 Points) (32) 8 = 3 x 8 1 + 2 x 8 0 = 24 + 2 = (26) 10 Problem 3: Let A = 5 ⅝ and B = 3 ¾. Convert them into their fixed point binary fraction form (use 8 bits, with 5 bits for the integer part and 3 bits for the fraction part) and then perform the following operation: A - B. Show your result both as a fixed point binary fraction and as a decimal fraction. (4 Points) A = 0101.101 B = 0011.110 -B = 1100.010 A B = A + (-B) = 0001.111 = 1.875-3 -

Problem 4: Show the result of performing the following logic operations on X = 0xC8 and Y = 0x0B: (Express your answer in hexadecimal) (NOT Y) AND (X OR Y) (3 Points) X = 11001000 Y = 00001011 (NOT Y) AND (X OR Y) = 11110100 AND 11001011 = 11000000 = 0xC0 Problem 5: Consider a 16 bit binary number represented as 1011010010110100, with the right-most bit being bit 0, and the left-most bit being bit 15. I am interested in carrying out a bit-wise logical operation to extract the bits in the following bit positions: 1, 5, 7, 11 and 12. What mask should I use to get those interesting bits? Which logical operation would I use? (2 Points) Mask = 0001100010100010 Logical operation to use is AND. Problem 6: Convert the following binary code into an ASCII string (see attached ASCII table): 01100101 01000001 01110011 01011001 (2 Points) = 0x 65 41 73 59 = e A s Y - 4 -

Problem 7: Convert the two ASCII strings we and Us into 16-bit binary strings (without the quotes; use 8 bits per character of the ASCII string). Now suppose that the resulting binary bits were 16-bit unsigned binary numbers, add these two binary strings. Show the result in binary. (See attached ASCII table (3 Points) we = 0x7745 = 0111011101000101 Us = 0x5573 = 0101010101110011 Sum = 1100110010111000 Problem 8: What is the decimal equivalent of the following 32-bit IEEE floating point number: 01000001001100000000000000000000 (2 Points) 0 10000010 01100000000000000000000 = (-1) 0 x 1.375 x 2 (130-127) = 11 Problem 9: Add the following two 6-bit 2 s complement binary numbers: 101110 + 101001 Is there an overflow? Explain why or why not. If there is an overflow, what could I do to mitigate this problem? (3 Points) Result = 1 010111 There is overflow, since we get a positive number on adding two negative numbers (or since there is a carry-out of the MSB and no carry-in to the MSB). The problem can be mitigated by using more number of bits in the representation of the numbers. - 5 -

Problem 10: Which of the following are specified by an ISA (1 Point) (i) (ii) (iii) Data Type Addressing Microarchitecture a) ii & iii b) i & ii c) i & iii d) i, ii & iii Problem 11: Put the following items/terms in order according to their level of abstraction relative to one another, label the most abstract 1 and least abstract 5. (2 Points) 2 Algorithm to solve problem 1 Application 4 ISA 3 Code in High level language 5 Micro Architecture Problem 12: How many microarchitectures could exist for a single ISA? (1 Point) a) None b) 1 c) 2 d) There is no limit - 6 -

Problem 13: Say we have a "black box" which takes two numbers as input and outputs their sum (see Figure 1(a)). Say we have another box capable of multiplying two numbers together (see Figure 1(b)). We can connect these boxes together to calculate p (m + n) (see Figure 1(c)). Assume we have an unlimited number of these boxes. Show how to connect them together to calculate: (4 Points) Figure 1 a) a 2 + 2ab + b 2 (Try to do this with a minimum number of boxes) b) b 4-7 -

ASCII Table Character Hex Character Hex Character Hex Character Hex nul 00 sp 20 @ 40 ` 60 soh 01! 21 A 41 a 61 stx 02 22 B 42 b 62 etx 03 # 23 C 43 c 63 eot 04 $ 24 D 44 d 64 enq 05 % 25 E 45 e 65 ack 06 & 26 F 46 f 66 bel 07 (Apostr.) 27 G 47 g 67 bs 08 ( 28 H 48 h 68 ht 09 ) 29 I 49 i 69 lf 0A * 2A J 4A j 6A vt 0B + 2B K 4B k 6B ff 0C, (Comma) 2C L 4C l 6C cr 0D - 2D M 4D m 6D so 0E. (Period) 2E N 4E n 6E si 0F / 2F O 4F o 6F dle 10 0 30 P 50 p 70 dc1 11 1 31 Q 51 q 71 dc2 12 2 32 R 52 r 72 dc3 13 3 33 S 53 s 73 dc4 14 4 34 T 54 t 74 nak 15 5 35 U 55 u 75 syn 16 6 36 V 56 v 76 etb 17 7 37 W 57 w 77 can 18 8 38 X 58 x 78 em 19 9 39 Y 59 y 79 sub 1A : 3A Z 5A z 7A esc 1B ; 3B [ 5B { 7B fs 1C < 3C \ 5C 7C gs 1D = 3D ] 5D } 7D rs 1E > 3E ^ 5E ~ 7E us 1F? 3F _ (Undrscre) 5F del 7F - 8 -

Extra page for hand written work, if needed. This page is not required and will NOT affect your grade. You don t even need to hand this page in. - 9 -