1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
saveliy_v [14]
3 years ago
12

Assume you are programming an embedded microcontroller in C and want your code to follow good software engineering practices, be

as portable as possible, and not be wasteful of memory. You need to select a variable that can hold an integer from 0 to 132. What is the best choice for the variable type?
Engineering
2 answers:
Olegator [25]3 years ago
5 0

Answer:

unsigned char

Explanation:

Selecting best data type depends upon the application. Memory and portability are some of the considerations while selecting a data type.

For the given scenario, we need to store an integer in the range of 0 to 132.

Lets have a look at some of the options available for variable data types.

Type: signed char

storage size: 1 byte

Range: -128 to 127

Type: unsigned char

storage size: 1 byte

Range: 0 to 255

Type: int

storage size: 2 byte

Range: -32,768 to 32,767

Unsigned char would be best choice since we need to store only positive integers and it gives us range 0 to 255 which is more than enough for our case and storage size is also least. Other data types are simply too big to consider for this scenario and hence they will be a wasteful of memory.

Please note that the name of data type is "char" but that doesn't mean that we cannot store integer values in it. In-fact in embedded micro-controller environment, char is often used for storing one byte integers.

insens350 [35]3 years ago
4 0

Answer:

unsigned char

Explanation:

The different data types with their sizes and range are given as follows,

  • char - 1 byte - Value: -128 - 127
  • unsigned char- 1 byte - Value: 0 - 255

All other data types including integers, float, double require 2 bytes or more. Therefore, the data type with the smallest size that can hold values from 0 to 132 is unsigned char.

You might be interested in
Why do electricians require critical thinking skills? In order to logically identify alternative solutions to problems in order
Rina8888 [55]

Answer:

In order to logically identify alternative solutions to problems

Explanation:

Electricians are specialized in electrical wiring of buildings, transmission lines, stationary machines, and related equipment. They are either employed in the installations of new electrical components, or to maintain an already installed component. The job of an electrician can be mentally tasking, especially in troubleshooting for fault, and methods of fixing of faults. Some problems might require an out-of-norm approach to solve, and the electrician has to be able to logically identify alternative solutions to problems.

8 0
3 years ago
A TV USE 75 WATTS WHILE IN USED ASSMING THAT ITIS USED 4 HOURS EVERY DAY HOW MUCH ENERGY IN 4 IN KWH WOULD THE TV CONSUME ANNUAL
prohojiy [21]

Answer:

i don't think i understand the question

Explanation:

7 0
2 years ago
Read 2 more answers
What is the weight of a steel plate in the shape of a circle with a diameter of 10'? The steel weighs 14 Ib per Ft2
S_A_V [24]
Width * Length * Thickness * Density = Weight.
48″ * 96″ * . 1875″ * 0.284 lb/in3 = 245 lb.
3 0
3 years ago
Which of the following is lost when the computer is turned off? ILL MARK BRAINLEST
Pavel [41]

Answer:

cloud storage is the answer

6 0
3 years ago
Read 2 more answers
A cylindrical drill with radius 4 is used to bore a hole through the center of a sphere of radius 5. Find the volume of the ring
ANTONII [103]

Answer:

The volume of the ring shaped solid that remains is 21 unit^3.

Explanation:

The total volume of the sphere is given as:

Volume of Sphere = (4/3)πr^3

where, r = radius of sphere

Volume of Sphere = (4/3)(π)(5)^3

Volume of Sphere = 523.6 unit^3

Now, we find the volume of sphere removed by the drill:

Volume removed = (Cross-sectional Area of drill)(Diameter of Sphere)

Volume removed = (πr²)(D)

where, r = radius of drill = 4

D = diameter of sphere = 2*5 = 10

Therefore,

Volume removed = (π)(4)²(10)

Volume removed = 502.6 unit^3

Therefore, the volume of ring shaped solid that remains will be the difference between the total volume of sphere, and the volume removed.

Volume of Ring = Volume of Sphere - Volume removed

Volume of Ring = 523.6 - 502.6

<u>Volume of Ring = 21 unit^3</u>

5 0
3 years ago
Other questions:
  • Write cout statements with stream manipulators that perform the following:
    8·1 answer
  • The 5-kg collar has a velocity of 5 m&gt;s to the right when it is at A. It then travels along the smooth guide. Determine its s
    15·2 answers
  • An assembly line in a modern business compared to 1 from Henry Ford's time is more likely to rely on which of the following unsk
    13·1 answer
  • Exercise 1. (Sum of Integers) Implement the functions sum_iter() and sum_rec() in sum_of_ints.py that take an integer n as argum
    9·1 answer
  • A design that is found to have flaws and must be redesigned and retested is an example of what
    15·1 answer
  • 2.(10 pts)A proposed engine cycle employs an ideal gas and consists of the following sequence of transformations; a) Isothermal
    12·1 answer
  • Please help this is due today!!!!!
    13·1 answer
  • Technician a says that if a tapered roller bearing is adjusted to loose
    15·1 answer
  • Why does my man bun not have its own erodynamics
    12·2 answers
  • Three natural materials that were used by early man as roof covering​
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!