Ask Question, Ask an Expert

+1-415-315-9853

info@mywordsolution.com

Ask Computer Engineering Expert

problem 1: prepare a function which has an int parameter n, makes an integer mask having the bit 1 at the nth place from the rightmost bit, and returns the mask. For illustration, when n = 5 is passed to the function, the function will return 0x20 (Note that 0x20 is 00000000 00000000 00000000 00100000).

problem 2: prepare a function which has two int parameters num and n, and returns TRUE when the nth bit in num is 1, otherwise FALSE. This function must use the function in the above problem (1). (Be careful how to handle Boolean values in C.)

problem 3: prepare down a function which has a single int parameter n and returns an int: 0 if n is negative, or else 1. You are not allowed to simply check the integer value, and must use the function in the above problem (2).

problem 4: prepare down a function which has four unsigned char parameters, combines the four one-byte integer values into an unsigned integer, and returns the unsigned integer. When the four one-byte integers are combined, the first value should be used for the first byte in the resulting unsigned integer, the 2nd value for the second byte, the 3rd value for the 3rd byte, and the 4th value for the last byte.

problem 5: prepare down a function which has int parameter n, makes another kind of mask having n bit 1’s from the left most bit and 32- n bit 0’s next. The mask is called netmask in this seminar, and the function will return the netmask. (Note that a netmask consists of two parts of bit 1’s and bit 0’s.)

problem 6: prepare a function which has two unsigned int parameters of an IPv4 address (that is, an unsigned int) and a netmask (that is, an unsigned int), and returns the network id part in the IPv4 address. (Note that the network id part in an IPv4 address is obtained from the address by clearing some bits that are indicated by the bit 0’s in a netmask.)

problem 7: prepare down a function to check odd-parity of a given int parameter. That is that the function returns 1 when the number of bit 1's is odd, or else 0.

problem 8: prepare a main function which tests all the functions in (1) – (7).

•    The test data can be hard-coded in the main function, and each function must be tested at least 5 times.
•    The main function must appear before any other functions.
•    When you print integers, you must use the format specifier printing integers in the hexadecimal notation.
•    You mut use only one C file for this assignment.
•    You must not put any printf() in the functions in (1) – (7).

Computer Engineering, Engineering

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

Have any Question? 


Related Questions in Computer Engineering

Design a combination generation algorithm that accepts as

Design a combination generation algorithm that accepts as input a set of n characters and produces as output all combinations of size r of these characters.

Do a complete research and reading in order to understand

Do a complete research and reading in order to understand how multimegawatt induction generators can be controlled with a scalar control. Assume power electronic devices capable of handling high voltages and high current ...

After being fired an employee becomes disgruntled the

After being fired, an employee becomes disgruntled. The managers never disabled his login information, and his best friend still works at the company. The disgruntled employee gives his friend his login information for t ...

1 what are nested loops give an example where a nested loop

1. What are nested loops? Give an example where a nested loop is typically used. 2. Explain the differences between these debugger operations: • Stepping into a method • Stepping over a method

In computer science when we encounter an algorithm we often

In computer science, when we encounter an algorithm, we often need to ask about the complexity of that algorithm (how many computations we need to do). To find the complexity of Dijkstra's algorithm, find the number of s ...

Assume that you have a cache designed as specified in the

Assume that you have a cache designed as specified in the last problem. Explain how the function of a TLB can be integrated into this cache; in other words, explain how to use just this cache, with no TLB, to achieve the ...

A read hit occurs in way2 of set 17 within an 8-way set

A read hit occurs in way2 of set 17 within an 8-way set associative cache that uses a line size of 128 bytes. The total number of lines in the cache is 32768. The system employs 32-bit addresses and the tag for way2 with ...

1 what was important about rand report r-6092 who decides

1. What was important about Rand Report R-609? 2. Who decides how and when data in an organization will be used or controlled? Who is responsible for seeing that these wishes are carried out? 3. Who should lead a securit ...

Design a help-desk priority manager store help requests

Design a help-desk priority manager. Store help requests stored in a text file with the following structure: priority, id of requesting party, time of request The priority is an integer in the range 1-5 with 1 being the ...

1 using the cidr notation show the link local address in

1. Using the CIDR notation, show the link local address in which the node identifier is 0::123/48. 2. Using the CIDR notation, show the site local address in which the node identifier is 0::123/48. 3. An IPv6 packet cons ...

  • 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

Section onea in an atwood machine suppose two objects of

SECTION ONE (a) In an Atwood Machine, suppose two objects of unequal mass are hung vertically over a frictionless

Part 1you work in hr for a company that operates a factory

Part 1: You work in HR for a company that operates a factory manufacturing fiberglass. There are several hundred empl

Details on advanced accounting paperthis paper is intended

DETAILS ON ADVANCED ACCOUNTING PAPER This paper is intended for students to apply the theoretical knowledge around ac

Create a provider database and related reports and queries

Create a provider database and related reports and queries to capture contact information for potential PC component pro

Describe what you learned about the impact of economic

Describe what you learned about the impact of economic, social, and demographic trends affecting the US labor environmen