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
mr_godi [17]
3 years ago
6

Choose the best type of loop for each situation.

Computers and Technology
1 answer:
matrenka [14]3 years ago
7 0

Answer:

1. Option A: for loop is correct

2. Option B: while loop is correct

Explanation:

Two loops are used commonly. For and while

For is used when the number of iterations are already known and while is used when number of iterations is not known and the loop has to be terminated based on any condition.

<u>1. You are finding the batting average of 13 baseball players. </u>

For loop will be used as the number of iterations is already known. The score of 13 players has to be used to calculate the average so there will be 13 iterations. Hence, for loop will be used.

<u>2. You are asking your users for the names of all the stores where they shopped to find their friend's birthday  present. They will show they are done by entering the word "done."</u>

While loop will be used as the termination of loop depends on the input given by the user so the number of iterations are not already known.

Hence,

1. Option A: for loop is correct

2. Option B: while loop is correct

You might be interested in
I need an answer and fast What happens if a sequence is out of order?
horsena [70]

Answer:

i would say A

hope i helped <3

Explanation:

4 0
3 years ago
Read 2 more answers
Create an array of 10 fortune cookie sayings that will be randomly displayed each time the user reloads the page. The fortune wi
vfiekz [6]

Answer:

let cookieNumber = Math.floor(Math.random() * 10)

switch (cookieNumber) {

  case 1:

   document.write('Fortune 1')

   break;

  case 2:

   document.write('Fortune 2')

   break;

   case 3:

   document.write('Fortune 3')

   break;

  case 4:

   document.write('Fortune 4')

   break;

  case 5:

   document.write('Fortune 5')

   break;

  case 6:

   document.write('Fortune 6')

   break;

  case 7:

   document.write('Fortune 7')

   break;

  case 8:

   document.write('Fortune 8')

   break;

  case 9:

   document.write('Fortune 9')

   break;

  case 10:

   document.write('Fortune 10')

Explanation:

The cookieNumber is generated using Math.random(), which is rounded to a whole number using Math.floor(). Then, a switch block is used to display a different fortune depending on the value of cookieNumber.

4 0
2 years ago
You are responsible for the administration of your Windows Server 2016 DNS server, which is installed on a domain controller as
kvv77 [185]

Answer:

A. domain adminsb because maybe it might be the right answer.

8 0
3 years ago
How does this happen on brainly????
Trava [24]

what do you mean????

4 0
2 years ago
Read 2 more answers
What software tool can you use to see the applications that are currently running?
Soloha48 [4]

Answer:

You can use the task manager to see what programs are currently running.

Explanation:

7 0
2 years ago
Read 2 more answers
Other questions:
  • Which hypervisor works on older pcs without hardware virtualization support?
    9·2 answers
  • When a user runs an application, what transfers from a storage device to memory?
    8·1 answer
  • Ideally an entity identifier is composed of _____ attribute(s).
    11·1 answer
  • Communications that take the form of electronic junk mail or unsolicited e-mail are referred to as
    13·2 answers
  • To close the ____ view, click File on the Ribbon or click the preview of the document in the Info gallery to return to the docum
    9·1 answer
  • A Silicon Valley billionaire purchases 3 new cars for his collection at the end of every month. Let a_n denote the number of car
    8·1 answer
  • Businesses use spreadsheets to keep track of financial________.
    14·1 answer
  • A computer processes data using only 1s and 0s true or false?
    9·2 answers
  • Implement the function printTwoLargest that inputs an arbitrary number of positive numbers from the user. The input of numbers s
    14·1 answer
  • Role of memory in a computer system
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!