Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91696353

Have any Question?


Related Questions in Computer Engineering

Question suppose your computer is able to test 50000

Question Suppose your computer is able to test 50,000 passwords per second. If the password were 8 bytes long (a-z, A-Z, 0-9), what year will the password be cracked through brute force (Show your work)? Assume 1) you we ...

Question suppose you are comparing two algorithms a and b

Question : Suppose you are comparing two algorithms A and B that run on the same machine. The running time of A is 10n log2 n and the running time of B is 50n (assume these are exact running time). What is the smallest v ...

Combustion analysis of a hydrocarbon produces 3301 g co2

Combustion analysis of a hydrocarbon produces 33.01 g CO2 and 27.03 g H 2O Calculate the empirical formula of the hydrocarbon. Express your answer as a chemical formula.

Ellen is an anthropologist who has been working at olduvai

Ellen is an anthropologist who has been working at Olduvai Gorge in Tanzania for the past six months. She has been conducting research on the Internet. She finds a Web site with an article that proposes a revolutionary t ...

Introduction to software developmentmenu-driven

Introduction to Software Development Menu-Driven Programs TASKS: Language translator. Design a program that display the following menu: Select a language and I will say Good Morning English Italian Spanish German End the ...

Which sentence would work better as a thesis statement for

Which sentence would work better as a thesis statement for a three-to-five-page college paper? Remember that a thesis should be a central idea that requires supporting evidence; it should be of adequate scope for essay's ...

Suppose in your company you formulate a python script that

Suppose in your company you formulate a Python script that inserts, updates, and deletes data in tables in a MySQL database. You post your Python script on a shared drive for other staff members to use. What are some the ...

Question 1conduct research to determine three types of

Question: 1. Conduct research to determine three types of computer crime. Please provide a detailed description for all crimes, and share an example of where an organization was impacted by each of the types. 2. Elaborat ...

Link changes in unemployment inflation wages and gdp to one

Link changes in unemployment, inflation, wages, and GDP to one another and how they impacted each other during periods of economic decline (recessions) and periods of economic growth (expansion) over the past 10 years.

The standard bcd-to-7-segment decoder such as the 74ls47

The standard BCD-to-7-segment decoder (such as the 74LS47 used in the lab), has active-LOW outputs. Should the 7-segment display be common-anode or common-cathode? Why do you think the decoder is configured for active-LO ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As