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
What is the difference Plastic vs elastic deformation.
Reika [66]

Answer:

What is the difference Plastic vs elastic deformation

Explanation:

The elastic deformation occurs when a low stress is apply over a metal or metal structure, in this process, the stress' deformation is temporary and it's recover after the stress is removed. In other words, this DOES NOT affects the atoms separation.

The plastic deformation occurs when the stress apply over the metal or metal structure is sufficient to deform the atomic structure making the atoms split, this is a crystal separation on a limited amount of atoms' bonds.

8 0
3 years ago
a vertical cylindrical container is being cooled in ambient air at 25 °C with no air circulation. if the initial temperature of
Sloan [31]

Answer:

the surface heat-transfer coefficient due to natural convection during the initial cooling period.  = 4.93 w/m²k

Explanation:

check attachement for answer explanation

7 0
3 years ago
Read 2 more answers
Determine the pressure difference in N/m2,between two points 800m apart in horizontal pipe-line,150 mm diameter, discharging wat
zlopas [31]

Answer: 10.631\times 10^3\ N/m^2

Explanation:

Given

Discharge is Q=12.5\ L

Diameter of pipe d=150\ mm

Distance between two ends of pipe L=800\ m

friction factor f=0.008

Average velocity is given by

\Rightarrow v_{avg}=\dfrac{12.5\times 10^{-3}}{\frac{\pi }{4}(0.15)^2}\\\\\Rightarrow v_{avg}=\dfrac{15.9134\times 10^{-3}}{2.25\times 10^{-2}}\\\\\Rightarrow v_{avg}=7.07\times 10^{-1}\\\Rightarrow v_{avg}=0.707\ m/s

Pressure difference is given by

\Rightarrow \Delta P=f\ \dfrac{L}{d}\dfrac{\rho v_{avg}^2}{2}\\\\\Rightarrow \Delta P=0.008\times \dfrac{800}{0.15}\times \dfrac{997\times (0.707)^2}{2}\\\\\Rightarrow \Delta P=10,631.45\ N/m^2\\\Rightarrow  \Delta P=10.631\ kPa

8 0
3 years ago
Test de evaluare
ivolga24 [154]
C why it’s c bc they I just got it right
7 0
3 years ago
g Let Y denote the number of oil tankers arriving each day at a certain port and it is a Poisson random variable. Record shows t
Natalija [7]

Answer:

0.77978

Explanation:

This is a Poisson distribution problem

Poisson distribution formula is given as

P(X = x) = (e^-λ)(λˣ)/x!

λ = mean = 10 tankers per day

x = variable whose probability is required

The probability that more than 7 tankers arrives in a certain day = 1 - (Probability that 7 or less tankers arrive in a certain day)

P(X > 7) = 1 - P(X ≤ 7)

P(X ≤ x) = Σ (e^-λ)(λˣ)/x! (Summation From 0 to x)

P(X ≤ 7) = P(X=0) + P(X=1) + P(X=2) + P(X=3) + P(X=4) + P(X=5) + + P(X=6) + P(X=7) + P(X=8)

Computing this,

P(X≤7) = 0.22022

P(X > 7 ) = 1 - P(X≤7) = 1 - 0.22022 = 0.77978

4 0
3 years ago
Other questions:
  • Who knows about welding ??
    7·1 answer
  • How is this technique is adapted to coat continuous steel strip for manufacture of tinplate products?
    11·1 answer
  • A six-lane multilane highway (three lanes in each direction) has a peak-hour factor of 0.90, 11-ft lanes with a 4-ft right-side
    11·1 answer
  • A Barnes and Books is interested in purchasing a two-story building for a new
    5·1 answer
  • Cómo se llama el componente, que permite abrir o cerrar un circuito eléctrico
    8·1 answer
  • Tony works as a Sorter in a processing factory. Which qualifications does he most likely have?
    10·2 answers
  • Select three functions of catalysts.
    9·1 answer
  • The wave-particle duality theory is the first adequate explanation of which one of the following observations about the hydrogen
    10·1 answer
  • State 3 advantages and 3 disadvantages of unit rate contract​
    10·1 answer
  • What would happen if the brake pedal was released while the bleed screw was open during brake bleeding?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!