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
Coal fire burning at 1100 k delivers heat energy to a reservoir at 500 k. Find maximum efficiency.
Marizza181 [45]

Answer:

<em>55%</em>

Explanation:

hot reservoir = 1100 K

cold reservoir = 500 K

<em>This is a Carnot system</em>

For a Carnot system, maximum efficicency of the system is given as

Eff = 1 - \frac{Tc}{Th}

where Tc = temperature of cold reservoir = 500K

Th = temperature of hot reservoir = 1100 K

Eff = 1 - \frac{500}{1100}

Eff = 1 - 0.45 = 0.55 or<em> 55%</em>

7 0
3 years ago
Design for human-fit strategies include:
andreev551 [17]

Answer:

B- extreme fit, close fit, adjustable fit

Explanation:

A human-fit design typically involves the process of manufacturing or producing products (tools) that are easy to use by the end users. Therefore, human-fit designs mainly deals with creating ideas that makes the use of a particular product comfortable and convenient for the end users.

The design for human-fit strategies include; extreme fit, close fit and adjustable fit.

Hence, when the aforementioned strategies are properly integrated into a design process, it helps to ensure the ease of use of products and guarantees comfort for the end users.

5 0
3 years ago
QUESTÃO 13. Explique o uso das aspas no trecho "Darei a cada uma de vocês
lesya [120]

Answer: speaks Portuguese

Eu disse a todos a tradução para que possam te ajudar

Explanation: Y’all can help I have no idea

QUESTION 13. Explain the use of quotation marks in the excerpt "I will give each of you

seed. The one who will bring me the most beautiful flower within six months will be chosen but

wife and the future empress of China. ".

QUESTION 14. The palace servant considered the idea of ​​her daughter attending the celeb

organized by the prince of the region, a foolish idea, a madness. This is an OP

Do you agree with this opinion of the character? Justify your answer.

6 0
3 years ago
Radioactive wastes generating heat at a rate of 3 x 106 W/m3 are contained in a spherical shell of inner radius 0.25 m and outsi
MariettaO [177]

Answer:

Inner surface temperature= 783K.

Outer surface temperature= 873K

Explanation:

Parameters:

Heat,e= 3×10^6 W/m^3

Inner radius = 0.25 m

Outside radius= 0.30 m

Temperature at infinity, T(¶)= 10°c = 273. + 10 = 283K.

Convection coefficient,h = 500 W/m^2 . K

Temperature of the surface= T(s) = ?

Temperature of the inner= T(I) =?

STEP 1: Calculate for heat flux at the outer sphere.

q= r × e/3

This equation satisfy energy balance.

q= 1/3 ×3000000(W/m^3) × 0.30 m

= 3× 10^5 W/m^2.

STEP 2: calculus the temperature for the surface.

T(s) = T(¶) + q/h

T(s) = 283 + 300000( W/m^2)/500(W/m^2.K)

T(s) = 283+600

T(s)= 873K.

TEMPERATURE FOR THE OUTER SURFACE is 873 kelvin.

The same TWO STEPS are use for the calculation of inner temperature, T(I).

STEP 1: calculate for the heat flux.

q= r × e/3

q= 1/3 × 3000000(W/m^3) × 0.25 m

q= 250,000 W/m^2

STEP 2:

calculate the inner temperature

T(I) = T(¶) + q/h

T(I) = 283K + 250,000(W/m^2)/500(W/m^2)

T(I) = 283K + 500

T(I) = 783K

INNER TEMPERATURE IS 783 KELVIN

5 0
3 years ago
Is it true or false that sometimes people except certain risks in exchange for other benefits
mixas84 [53]
Yes, they have to make certain sacrifices ! for many many benefits.
3 0
3 years ago
Other questions:
  • A mass of 0.3 kg is suspended from a spring of stiffness 0.4 N/mm. The damping is 3.286335345 kg/s. What is the undamped natural
    5·1 answer
  • Find the inductive reactance per mile of a single-phase overhead transmission line operating at 60 Hz, given the conductors to b
    6·1 answer
  • A proposed piping and pumping system has 20-psig static pressure, and the piping discharges to atmosphere 160 ft above the pump.
    8·1 answer
  • Why is it important to always be wearing a personal flotation device (PFD) when in or around the water?
    9·2 answers
  • Select the best answer for the question.
    11·2 answers
  • Order of Design Process steps ?
    13·1 answer
  • The _____ plane is the plane in which the side of an object appears in
    12·1 answer
  • Please look at the attachments and help me with these questions
    7·1 answer
  • How to clean a snowblower carburetor without removing it.
    11·1 answer
  • A school bus with its flashing red signals on has stopped on a non-divided highway; you must?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!