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
Very thin films are usually deposited under vacuum conditions to prevent contamination and ensure that atoms can fly directly fr
katrin [286]

Answer:

a. 9947 m

b. 99476 times

c. 2*10^11 molecules

Explanation:

a) To find the mean free path of the air molecules you use the following formula:

\lambda=\frac{RT}{\sqrt{2}\pi d^2N_AP}

R: ideal gas constant = 8.3144 Pam^3/mol K

P: pressure = 1.5*10^{-6} Pa

T: temperature = 300K

N_A: Avogadros' constant = 2.022*10^{23}molecules/mol

d: diameter of the particle = 0.25nm=0.25*10^-9m

By replacing all these values you obtain:

\lambda=\frac{(8.3144 Pa m^3/mol K)(300K)}{\sqrt{2}\pi (0.25*10^{-9}m)^2(6.02*10^{23})(1.5*10^{-6}Pa)}=9947.62m

b) If we assume that the molecule, at the average, is at the center of the chamber, the times the molecule will collide is:

n_{collision}=\frac{9947.62m}{0.05m}\approx198952\  times

c) By using the equation of the ideal gases you obtain:

PV=NRT\\\\N=\frac{PV}{RT}=\frac{(1.5*10^{-6}Pa)(\frac{4}{3}\pi(0.05m)^3)}{(8.3144Pa\ m^3/mol\ K)(300K)}=3.14*10^{-13}mol\\\\n=(3.14*10^{-13})(6.02*10^{23})\ molecules\approx2*10^{11}\ molecules

5 0
3 years ago
You are designing the access control policies for a Web-based retail store. Customers access the store via the Web, browse produ
PolarNik [594]

Answer:

Object-Oriented Software Engineering Using UML, Patterns, and Java, 3e, shows readers how to use both the principles of software engineering and the practices of various object-oriented tools, processes, and products.

3 0
2 years ago
What are some quality assurance systems
Aloiza [94]
Examples of quality assurance activities include process checklists, process standards, process documentation and project audit. Examples of quality control activities include inspection, deliverable peer reviews and the software testing process. You may like to read more about the quality assurance vs quality control.
7 0
2 years ago
Stream Piracy – Kaaterskill, NY. Check and double-click the Problem 15 folder. The dark blue and orange streams highlight the pr
baherus [9]

Answer:

b. The pirating streams are eroding headwardly to intersect more of the other streams’ drainage basins, causing water to be diverted down their steeper gradients.

Explanation:

From the Kaaterskill NY 15 minute map (1906), this shows two classic examples of stream capture.

The Kaaterskill Creek flow down the east relatively steep slopes into the Hudson River Valley. While, the Gooseberry Creek is a low gradient stream flowing down the west direction which in turn drains the higher parts of the Catskills in this area.

However, there is Headward erosion of Kaaterskill Creek which resulted to the capture of part of the headwaters of Gooseberry Creek.

The evidence for this is the presence of "barbed" (enters at obtuse rather than acute angle) tributary which enters Kaaterskill Creek from South Lake which was once a part of the Gooseberry Creek drainage system.

It should be noted again, that there is drainage divide between the Gooseberry and Kaaterskill drainage systems (just to the left of the word Twilight) which is located in the center of the valley.

As it progresses, this divide will then move westward as Kaaterskill captures more and more of the Gooseberry system.

5 0
3 years ago
What kinds of problems or projects would a civil engineer work on?
lisov135 [29]

Answer:

simple projects bovonhztisgx

8 0
3 years ago
Other questions:
  • A 55-μF capacitor has energy ω (t) = 10 cos2 377t J and consider a positive v(t). Determine the current through the capacitor.
    12·1 answer
  • These tadpoles are confined to a limited environment. What are they all competing for in that environment
    12·2 answers
  • A copper wire of original diameter .80 m exhibits a maximum tensile load/ strength at an engineering stress= 248.2 mpa. its duct
    11·1 answer
  • Why is low voltage advantageous in arc welding?
    5·1 answer
  • : A pneumatic "cannon" is a device that launches a low mass projectile from a cylindrical tube using pressurized air stored upst
    6·1 answer
  • A field sample of an unconfined aquifer is packed in a test cylinder. The length and diameter of the cylinder are 50 cm and 6 cm
    9·1 answer
  • Compare the temperature dependence of Nabarro-Herring and Coble creep. Which is more temperature-sensitive
    15·1 answer
  • The purpose of the international residential code is to
    9·1 answer
  • Describe in your own words the three strengthening mechanisms
    7·1 answer
  • What is a splitter gearbox​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!