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
Aleks04 [339]
3 years ago
6

Bob and Alice are solving practice problems for CSE 2320. They look at this code: for(i = 1; i <= N; i = (i*2)+17 ) for(k = i

+1; k <= i+N; k = k+1) // notice i in i+1 and i+N printf("B"); Alice says the loops are dependent. Bob says they are not dependent. Who is correct? ____________ What do you think? Are they dependent or not dependent? They are __________
Engineering
2 answers:
MissTica3 years ago
8 0

Answer:

Alice is correct.

The loop are dependent.

Explanation:

for(i = 1; i <= N; i = (i*2)+17 )

for(k = i+1; k <= i+N; k = k+1) // notice i in i+1 and i+N

printf("B")

This is a nested for-loop.

After the first for-loop opening, there is no block of statement to be executed rather a for-loop is called again. And the second for-loop uses the value of i from the first for-loop. The value of N is both called from outside the loop.

So, the second for-loop depend on the first for loop to get the value of i. For clarity purpose, code indentation or use of curly brace is advised.

ZanzabumX [31]3 years ago
4 0
<h2>Answer:</h2>

Alice is correct

They are dependent

<h2>Explanation:</h2><h2></h2>

<em>The code snippet can be re-written as follows;</em>

<em></em>

for(i = 1; i <= N; i = (i*2)+17 )

  for(k = i+1; k <= i+N; k = k+1)

<em>Which can also be re-written as;</em>

<em></em>

for(i = 1; i <= N; i = (i*2)+17 ) {

   for(k = i+1; k <= i+N; k = k+1){

   }

}

In many programming languages, curly brackets are used for grouping blocks of codes. For a for loop, while loop, if statement and other related control structures, the lines of statement(s) inside their curly brackets are executed when they are encountered. In the case where any of these control statements is written without curly brackets, the next line of code (and that only) following it belongs to its block.  

Consequential from the foregoing, at each of cycles of the <em>outer</em> <em>for loop</em> in the first code snippet above, the <em>inner for loop </em>will be executed. In other words, the inner for loop belongs to the block of the outer for loop though there is no curly bracket included. This also means that once a control statement has only a single line of code to be executed or to be a part of its block, curly brackets are not required. Therefore, the two versions of code snippets written above are identical and equivalent.

With the aforementioned, it is easy to say and see that the Alice is correct that the loops are dependent on each other.

You might be interested in
Explain how you would solve for total resistance in a parallel circuit versus a series circuit. How would you apply and solve fo
Mekhanik [1.2K]

Answer:

No, series parallel, as it implies has components of the circuit configured in both series and parallel. This is typically done to achieve a desired resistance in the circuit. A parallel circuit is a circuit that only has the components hooked in parallel, which would result in a lower total resistance in the circuit than if the components were hooked up in a series parallel configuration.

Explanation:

8 0
3 years ago
A turbojet aircraft flies with a velocity of 800 ft/s at an altitude where the air is at 10 psia and 20 F. The compressor has a
nika2105 [10]

Answer:

Pressure = 115.6 psia

Explanation:

Given:

v=800ft/s

Air temperature = 10 psia

Air pressure = 20F

Compression pressure ratio = 8

temperature at turbine inlet = 2200F

Conversion:

1 Btu =775.5 ft lbf, g_{c} = 32.2 lbm.ft/lbf.s², 1Btu/lbm=25037ft²/s²

Air standard assumptions:

c_{p}= 0.0240Btu/lbm.°R, R = 53.34ft.lbf/lbm.°R = 1717.5ft²/s².°R 0.0686Btu/lbm.°R

k= 1.4

Energy balance:

h_{1} + \frac{v_{1} ^{2} }{2} = h_{a} + \frac{v_{a} ^{2} }{2}\\

As enthalpy exerts more influence than the kinetic energy inside the engine, kinetic energy of the fluid inside the engine is negligible

hence v_{a} ^{2} = 0

h_{1} + \frac{v_{1} ^{2} }{2} = h_{a} \\h_{1} -h_{a} = - \frac{v_{1} ^{2} }{2} \\ c_{p} (T_{1} -T_{a})= - \frac{v_{1} ^{2} }{2} \\(T_{1} -T_{a}) = - \frac{v_{1} ^{2} }{2c_{p} }\\ T_{a}=T_{1} +  \frac{v_{1} ^{2} }{2c_{p} }

T_{1} = 20+460 = 480°R

T_{a}  =480+  \frac{(800)(800}{2(0.240)(25037}= 533.25°R

Pressure at the inlet of compressor at isentropic condition

P_{a } =P_{1}(\frac{T_{a} }{T_{1} }) ^{k/(k-1)}

P_{a} = (10)(\frac{533.25}{480}) ^{1.4/(1.4-1)}= 14.45 psia

P_{2}= 8P_{a} = 8(14.45) = 115.6 psia

4 0
3 years ago
Read 2 more answers
Free ideas free points. You will be reported for answering "no" or I don't know
KengaRu [80]

Answer:

Here are some cool ideas that you could do

-Zero fuel aircraft

-Advanced Space Propulsion Technologies

-Smart Automation and Blockchain

These are some things I've been working on for a few years lol, maybe you will have more luck

5 0
3 years ago
What is the connection between the air fuel ratio and an engine running rich/poor? please give clear examples and full sentances
gavmur [86]

Explanation:

Air fuel ratio:

 Air fuel ratio is the ratio of mass of air to the mass of fuel.So we can say that

Air\ fuel\ ratio=\dfrac{mass\ of\ air}{mass\ of\ fuel}

As we know that fuel burn in the presence of air that is why we have to maintain a proper amount of air fuel ratio.

When we need more power then we have supply more fuel and to burn this fuel ,require a specified amount of air.So for different loading condition of engine different air fuel ratio is required.

When air is less and fuel is more then it is called rich air fuel ratio .when air is more and fuel is less then it is called poor air fuel ratio.

5 0
3 years ago
2. (Problem 4.60 on main book, diameters different) Water flows steadily through a fire hose and nozzle. The hose is 35 mm diame
Viefleur [7K]

Answer:

coupling is in tension

Force = -244.81 N

Explanation:

Diameter of Hose ( D1 ) = 35 mm

Diameter of nozzle ( D2 ) = 25 mm

water gage pressure in hose = 510 kPa

stream leaving the nozzle is uniform

exit speed and pressure = 32 m/s and atmospheric

<u>Determine the force transmitted by the coupling between the nozzle and hose </u>

attached below is the remaining part of the  detailed solution

Inlet velocity ( V1 ) = V2 ( D2/D1 )^2  

= 32 ( 25 / 35 )^2

= 16.33 m/s

4 0
3 years ago
Other questions:
  • A turbine produces shaft power from a gas that enters the turbine with a (static) temperature of 628 K, a velocity of 143 m/s an
    7·1 answer
  • A fluid flows steadily through a pipe with a uniform cross sectional area. The density of the fluid decreases to half its initia
    6·1 answer
  • What’s a pnp transitor?
    5·2 answers
  • A random sample of 5 hinges is selected from a steady stream of product from a punch press, and the a. b. proportion nonconformi
    12·1 answer
  • Describe what viscoelastic behavior means
    7·1 answer
  • Zack's new home is progressing well, and the foundation work is finished. The general contractor stops by Zack's present home to
    11·1 answer
  • How can you contribute to achieved the mission of NSTP during pandemic in your society?
    7·1 answer
  • 2.<br> The most common way to identify size of pipe is by:
    8·1 answer
  • It is important to follow correct procedures when running electrical cables next to data cables in order to protect against whic
    6·1 answer
  • Aqueous cleaners are ________ parts cleaning agents.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!