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
What term refers to the text label that describes each data series?
lbvjy [14]
Field is the term that refers to the text label that describes each data series
7 0
3 years ago
Complete two examples of how scientists, technologists, engineers, and mathematicians may work together to create a new product
asambeis [7]

Answer:

By thinking of ways to create environment friendly products such as biodegradable water bottles

3 0
3 years ago
Fatima wants to compose and send an email in Outlook. Order the steps she needs to follow to do this task.
Tomtit [17]

Answer:

The steps that Fatima needs to follow in-order to send an email on the Outlook include:

1. Open the Outlook application.

2. Under the Home tab, click the New Email button.

3. Click the To button to choose a contact

4. Click the Send button after typing the message.

Explanation:

For every new email to be sent out through the Outlook, there are steps to follow like ensuring that the Outlook application is appropriately opened. Later, a<em><u> tab showing new email should be clicked to open the dialogue box for typing the email message.</u></em>

<em>After the message has been typed, a contact to whom the message is going to be sent to is selected before actually sending out the message by a click of a button.</em>

7 0
3 years ago
Read 2 more answers
How can a system of AI be implemented in the universities
murzikaleks [220]
Organizations in different industries are using artificial intelligence (AI), machine learning, and data science to uncover deep insights about their processes and procedures and make predictions that will help them allocate resources and increase productivity. Universities, like other businesses, need to do the same to best serve their students and protect their bottom line.

AI can help universities predict, for example:

The probability that a prospective student will apply for a particular program
The probability that the prospective student will pass the preliminary admission screening
The probability that an accepted student to actually enroll
How likely it is that a student will be at risk
Which jobs students should apply for
The likelihood that an alumnus / alumna will donate to the university
In a marketing use case, the university can build a model to predict whether a prospective student will apply. The prediction would be based on interaction data including the following:

How they arrived at the university website
Which pages they visited
Which buttons they clicked
How long they spent on the site
Whether they tried to apply but didn’t submit
What location they visited the university website from
For prospective students who have a high probability of applying, the university can do some follow-up to encourage them to submit their applications. This can increase the marketing conversion rate and make the university more cost-effective.

AI is also useful after the university receives applications. It can help identify which applications will pass a preliminary admissions screen. This allows the university to accept more applications while keeping the same number of people working on the admissions process. AI can help at the preliminary stage, allowing staff to focus on the following admissions stages.

After the university decides which prospective students to accept, not all accepted students will actually enroll. This challenge can directly affect the university revenue. Low enrollment rate means that the university needs to take more efforts to get more students in limited time. While a high enrollment rate can cause a capacity problem which is additional cost to the university for providing extra resources to assist more students. AI can help to predict which accepted students are going to enroll so that the university can have a better preparation for the next intake in terms of dorm space, classes needed, and other resources.

After the students enroll in the university program, the performance of these students will affect the university’s reputation, for better or for worse. The admissions process helps to identify promising students. However, everything can change over the course of a college career, including the students themselves. It is essential for the university to track their students’ progress so they can pinpoint those who are at risk of failing one or more courses and determine what kind of assistance they need to graduate. The increased graduation rate can help the university improve its reputation and increase its accreditation, which can attract more students. Florida International University is an example of a university that has already implemented AI to predict and help students at risk.

After graduation, the university can continue to help students with their employment by building models that recommend to them specific jobs based on job requirements, the student’s profile, behavior, and academic performance history. By helping students get jobs fast, students enter the workforce successfully, industries benefit, and universities fulfill their missions of helping students build on their academic careers.

The downstream effect is that many grateful alumni want to give back to the university. But sometimes they don’t know how. For their part, universities have so many alumni, and it’s difficult for the institution to keep in contact with all of them. AI can help universities predict which alumni to target for donation based on demographic data, records of recent interactions, and their relationship with the university.

These are just a few examples of how using AI and machine learning can help bring value to universities. There are other use cases as well, such as how to match students with lecturers or academic advisors, how to select students to receive scholarships, which elective courses to recommend to students, how to predict student retention and which students will fail. When it comes to using AI to optimize the university experience, the possibilities are virtually limitless.

3 0
2 years ago
9. Which of the following prefixes which relate to bytes are arranged from the smallest to the largest? a) mega, giga, tera, kil
dem82 [27]

Answer:

Explanation:

C

kilo = 1000

mega = 1,000,000

giga = 1 billion = 1 000 000 000

tera = 1 trillion = 1 000 000 000  000

6 0
3 years ago
Other questions:
  • Under what circumstances would a user bebetter off using a time-sharing system rather than a PC or asingle-user workstation?
    13·1 answer
  • ammy's Seashore Supplies rents beach equipment such as kayaks, canoes, beach chairs, and umbrellas to tourists. Write a program
    13·1 answer
  • Shipments of compact digital cameras dropped by 42% due to the industry being unable to adjust to changes in the ________. a. ec
    11·1 answer
  • 4.2 lesson practice helps plzs
    9·1 answer
  • Dani wants to create a web page to document her travel adventures. Which coding language should she use?
    11·2 answers
  • Which XXX will prompt the user to enter a value greater than 10, until a value that is greater than 10 is actually input?
    14·1 answer
  • What is the function of this logical comparator! =?
    8·1 answer
  • 5. In which of the following stages of the data mining process is data transformed to
    9·1 answer
  • Three reasons why users attach speakers to their computer
    8·1 answer
  • Data becomes _____ when it is presented in a context so that it can answer a question or support decision makin
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!