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 cylindrical aluminum core is surrounded by a titanium sleeve, and both are attached at each end to a rigid end-plate. Set up t
NeX [460]

Complete Question

The complete question is shown on the first uploaded image

Answer:

a) The elongation of the composite bar is given as δ = 0.072 in

b) The axial stress induced in each material is = 5485.7 psi

Explanation:

The explanation to the answer above is shown on the second uploaded image

3 0
2 years ago
(35-39) A student travels on a school bus in the middle of winter from home to school. The school bus temperature is 68.0° F. Th
arlik [135]

Answer:

The net energy transfer from the student's body during the 20-min ride to school is 139.164 BTU.

Explanation:

From Heat Transfer we determine that heat transfer rate due to electromagnetic radiation (\dot Q), measured in BTU per hour, is represented by this formula:

\dot Q = \epsilon\cdot A\cdot \sigma \cdot (T_{s}^{4}-T_{b}^{4}) (1)

Where:

\epsilon - Emissivity, dimensionless.

A - Surface area of the student, measured in square feet.

\sigma - Stefan-Boltzmann constant, measured in BTU per hour-square feet-quartic Rankine.

T_{s} - Temperature of the student, measured in Rankine.

T_{b} - Temperature of the bus, measured in Rankine.

If we know that \epsilon = 0.90, A = 16.188\,ft^{2}, \sigma = 1.714\times 10^{-9}\,\frac{BTU}{h\cdot ft^{2}\cdot R^{4}}, T_{s} = 554.07\,R and T_{b} = 527.67\,R, then the heat transfer rate due to electromagnetic radiation is:

\dot Q = (0.90)\cdot (16.188\,ft^{2})\cdot \left(1.714\times 10^{-9}\,\frac{BTU}{h\cdot ft^{2}\cdot R^{4}} \right)\cdot [(554.07\,R)^{4}-(527.67\,R)^{4}]

\dot Q = 417.492\,\frac{BTU}{h}

Under the consideration of steady heat transfer we find that the net energy transfer from the student's body during the 20 min-ride to school is:

Q = \dot Q \cdot \Delta t (2)

Where \Delta t is the heat transfer time, measured in hours.

If we know that \dot Q = 417.492\,\frac{BTU}{h} and \Delta t = \frac{1}{3}\,h, then the net energy transfer is:

Q = \left(417.492\,\frac{BTU}{h} \right)\cdot \left(\frac{1}{3}\,h \right)

Q = 139.164\,BTU

The net energy transfer from the student's body during the 20-min ride to school is 139.164 BTU.

7 0
2 years ago
Suppose there are 76 packets entering a queue at the same time. Each packet is of size 5 MiB. The link transmission rate is 2.1
tia_tia [17]

Answer:

938.7 milliseconds

Explanation:

Since the transmission rate is in bits, we will need to convert the packet size to Bits.

1 bytes = 8 bits

1 MiB = 2^20 bytes = 8 × 2^20 bits

5 MiB = 5 × 8 × 2^20 bits.

The formula for queueing delay of <em>n-th</em> packet is :  (n - 1) × L/R

where L :  packet size = 5 × 8 × 2^20 bits, n: packet number = 48 and R : transmission rate =  2.1 Gbps = 2.1 × 10^9 bits per second.

Therefore queueing delay for 48th packet = ( (48-1) ×5 × 8 × 2^20)/2.1 × 10^9

queueing delay for 48th packet = (47 ×40× 2^20)/2.1 × 10^9

queueing delay for 48th packet = 0.938725181 seconds

queueing delay for 48th packet = 938.725181 milliseconds = 938.7 milliseconds

4 0
3 years ago
PLEASE HELP QUICK!!
ivolga24 [154]

R01= 14.1 Ω

R02=  0.03525Ω

<h3>Calculations and Parameters</h3>

Given:

K= E2/E1 = 120/2400

= 0.5

R1= 0.1 Ω, X1= 0.22Ω

R2= 0.035Ω, X2= 0.012Ω

The equivalence resistance as referred to both primary and secondary,

R01= R1 + R2

= R1 + R2/K2

= 0.1 + (0.035/9(0.05)^2)

= 14.1 Ω

R02= R2 + R1

=R2 + K^2.R1

= 0.035 + (0.05)^2 * 0.1

= 0.03525Ω

Read more about resistance here:

brainly.com/question/17563681

#SPJ1

5 0
1 year ago
A pumping test was made in pervious gravels and sands extending to a depth of 50 ft. ,where a bed of clay was encountered. The n
Vikki [24]

Answer:per minute from the pumping well, a steady state was attained in about 24 hr. The draw-down at a distance of 10 ft. was 5.5 ft. and at 25 ft. was 1.21 ft.

Explanation:

6 0
2 years ago
Other questions:
  • Twenty-five wooden beams were ordered or a construction project. The sample mean and he sample standard deviation were measured
    6·1 answer
  • Air enters a horizontal, constant-diameter heating duct operating at steady state at 290 K, 1 bar, with a volumetric flow rate o
    15·2 answers
  • Heat in the amount of 100 kJ is transferred directly from a hot reservoir at 1200 K to a cold reservoir at 600 K. Calculate the
    15·1 answer
  • Which of the following has nothing to do with insulating glass? Group of answer choices
    10·2 answers
  • (d) Suppose two students are memorizing a list according to the same model dL dt = 0.5(1 − L) where L represents the fraction of
    6·1 answer
  • Compute the volume percent of graphite, VGr, in a 3.2 wt% C cast iron, assuming that all the carbon exists as the graphite phase
    8·1 answer
  • A Gaussian random voltage X volts is input to a half-wave rectifier and the output voltage is Y = Xu (X) Volts were u (x) is the
    9·1 answer
  • A 300-ft long section of a steam pipe with an outside diameter of 4 in passes through an open space at 50oF. The average tempera
    12·1 answer
  • A front wheel drive vehicle with four wheel disc brakes is pulling to the left. Tech A says an external kink or internal restric
    13·1 answer
  • What is the minimum clamp time for gluing a panel?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!