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
9.For a single-frequency sine wave modulating signal of 3 kHz with a carrier frequency of 36 MHz, what is the spacing between si
nikdorinn [45]

The spacing between sidebands is equal to 6 kHz.

<u>Given the following data:</u>

  • Modulating signal = 3 kHz.
  • Carrier frequency = 36 MHz.

<h3>What is a sideband?</h3>

A sideband can be defined as a band of frequencies that are lower or higher than the carrier frequency due to the modulation process. Thus, it will either be lower than or higher than the carrier frequency.

Generally, the frequency of the modulating signal is equal to the spacing between the sidebands. Therefore, a modulating signal of 3 kHz simply means that the lower sideband is <u>3 kHz</u> higher while the upper sideband is <u>3 kHz</u> lower.

Spacing = 3 kHz + 3 kHz = 6 kHz.

Read more on frequency here: brainly.com/question/3841958

8 0
2 years ago
Think about all the things that you have learned about wildfire in this module.
astra-53 [7]

Answer:

CLIMATE CHANGE HAS inexorably stacked the deck in favor of bigger and more intense fires across the American West over the past few decades, science has incontrovertibly shown. Increasing heat, changing rain and snow patterns, shifts in plant communities, and other climate-related changes have vastly increased the likelihood that fires will start more often and burn more intensely and widely than they have in the past.

Explanation:

6 0
3 years ago
"Given a nodal delay of 84.1ms when there is no traffic on the network (i.e. usage = 0%), what is the effective delay when netwo
shtirl [24]

Answer:

Explanation:

effective delay = delay when no traffic x \frac{100}{100- network\r usage}

effective delay = 84.1 \times \frac{100}{100-39.3}=138.55024711697ms

4 0
3 years ago
What is the step in which you are testing your hypothesis ​
jonny [76]

Answer:

Step 1: State your null and alternate hypothesis. ...

Step 2: Collect data. ...

Step 3: Perform a statistical test. ...

Step 4: Decide whether the null hypothesis is supported or refuted. ...

Step 5: Present your findings.

8 0
3 years ago
A three-point bending test was performed on an aluminum oxide specimen having a circular cross section of radius 3.5 mm (0.14 in
RideAnS [48]

To resolve this problem we have,

R=3.5mm\\F_f1=950N\\L_1=50mm\\b=12mm\\L_2=40mm

F_{f2} is unknown.

With these dates we can calculate the Flexural strenght of the specimen,

\sigma{fs}=\frac{F_{f1}L}{\pi R^3}\\\sigma{fs}=\frac{(950)(50*10^{-3})}{\pi 3.5*10^{-3}}\\\sigma{fs}=352.65Mpa

After that, we can calculate the flexural strenght for the square cross section using the previously value.

\sigma{fs}=\frac{F_{f2}L}{\pi R^3}\\(352.65*10^6)=\frac{3Ff(40*10^{-3})}{2(12*10^{-10})}\\F_{f2}=\frac{352.65*10^6}{34722.22}\\F_{f2}=10156.32N\\F_{f2}=10.2kN

6 0
4 years ago
Other questions:
  • A force is specified by the vector F= 160i + 80j + 120k N. Calculate the angles made by F with the positive x-, y-, and z-axis.
    9·1 answer
  • Air at 293k and 1atm flow over a flat plate at 5m/s. The plate is 5m wide and 6m long. (a) Determine the boundary layer thicknes
    14·1 answer
  • When subject to an unknown torque, the shear stress in a 2 mm thick rectangular tube of dimension 100 mm x 200 mm was found to b
    12·1 answer
  • A 240 V, 60 Hz squirrel-cage induction motor has a full-load slip of 0.02 and a full-load speed of 1764 rpm. The winding resista
    13·1 answer
  • Water is the working fluid in an ideal Rankine cycle. Saturated vapor enters the turbine at 12 MPa, and the condenser pressure i
    8·2 answers
  • The streamlines for an incompressible, inviscid, two dimensional flow field are all concentric circles, and the velocity varies
    8·1 answer
  • A 10-mm steel drill rod was heat-treated and ground. The measured hardness was found to be 290 Brinell. Estimate the endurance s
    14·1 answer
  • Design a solid steel shaft to transmit 14 hp at a speed of 2400rpm f the allowable shearing stress is given as 3.5 ksi.
    10·1 answer
  • Which one of the following statements belt batter boards is correct
    15·2 answers
  • Which of the following best describes maintenance?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!