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

Chapter 2 Bits, Data Types, and Operations

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

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.

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

Chapter 3. Information Representation

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

ASSIGNMENT 5 TIPS AND TRICKS

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

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

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

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

Number Systems Base r

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

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

3.1. Unit 3. Binary Representation

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

Do not start the test until instructed to do so!

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

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

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

Positional Number System

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.

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

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

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

EE 109 Unit 2. Binary Representation Systems

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

Do not start the test until instructed to do so!

Fundamental Data Types

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

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)

User s Manual. Xi3000 Scanner. Table of Contents

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

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

Simple Data Types in C. Alan L. Cox

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

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

CSE 30 Spring 2006 Final Exam

Variables and data types

Source coding and compression

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

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

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

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

RS-422 Code-Operated Switches

S-Series Sensor ASCII Protocol v8.1.0

Connecting UniOP to Datalogic Barcode Readers

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

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

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

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

CSE 30 Fall 2006 Final Exam

CSE 30 Winter 2009 Final Exam

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

Question Points Score Total: 100

CSE 30 Fall 2012 Final Exam

Transcription:

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON Prof. Gurindar Sohi TAs: Pradip Vallathol and Junaid Khalid 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: An image is represented by a collection of pixels. Consider an image in which each pixel can be only one of 3 different shades. What is the number of bits I would need to store an image which contains 1024 pixels? (1 Point) Minimum number of bits to represent 3 shades = 2 bits So for 1024 pixels, number of bits = 1024 x 2 = 2048 bits Problem 2: Consider the number 27 in an octal number system (base 8). What is its representation in decimal? (2 Points) (27) 8 = 2 x 8 1 + 7 x 8 0 = 16 + 7 = (23) 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.110 B = 0011.101 -B = 1100.011 A B = A + (-B) = 0010.001 = 2.125-3 -

Problem 4: Show the result of performing the following logic operations on X = 0xA8 and Y = 0x0D: (Express your answer in hexadecimal) (NOT Y) AND (X OR Y) (3 Points) X = 10101000 Y = 00001101 (NOT Y) AND (X OR Y) = 11110010 AND 10101101 = 10100000 = 0xA0 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: 2, 5, 9, 10 and 14. What mask should I use to get those interesting bits? Which logical operation would I use? (2 Points) Mask = 0100011000100100 Logical operation to use is AND. Problem 6: Convert the following binary code into an ASCII string (see attached ASCII table): 01000101 01100001 01010011 01111001 (2 Points) = 0x 45 61 53 79 = 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 = 0x5765 = 0101011101100101 us = 0x7553 = 0111010101010011 Sum = 1100110010111000 Problem 8: What is the decimal equivalent of the following 32-bit IEEE floating point number: 01000001010100000000000000000000 (2 Points) 0 10000010 10100000000000000000000 = (-1) 0 x 1.625 x 2 (130-127) = 13 Problem 9: Add the following two 6-bit 2 s complement binary numbers: 101101 + 101010 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: How many different microarchitectures could exist for a single ISA? (1 Point) a) None b) 1 c) 2 d) There is no limit 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) 3 Code in High level language 5 Micro Architecture 1 Application 2 Algorithm to solve problem 4 ISA Problem 12: Which of the following are specified by an ISA (1 Point) (i) (ii) (iii) Data Type Addressing Microarchitecture a) i & ii b) i & iii c) ii & iii d) i, ii & iii - 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) a 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 -