Lab Zero. HTML file for key binky:

For these questions, I have declared:

  unsigned char *cp;
  unsigned int *ip;
  unsigned int x, y;
  unsigned char w, z;
Assume that you are running on a little-endian machine with 4-byte pointers.

In the following questions, give me the exact output of the printf() statements, assuming that cp and ip both equal 0x58ac1130.

The 12 integers starting at address 0x58ac1130 are:
     0x444b7868
     0x48787759
     0x4b44476e
     0x61735a48
     0x737a6a6c
     0x6d5a6450
     0x55695400
     0x58ac1150
     0x50784555
     0x496f7976
     0x44477865
     0x00526a6d
Question 0: printf("0x%08x\n", ip[9]);
Question 1: printf("0x%08x\n", ip[4]);
Question 2: printf("0x%02x\n", cp[8]);
Question 3: printf("0x%02x\n", cp[19]);
Question 4: printf("0x%02x\n", cp[29]);
Question 5: printf("0x%02x\n", cp[41]);

Question 6: printf("0x%08lx\n", (unsigned long) (ip+5));
Question 7: printf("0x%08lx\n", (unsigned long) (ip+7));
Question 8: printf("0x%08lx\n", (unsigned long) (cp+17));
Question 9: printf("0x%08lx\n", (unsigned long) (cp+33));

Question 10: printf("%s\n", cp+18);
Question 11: printf("%s\n", cp+41);

Question 12: w = 0x95; z = 0xb1; printf("0x%02x\n", (w & z));
Question 13: w = 0x95; z = 0xb1; printf("0x%02x\n", (w | z));
Question 14: w = 0x5e; z = 0x12; printf("0x%02x\n", (w ^ z));
Question 15: w = 0x98; z = 0xd8; z = ~z; printf("0x%02x\n", (w ^ z));

Question 16: w = 0x35; z = (w << 3); printf("0x%02x\n", z);
Question 17: w = 0x4a; z = (w >> 3); printf("0x%02x\n", z);

Question 18: x = 0x8b0dc913; y = (x >> 12); printf("0x%08x\n", y);
Question 19: x = 0xb425c6bf; y = (x << 12); printf("0x%08x\n", y);

Question 20: x = 0xa8adf64d; y = 0xf00ff00f; printf("0x%08x\n", x | y);
Question 21: x = 0xa8adf64d; y = 0xf00ff00f; printf("0x%08x\n", x & y);
Question 22: x = 0xa8adf64d; y = 0xf00ff00f; printf("0x%08x\n", x & (~y));
Question 23: x = 0xa8adf64d; y = 0xf00ff00f; printf("0x%08x\n", x ^ y);

Question 24: ip = (unsigned int *) ip[7]; printf("0x%08x\n", *ip);

For your convenience, here are tables of characters to their ASCII codes in hex:
Character:     A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z
ASCII in hex: 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a

Character:     a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z
ASCII in hex: 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a