ECE 120 Midterm 1 HKN Review Session Overview of Review
Binary IEEE floating point Hex & ASCII Operators Bitmasks C programming Practice Exam
Binary Representation Unsigned - k bits can represent [0, 2^k) values Can only represent non-negative integers Overflow Condition: If the most significant bit has a carry out Zero Extended - pad the front with zeros when moving to larger data type
(10101) = (16+4+1) = 21 Signed Magnitude - (- 2^(k-1), 2^(k-1) ) values First bit determines sign of number ( 1 = negative, 0 = positive) (10101) = (-1) x (4+1) = -5 Binary Representation - Part II 2s Complement - k bits represents [ -2^(k-1), 2^(k-1) - 1] Sign Extended - pad the front of the number with the sign bit when moving to larger data type
Overflow Condition: if adding numbers of the same sign yields a result of the opposite sign If signed bit is 0, magnitude is same as if the number were treated as unsigned If signed bit is 1, to determine the magnitude, bitwise NOT the bits, and add 1 before finding magnitude 2s complement provides a greater range of values and cleaner binary arithmetic operations ie. the same logic circuit used to add binary unsigned and 2s complement numbers
iEEE 754 Floating Point Representation Great for approximations & expressing very large/very small decimal values 1st bit is sign bit, 0 for positive and 1 for negative 2nd through 9th bit is exponent Special Cases: When exponent is 0 or 255, then denormalized or NAN/inf forms respectively. Denormalized format has normal sign, and magnitude: 0.mantissa * 2^(-126) NAN/inf form is NAN when mantissa is non-zero, and infinity (inf) when mantissa is
all zeros 10th through 32nd bit is 23 bit mantissa Normal Form has magnitude of 1.mantissa * 2 ^ (exponent - 127) (-1)^sign * 1.fraction * 2^(exponent - 127) Hexadecimal & ASCII Representations 7-bit ASCII table will be provided if necessary Although 7 bits, chars in C are 1 byte of memory and allocate 8 bits per character anyway
Hexadecimal is base 16 number system (0-9 & A-F) All numbering systems that have a power of 2 base can have individual characters mapped to binary strings A=1010 B=1011 C=1100 D=1101 E=1110 F=1111 converting 76 (01001100) to hex = 0x4C 0111010, 0110011, 0101001 converting to ASCII - Hexadecimal & ASCII Representations 7-bit ASCII table will be provided if necessary Although 7 bits, chars in C are 1 byte of memory and allocate 8 bits
per character anyway Hexadecimal is base 16 number system (0-9 & A-F) All numbering systems that have a power of 2 base can have individual characters mapped to binary strings A=1010 B=1011 C=1100 D=1101 E=1110 F=1111 converting 76 (01001100) to hex = 0x4C 0111010, 0110011, 0101001 converting to ASCII 0x3A 0x33 0x29 :3)
Operators AND Returns 1 if both inputs are 1 OR Returns 1 if any of the inputs are 1 XOR Returns 1 if either a or b is 1, not both
NOT Returns opposite of input ( 0->1 , vice versa) Bitmasks Great for looking at only certain bits A bitmask using AND as the bitwise operator will selectively mask bits to 0 A bitmask using OR as the bitwise operator will selectively mask bits to 1
C programming Variables Double, Long (8 bytes) Int, Float (4 bytes) Int may be 2 bytes on some systems Short (2 bytes) Char (1 byte) Format Specifiers and Escape Sequences
Format Specifiers: Escape Sequences: %c char single character \n - new line character %d (%i) int signed integer
\b - backspace character %e (%E) float or double exponential format \t - horizontal tab %f float or double signed decimal \ - allows for storing and printing of ASCII value in string
%g (%G) float or double use %f or %e as required \\ - allows for storing and printing of \ ASCII value in string %o int unsigned octal value \ - allows for storing and printing of ASCII value in string %p pointer address stored in pointer
\? - allows for storing and printing of ? ASCII value in string %s array of char sequence of characters Ie. char x = \; (those are 2 single quotes) %u int unsigned decimal will store the data byte associated with into x
%x (%X) int unsigned hex value Format Specifier Example int integer = 5; float decimal = 2.5; printf(This is an integer: %d\nThis is a float: %f\n, integer, decimal); Format Specifier Example int integer = 5;
float decimal = 2.5; printf(This is an integer: %d\nThis is a float: %f\n, integer, decimal); Prints: This is an integer: 5 This is a float: 2.50000 C - operators Order of precedence * , / , % , then + , point numbers)
(Note, Modular Arithmetic (%) is not defined for floating Assignment operator = (takes a variable on the left and a value/expression on the right side) Sets the variable on the left equal to the expression on the right IE, you cant do 5 = x; as 5 is not a variable (you cant assign a value to 5!) Relational ==, !=, <, >, <=, >=
Returns 1 for true, 0 for false Bitwise &, |, ~, ^ (AND, OR, NOT, XOR) Logical !, &&, || (NOT, AND, OR) C operators - bitwise examples
C operators - bitwise examples c = 28 d=7 e = 17 Basic Input / Output
Conditional Constructs Conditional Constructs - Example Iterative Constructs Iterative - Example HW2.9
Past Exam Review https://wiki.illinois.edu/wiki/display/ece120/Midterm+1 Fall 2016, Midterm 1 Solutions available
The English Language in the Middle English Period An Introduction Middle English (1066-1500) Many more texts than OE period No standard variety of English Dates: 1066 Norman Conquest 1100 Round number! 1476 First printing in England (Caxton) 1485 Accession of...
The model is parametric but its model parameters are obtained from first principles, i.e. without recourse (fit) to experiment, as different from usual applications of ligand field theory. Results The parameters 1 and 2 calculated from the LFDFT and obtained...
Write your ideas down, where are you heading, what's your intentions, how does it link in with the theme, show your journey from start to finish through diagrams and notes. Practice ,plan what your final piece will look like.
Connect Code: Enter a Connect access code and click. Redeem. Purchase Online: Click . Buy It . to use a credit card or PayPal. Temporary Access: Click. Access Now . for two-week temporary access. Support At Every Step. McGraw-Hill |
Tel: 0117 32 88412 | Fax: 0117 344 8499 | E-mail: [email protected] or [email protected] Anglia Ruskin Universityv - Cambridge PdC/PgD/MSc Medical Ultrasound- Distance learning/part-time.For details: contact Vicki Elliott, Medical Ultrasound Pathway Leader, Department of Radiography, Institute of Health and Social...
Transport of dangerous goods needs to be regulated in order to prevent, as far as possible, accidents to persons or property and damage to the environment, the means of transport employed or to other goods. ... High level of transport...
Probes A probe is an unmanned, unpiloted spacecraft carrying instruments intended for use in exploration of outer space or celestial bodies other than Earth. Three Types of Probes Interplanetary Probe/Fly-by Probe: Passes a celestial body collecting information as it travels.
Ready to download the document? Go ahead and hit continue!