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
SVEN [57.7K]
4 years ago
14

1)

Computers and Technology
1 answer:
spayn [35]4 years ago
4 0

Answer:

1)

for(i = 0; i < NUM_VALS; ++i) {

  if(userValues[i] == matchValue) {

     numMatches++;  }    }

2)  

for (i = 0; i < NUM_GUESSES; i++) {

      scanf("%d", &userGuesses[i]);   }

  for (i = 0; i < NUM_GUESSES; ++i) {

         printf("%d ", userGuesses[i]);    }

3)

sumExtra = 0;

for (i = 0; i < NUM_VALS; ++i){

     if (testGrades[i] > 100){  

        sumExtra = testGrades[i] - 100 + sumExtra;    }       }

4)

for (i = 0; i < NUM_VALS; ++i) {

    if (i<(NUM_VALS-1))  

   printf( "%d,", hourlyTemp[i]);

    else  

    printf("%d",hourlyTemp[i]); }      

Explanation:

1) This loop works as follows:

1st iteration:

i = 0

As i= 0 and NUM_VALS = 4 This means for condition i<NUM_VALS  is true so the body of loop executes

if(userValues[i] == matchValue) condition checks if element at i-th index position of userValues[] array is equal to the value of matchValue variable. As matchValue = 2 and i = 0 So the statement becomes:

userValues[0] == 2

2 == 2

As the value at 0th index (1st element) of userValues is 2 so the above condition is true and the value of numMatches is incremented to 1. So numMatches = 1

Now value of i is incremented to 1 so i=1

2nd iteration:

i = 1

As i= 1 and NUM_VALS = 4 This means for condition i<NUM_VALS  is true so the body of loop executes

if(userValues[i] == matchValue) condition checks if element at i-th index position of userValues[] array is equal to the value of matchValue variable. As matchValue = 2 and i = 1 So the statement becomes:

userValues[1] == 2

2 == 2

As the value at 1st index (2nd element) of userValues is 2 so the above condition is true and the value of numMatches is incremented to 1. So numMatches = 2

Now value of i is incremented to 1 so i=2

The same procedure continues at each iteration.

The last iteration is shown below:

5th iteration:

i = 4

As i= 4 and NUM_VALS = 4 This means for condition i<NUM_VALS  is false so the loop breaks

Next the statement: printf("matchValue: %d, numMatches: %d\n", matchValue, numMatches);  executes which displays the value of

numMatches = 3

2)

The first loop works as follows:

At first iteration:

i = 0

i<NUM_GUESSES is true as NUM_GUESSES = 3 and i= 0 so 0<3

So the body of loop executes which reads the element at ith index (0-th) index i.e. 1st element of userGuesses array. Then value of i is incremented to i and i = 1.

At each iteration each element at i-th index is read using scanf such as element at userGuesses[0], userGuesses[1], userGuesses[2]. The loop stops at i=4 as i<NUM_GUESSES evaluates to false.

The second loop works as follows:

At first iteration:

i = 0

i<NUM_GUESSES is true as NUM_GUESSES = 3 and i= 0 so 0<3

So the body of loop executes which prints the element at ith index (0-th) index i.e. 1st element of userGuesses array. Then value of i is incremented to i and i = 1.

At each iteration, each element at i-th index is printed on output screen using printf such as element at userGuesses[0], userGuesses[1], userGuesses[2] is displayed. The loop stops at i=4 as i<NUM_GUESSES evaluates to false.

So if user enters enters 9 5 2, then the output is 9 5 2

3)

The loop works as follows:

At first iteration:

i=0

i<NUM_VALS is true as NUM_VALS = 4 so 0<4. Hence the loop body executes.

if (testGrades[i] > 100 checks if the element at i-th index of testGrades array is greater than 100. As i=0 so this statement becomes:

if (testGrades[0] > 100

As testGrades[0] = 101 so this condition evaluates to true as 101>100

So the statement sumExtra = testGrades[i] - 100 + sumExtra; executes which becomes:

sumExtra = testGrades[0] - 100 + sumExtra

As sumExtra = 0

testGrades[0] = 101

So

sumExtra = 101 - 100 + 0

sumExtra = 1

The same procedure is done at each iteration until the loop breaks. The output is:

sumExtra = 8

4)

The loop works as follows:

At first iteration

i=0

i < NUM_VALS is true as  NUM_VALS = 4 so 0<4 Hence loop body executes.

if (i<(NUM_VALS-1))   checks if i is less than NUM_VALS-1 which is 4-1=3

It is also true as 0<3 Hence the statement in body of i executes

printf( "%d,", hourlyTemp[i]) statement prints the element at i-th index i.e. at 0-th index of hourlyTemp array with a comma (,) in the end. As hourlyTemp[0] = 90; So 90, is printed.

When the above IF condition evaluates to false i.e. when i = 3 then else part executes which prints the hourlyTemp[3] = 95 without comma.

Same procedure happens at each iteration unless value of i exceeds NUM_VAL.

The output is:

90, 92, 94, 95

The programs along with their output are attached.

You might be interested in
WHO GIVE THE CONCEPT OF INTERNET?
viktelen [127]
Google, Apple, or even Dell
6 0
3 years ago
Which option can you use to control how text flows around a graphic?
Art [367]

Answer:

I believe your answer is C: Wrap Text

Explanation:

If you are trying to put an image in a more specific placement you would use Wrap Text. It helps making the image more clear and understandable because without wrapping the text it wouldnt make any sense and it would just be plain.

Hope this helps

3 0
3 years ago
Read 2 more answers
Directions: Fill in the blanks with the appropriate word in each statement below.
mart [117]

Answer:

sbysgscd CD CD vdhdudiididjehgegeueuheve gf hdgowincobwbciehidgwdgiwigwdigxifqugwljvwvwxi2dvwvwxixwvwxvqvwivqi

xwv2digwxivwiw

wxvixbowowxowcohwco2ch2od

odhowhowcowcohwxohwdowdjeciwr

hiwdodwobwdvqoo230ie

9qhowwdhwdigwdoieexohxiefbeoc

hwdhefgdegedogex

Explanation:

9hwx9hex9hexobeb8xgx9jcr

jd2oh2ih2xi2dd2oxivqsg8xwohjgwxohdeohwxihwdoeciwxgiweiguofyoe5u5ew46w57lrroyvyreiyfe1ei2ei2idxwdooydyofpiwigpwxwduo1zuo1dif3o4y

2hupv2rxou2xu2du2d

ou1svxiexuowvouqdip2dpwcuowd2u

qxigqedouovqudipgqipwgipcwpi2di2ipegpi2efpi2dipe2ip1dgxip2ce1piecg1peix1ou2co2dpu1ecgip1eip1deg1euouoeupdeuofour68ditsoysrs27ro457uoeigpexupgeip3dpiwdguof<em>o</em><em>y</em><em>i</em><em>y</em><em>y</em><em>i</em><em>d</em><em>i</em><em>y</em><em>u</em><em>f</em><em>u</em><em>o</em><em>u</em><em>o</em><em>d</em><em>y</em><em>i</em><em>d</em><em>y</em><em>o</em><em>u</em><em>o</em><em><u>o</u></em><em><u>u</u></em><em><u>u</u></em><em><u>p</u></em><em><u>w</u></em><em><u>d</u></em><em><u>9</u></em><em><u>d</u></em><em><u>e</u></em><em><u>d</u></em><em><u>i</u></em><em><u>w</u></em><em><u>g</u></em><em><u>i</u></em><em><u>p</u></em><em><u>2</u></em><em><u>s</u></em><em><u>o</u></em><em><u>u</u></em><em><u>2</u></em><em><u>s</u></em><em><u>g</u></em><em><u>9</u></em><em><u>2</u></em><em><u>3</u></em><em><u>u</u></em><em><u>g</u></em><em><u>o</u></em><em><u>1</u></em><em><u>3</u></em><em><u>u</u></em><em><u>e</u></em><em><u>f</u></em><em>c</em><em>i</em><em>d</em><em>y</em><em>i</em><em>d</em><em>5</em><em>7</em><em>g</em><em>d</em><em>q</em><em>i</em><em>g</em><em>e</em><em>o</em><em>b</em><em>x</em><em>r</em><em>i</em><em>1</em><em>e</em><em>i</em><em>y</em><em>f</em><em>2</em><em>i</em><em>p</em><em>e</em><em>c</em><em>h</em><em>k</em><em>c</em><em>y</em><em>i</em><em>d</em><em>o</em><em>u</em><em>x</em><em>t</em><em>u</em><em>x</em><em>u</em><em>o</em><em>c</em><em>z</em><em>i</em><em>y</em><em>c</em><em>y</em><em>i</em><em>y</em><em>y</em><em>i</em><em>y</em><em>i</em><em>y</em><em>2</em><em>i</em><em>d</em><em>y</em><em>i</em><em>g</em><em>x</em><em>y</em><em>i</em><em>y</em><em>i</em>yiydiyyiiyciyc2ouvyidyiyidydyidiyf7uo2vu1e

8 0
3 years ago
A series of gentle often open-ended inquiries that allow the client to progressively examine the assumptions and interpretations
Setler [38]

Answer:

Trauma Narrative

Explanation:

Given that Trauma narrative is a form of narrative or carefully designed strategy often used by psychologists to assists the survivors of trauma to understand the meaning or realization of their experiences. It is at the same time serves as a form of openness to recollections or memories considered to be painful.

Hence, A series of gentle often open-ended inquiries that allow the client to progressively examine the assumptions and interpretations he or she is made about the victimization experience is called TRAUMA NARRATIVE

6 0
3 years ago
What is the Dock?
Umnica [9.8K]
The place where most commonly used applications reside
3 0
3 years ago
Other questions:
  • 5 What is the effect of the author proposing athought experiment at the beginning of the text? ​
    5·2 answers
  • You need to set up a network that needs to span multibple buildings. For this reason, you want to use the cabling that supports
    10·1 answer
  • How would you define a relational database ?
    12·1 answer
  • 3. Which one of the following statements is correct? _____ variables are those whose storage bindings are created when their dec
    12·1 answer
  • A wireless engineere has an access point using 5.725-ghz channel in the united states. In which band is the AP operating?
    9·1 answer
  • All of the following are strategies to help you prepare for standardized test except <br>​
    5·1 answer
  • What are some of these new iPad extras? One is the iMarker. Crayola teamed up with another company to make it. It costs $29.99.
    8·1 answer
  • Describe how a cell’s content and format attributes are related.
    13·2 answers
  • Binary search takes a list of information and divides the list into two parts, one is divided and one is kept.
    15·1 answer
  • Describe how data is transmitted using half-duplex serial data transmission.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!