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
A clay sample has a wet mass of 417 g, a volume of 276 cm3, and a specific gravity of 2.70. When oven dried, the mass becomes 22
nataly862011 [7]

Answer:

a. WATER CONTENT.

mass of water (MW)= 417g - 225g

Mw= 192g

M= (Mw / Ms)

M= [192/417]

M= 0.46

M= 46.0%

b. Void Ration (e)

To calculate the void ratio we must first calculate the volume of solids. Then we can find the volume of voids by subtracting the volume of solids from the total volume.

Ps= (Ms/Vs)=GsPw

Therefore

Vs= (Ms/GsPw)

Vs= (417/ 2.70*1000)

Vs= 0.154cm3

But V= Vv+Vs

Vv=V-Vs

e= (Vv/Vs)

8 0
3 years ago
Instructions: For each problem, identify the appropriate test statistic to be use (t test or z-test). Then compute z or t value.
Natalka [10]

The sample of 81 students was selected with a mean score of 90, this illustrates an example of a right tailed one sample z test.

<h3>How to illustrate the sample?</h3>

From the information given, the teacher claims that the mean score of students in his class is greater than 82 with a standard deviation of 20. In this case, the right tailed one sample z test is used.

The z value will be:

= (90 - 82)/20/✓81

= 3.6

Since 3.6 > 1.645, the null hypothesis will be rejected as there's enough evidence to support the teacher's claim.

When an online medicine shop claims that the mean delivery time for medicines is less than 120 minutes with a standard deviation of 30 minutes, the left tailed one sample test is used.

The z value will be:

= (100 - 120)/(30/✓49)

= -4.66

The null hypothesis is rejected as there is enough evidence to support the claim of the medicine shop.

Learn more about sampling on:

brainly.com/question/17831271

#SPJ1

6 0
2 years ago
The 240-ft structure is used to provide various support services to launch vehicles prior to liftoff. In a test, a 12-ton weight
alina1380 [7]

Answer:

hello your question lacks the required question attached below is the missing diagram

Forces in GJ = -4.4444 i.e. 4.4444 tons

Forces in IG = 15.382 tons ( T )

Explanation:

Forces in GJ = -4.4444 i.e. 4.4444 tons

Forces in IG = 15.382 tons ( T )

attached below is the detailed solution

3 0
3 years ago
Design roller chain drive. Specify the chain size, the sizes and number of teeth in the sprockets, the number of chain pitches,
Rom4ik [11]

Answer:

The total design can be summarized as follows:

AC motor 55 hp, 750 rpm  as a driver

Service factor 1.0

Design power 5 hp

No. 40 chain, 0.50 in pitch, 1 strands

17 teeth, 2.72 in pitch dia, 1 strand small sprocket

39 teeth, 7.46 in pitch dia, 1 strand large sprocket

1 strand of length 54 in

Center distance of 19.9 in

Actual Output speed of 326.9 rpm

Type B lubrication

Explanation:

4 0
3 years ago
Sedimentary rock forms at or near the
Natalija [7]
I believe it’s A bit I. could be wrong
5 0
3 years ago
Read 2 more answers
Other questions:
  • 6. What are the potential consequences if a business does not follow regulations? (1 point)
    13·1 answer
  • Calculate the convective heat-transfer coefficient for water flowing in a round pipe with an inner diameter of 3.0 cm. The water
    8·1 answer
  • Sam promises to pay Sandy $2,000 in four years and another $3,000 four years later for a loan of $2,000 from Sandy today. What i
    8·1 answer
  • Define the Artist class in Artist.py with a constructor to initialize an artist's information. The constructor should by default
    7·1 answer
  • 1.<br> Defensive driving involves?
    14·1 answer
  • Consider that a system has two entities, Students, Instructors and Course. The Student has the following properties: student nam
    12·1 answer
  • Henry is given a task to divide a segment into six equal parts, using a triangle and a compass. How many arcs would he need to c
    10·1 answer
  • Which color is used to indicate that a wire will be energized when power is brought to the circuit
    13·1 answer
  • Pleaseee help! 100 points!!!!!!!!!!!!!! geometry angles in parallel lines question.
    8·1 answer
  • 1. a major reason for the projected shortage of trained craft professionals is
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!