Find the express code that corresponds to the service tag


Solve the following problems and hand them in at the beginning of class on the due date. You may use a basic calculator, but you must show how you got your answer. 

Write out the solutions neatly. Problems should be in order. Stack the pages neatly with the cover sheet on top and put a single stable in the upper left corner. Make sure the staple does not obscure any of your writing.

Fill in the page numbers of the source code and output for problems 11 and 12 on the cover sheet.

  1. Convert to decimal: 0x2c7b
  2. Convert to binary: 0x2c7b
  3. Convert from decimal to binary: 437
  4. Convert from decimal to hexadecimal: 437
  5. Determine the output of the following code segment (without running it):
    Assume that an int is 32 bits.
    unsigned a = 157;
    unsigned b = 234;
    unsigned c = ~a;
    unsigned d = a & b;
    unsigned e = a | b;
    unsigned f = a ^ b;
    printf("%u %u %u %u %u %u\n",a,b,c,d,e,f);
    
  6. Write a code segment that uses shifts to multiply the unsigned int x by 37.
  7. Using an 8-bit word, find the binary representation of -47 in
    1. two's complement
    2. ones' complement
    3. sign-magnitude
  8. Using a 16-bit word, find the binary representation of -47 in
    1. two's complement
    2. ones' complement
    3. sign-magnitude
  9. Assume that a short is represented by 11 bits and an int is represented by 17 bits.
    What is the output generated by the following code segment:
    int x = 5123;
    int y = -5123;
    short sx = (short)x;
    short sy = (short)y;
    printf("%d %d %d %d\n",x, y, (int)sx, (int)sy);
    printf("%x %x %x %x\n",x, y, (int)sx, (int)sy);
    printf("%u %u %u %u\n",x, y, (int)sx, (int)sy);
    
    You may use a calculator to generate the values, but you must show how you calculated them.
  10. Dell computers have a unique alpha-numeric service tag consisting of digits and upper case letters. When you call Dell technical support, they would like to know the service tag number so that they can appropriately route your call. One way to automate this is to have you type in your service tag number. Since there is no convenient way to uniquely type letters on a standard telephone keypad, Dell also gives you an express code, which is a decimal number calculated from the service tag. The calculation algorithm is simple: the service tag is treated as a base-36 number, where A=10, B=11, etc. 
    Find the express code that corresponds to the service tag: H32Y1F1. You must show how you got your answer.
  11. Write a C program called convert2hex.c that takes a single command line parameter, a decimal number. It starts by outputting your full name. It converts the number to hexadecimal using the method described on the top of page 36 of the text. It outputs the results as it goes along. For each hexadecimal digit it displays a line showing how that digit was created and finally displays a line containing the final result. All output goes to standard output.
    Example:
    If I wrote the program,
    convert2hex 314156
    would generate the following output:
    Abdullah Muzahid
    314156 = 19634 * 16 + 12 (C)
     19634 = 1227 * 16 + 2   (2)
      1227 = 76 * 16 + 11    (B)
        76 = 4 * 16 + 12     (C)
         4 = 0 * 16 + 4      (4)
    0x4CB2C
    
    Note the use of upper case letters and that the equal signs and hexadecimal digits created are lined up.
    You may assume that the number being converted is greater than 0 and less than 263.
    Hint: first write and debug the program, not worrying about lining up the output.
    Run your program with each of the following command line parameters and include the output.
    1. 314156
    2. 2147483647
    3. 11806310474565
    4. 8526495043095935640
  12. Write a C program called convert2base.c that is similar to convert2hex.c, but has 2 command line parameters, the first being an integer in the range 2 though 36, and the second being a decimal number. Instead of converting to base 16, the base used is given by the first parameter.
    Example
    If I wrote the program,
    convert2base 23 314156
    would generate the following output:
    Abdullah Muzahid
    314156 = 13658 * 23 + 22 (M)
     13658 = 593 * 23 + 19   (J)
       593 = 25 * 23 + 18    (I)
        25 = 1 * 23 + 2      (2)
         1 = 0 * 23 + 1      (1)
    12IJM
    
    Run your program with each of the following command line parameters and include the output.
    1. 23 314156
    2. 2 2147483647
    3. 31 263429442133726086
    4. 36 3881091294471582038

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Find the express code that corresponds to the service tag
Reference No:- TGS01291868

Expected delivery within 24 Hours