Homework1 - 0xA9 III Byte Ordering: Consider the following...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
ICS’10 Homework1 I Number Conversions: a. Convert the following numbers with the indicated bases to decimal. (D2E8) 16 (110110011010) 2 (666) 8 b. Convert the following numbers with the indicated bases to hexadecimal. (6566) 10 (101011011110) 2 (777) 8 c. Convert the following numbers with the indicated bases to binary. (64030) 10 (2ED3) 16 (342) 8 II Operations: i. Given A and B with hexadecimal expression 0xDC and 0xE3 respectively. Calculate the values of the following expressions: a) A & B b) A && B c) A | B d) A || B e) ~ A |~ B f) ! A || B g) A&&~ B ii. Fill in the table below with the results of shift operations given. X X<<4 X>>3 (Logical) X>>3 (Arithmetic) Hex Hex Hex Hex 0xF3
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
0x0E 0xCD
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 0xA9 III Byte Ordering: Consider the following code : #include&lt;stdio.h&gt; typedef unsigned char *byte_pointer; void show_bytes(byte_pointer start, int len) { int i; for(i=0; i &lt; len; i++) printf(&quot;%.2x&quot;, start[i]); printf(&quot;\n&quot;); } main(){ int val = 0x1234ABCD; byte_pointer valp = (byte_pointer) &amp;val; show_bytes(valp,1); /* A . */ show_bytes(valp,2); /* B. */ show_bytes(valp,3); /* C. */ return 1; } Indicate which of the values would be printed by each call on a little-endian and on a big-endian machine: A. Little endian: ________; Big endian: ________; B. Little endian: ________; Big endian: ________; C. Little endian: ________; Big endian: ________;...
View Full Document

Page1 / 2

Homework1 - 0xA9 III Byte Ordering: Consider the following...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online