Homework1

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

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

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

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

View Full Document
0x0E 0xCD
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<stdio.h> typedef unsigned char *byte_pointer; void show_bytes(byte_pointer start, int len) { int i; for(i=0; i < len; i++) printf("%.2x", start[i]); printf("\n"); } main(){ int val = 0x1234ABCD; byte_pointer valp = (byte_pointer) &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

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern