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
vodka [1.7K]
2 years ago
8

A programmer intended to compute (a AND b) OR c, and wrote the following code, which sometimes yields incorrect output. Why

SAT
1 answer:
atroni [7]2 years ago
3 0

A programmer intended to compute (a AND b) OR c, and wrote the following code, which sometimes yields incorrect output. The reason for this is because:

  • AND and OR are logical operators that operate on Boolean expressions to return true or false results.
  • However, | and & are bitwise operators that act on a given number's binary digits bit by bit and yield a new number after the operation.

<h3>Who is a computer programmer?</h3>

A computer programmer is a person who specializes in creating codes with which a computer is instructed to achieve a specific and expected output.

<h3>What are the other reasons for the inconsistent yield or output?</h3>

The program attempts to calculate (a AND b) OR c using the logical operators AND and OR, which will return either 1 (True) or 0 (False) depending on the inputs.

However, in the program, the programmer used the bitwise or(|) and bitwise and(&) operators: c | (a & b), which returns a new number depending on the values of a, b, and c.

As a result, it will produce the right outcome only when the logical AND - OR operation and bitwise and - or on inputs a, b, and c produce either 0 or 1. Otherwise, the outcome will be inaccurate.

As a result, the right response is that bitwise operators should be substituted by logical operators.

Learn more about programmers:
brainly.com/question/23275071
#SPJ1

You might be interested in
A machine is used to fill bags with a popular brand of trail mix.
lorasvet [3.4K]

The least weight of a bag in the top 5 percent of the distribution is; 246

From the complete question below, we are given;

Population mean; μ = 240

Population standard deviation; σ = 3

Z-score formula is;

z = (x' - μ)/σ

  • Now, we want to find the least weight in the top 5 of the distribution and as such we will use;

1 - 0.05/2 = 0.025 as significance level

Z-score at significance level of 0.025 is 1.96

Thus;

1.96 = (x' - 240)/3

3 × 1.96 = x' - 240

x' = 240 + 5.88

x' = 245.88

Approximating to a whole number gives;

x' = 246

Complete question is;

A machine is used to fill bags with a popular brand of trail mix. The machine is calibrated so the distribution of the weights of the bags of trail mix is normal, with mean 240 grams and standard deviation 3 grams. Of the following, which is the least weight of a bag in the top 5 percent of the distribution?

Read more about z-score at; brainly.com/question/25638875

6 0
3 years ago
What is the atomic mass of the element in period 2 group 13.
yaroslaw [1]

Answer:

thire is no grup 13 in modern periodic table

5 0
3 years ago
Which of these is an agent of chemical weathering?.
Ivanshal [37]
<h2 /><h3>Which of these is an agent of chemical weathering?</h3>

<h3><em>Answer</em><em>;</em><em> </em><em> </em><em> </em><em>The primary agents in chemical weathering are water, oxygen and acids. Explanation: These react with surface rocks to form new minerals that are stable in,or in equibrilium with the physical and chemical conditions present on the earth's surface</em></h3>

<h3><em>Hope</em><em> </em><em>it's</em><em> </em><em>helpful</em><em> </em><em>to</em><em> </em><em>you</em><em> </em><em>please</em><em> </em><em>rate</em><em> </em><em>me</em><em> </em><em>and</em><em> </em><em>like</em><em> </em><em>my</em><em> </em><em>answer</em><em>.</em><em>,</em><em>.</em><em>.</em><em>.</em></h3>
3 0
2 years ago
Ovaries produce sperm cells and testes produce eggs cells true or false
8_murik_8 [283]

Answer:

false

Explanation:

it's the opposite

7 0
3 years ago
I just need some to answer these asap. due before midnight. answer it in your own words. Looking for answers so i can look at th
laila [671]

Answer:

. TRANSITIVE OR INTRANSITIVE VERB

If you accept something that you have been offered, you say yes to it or agree to take it.

किसी बात को स्वीकार करना/स्वीकार करना

I accepted his offer of employment. All those invited to the conference have accepted.

accept a gift/donation/

6 0
3 years ago
Other questions:
  • Synonym for inculcated​
    12·1 answer
  • Which had the shortest wavelength and therefore the highest frequency/most energy?
    9·1 answer
  • A superstition is usually based on rational thinking. Please select the best answer from the choices provided T F
    8·1 answer
  • A neutralization reaction between koh and h2so4 would give which two products.
    9·1 answer
  • In the first paragraph of the passage on pages 2 and 3.
    6·1 answer
  • Which of the following is not a common use of gypsum?.
    12·1 answer
  • A 2 kg object is a distance of 10,000,000 m away from the center of earth, which has a mass of nearly 6×1024 kg. What is the app
    11·1 answer
  • If 2. 5 moles of h2o are produced how many moles of hydrogen gas must be used.
    8·1 answer
  • what are ways for calassifing asset and liability as current and non current with relevance example ?​
    7·1 answer
  • What math is needed for theoretical physics
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!