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
Select the correct answer.
Ulleksa [173]
The answer is A. Immediately inform her colleague
4 0
2 years ago
The loneliest people are to kindest
valkas [14]

Answer:

The most damaged people are the wisest is a fact

Explanation:

5 0
3 years ago
Read 2 more answers
Calculate the wire pressure for a round copper bar with an original cross-sectional area of 12.56 mm2 to a 30% reduction of area
dybincka [34]

Answer:153.76 MPa

Explanation:

Initial Area\left ( A_0\right )=12.56 mm^2

Final Area\left ( A_f\right )=0.7\times 12.56 mm^2=8.792 mm^2

Die angle=30^{\circ}

\alpha =\frac{30}{2}=15^{\circ}

\mu =0.08

Yield stress\left ( \sigma _y \right )=350 MPa

B=\mu cot\left ( \aplha\right )=0.2985

\sigma _{pressure}=\sigma _y\left [\frac{1+B}{B}\right ]\left [ 1-\frac{A_f}{A_0}\right ]^B

\sigma _{pressure}=350\left [\frac{1+0.2985}{0.2985}\right ]\left [ 1-\frac{8.792}{12.56}\right ]^{0.2985}

\sigma _{pressure}=153.76 MPa

8 0
2 years ago
A cantilever beam of length L = 70 in is made from two side-by-side structural-steel channels of size 3 in weighing 5.0 lbf/ft.
natali 33 [55]

Answer:

of 5 lb/ft and a concentrated service live load at midspan. .... length = 12 feet) to support a uniformly distributed load. Taking ... w 7..'{ 'f.- ~ s-·. 344 ft-kip. Fy : s-o ks I. 299 ft-kip. Li.. ::::- I 2.. }-t-. 150 ft-kip ..... The concrete and reinforcing steel properties are ... Neglecting beam self-weight . and based only on the ...... JI : Lf, 2. l.. ;VI.

Explanation:

6 0
3 years ago
How are project deliverables determined?
Greeley [361]

Answer:

The essence including its problem is listed throughout the clarification section following.

Explanation:

Projects build deliverable that seem to be the products of the venture or indeed the implementation of the project. This ensures that perhaps the agile methodology may be as broad as either the goal of the study itself as well as the coverage that would be part of a much larger venture.

For every other production to have been marked as "deliverable" within the same project, this should satisfy a few eligibility requirements:

  • It should be within the development of the work.
  • The interested parties-external or internal-must consent to the above. This is perhaps the product of hard effort.

So that the above seems to be the right answer.

7 0
3 years ago
Read 2 more answers
Other questions:
  • Air flows through a device such that the stagnation pressure is 0.4 MPa, the stagnation temperature is 400°C, and the velocity i
    8·1 answer
  • Use the map to complete the table by selecting the boxes that best describe how ocean currents affect the
    14·1 answer
  • Problem 4.041 SI Refrigerant 134a enters an insulated compressor operating at steady state as saturated vapor at -26oC with a vo
    8·1 answer
  • # 17
    13·2 answers
  • Both equilibrium equations and constitutive models are needed to solve statically indeterminate problems. a)- True b)-False
    13·1 answer
  • A force is a push or pull in? A.a circle B.an arc C.a straight line
    5·1 answer
  • What is this i dont understand this at all
    9·1 answer
  • Your friend has two substances A and B which are compressed liquid and superheated vapor respectively. Both are in rigid vessels
    15·1 answer
  • If the 2007 recession affected the green building materials market less seriously than other parts of the construction market, t
    12·2 answers
  • 3. What is special about beryllium-copper alloy tools?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!