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
malfutka [58]
3 years ago
11

11.

Computers and Technology
1 answer:
kodGreya [7K]3 years ago
6 0

Answer:

The basic difference between finite and infinite is the number of times it runs and ends. The loop is basically a set of instructions that keeps repeating itself.

The finite loop ends after running for a finite times. This body of finite loop will stop executing after certain condition is reached. Hence the finite loop body keeps executing itself finite number of times.

An infinite loop keeps running and repeating itself endlessly.This loop never ends. This loop can be the result of an error in a program. For example when no stopping or exit condition is specified in the program.

Explanation:

Example of finite loop:

Lets take for loop as an example:

for(int i =0; i<=5; i++)

{ cout<<i<<endl; }

Now the loop starts from i=0

Next it enters the body of loop to execute the statement: cout<<i; which means that the value of i is displayed on the output screen.

This loop keeps executing until the value of i exceeds 5.

At first iteration 0 is printed on the output screen, at second iteration 1, at third iteration 2, at fourth iteration 3, fifth iteration 4, sixth iteration 5. After each of these iterations, the value of i is incremented by 1.

When 5 is printed, then at the next iteration the specified condition i.e. i<=5 gets false as the value of i now becomes 6 after incremented by 1.

So the loop stops running. So this means that loop ran for finite times and stopped after the a certain condition is reached. The output is:

0

1

2

3

4

5

Example of infinite loop:

Lets take while loop:

int i = 6;

    while (i >=5)

    {         cout<< i;

             i++;     }

In the above example, the loop will run infinite times. Here the value of i is initialized to 6. Then while loop is used which checks the condition which is the value of i is greater than or equal to 5. If the condition is true, the body of the loop starts executing which prints the value of i. Lets see what happens at each iteration:

1st iteration: i>=5 is True because i=6 and 6 is greater than 5. The program control enters the body of loop. The statement cout<<i prints 6. Next the value of i is incremented by 1 and it becomes 7.

2nd iteration: i>=5 is True because i=7 and 7 is greater than 5. The program control enters the body of loop. The statement cout<<i prints 7. Next the value of i is incremented by 1 and it becomes 8.

This loop will repeat itself infinite times and never stops as i will always have value greater than 5. So this is the example of infinite loop.

You might be interested in
Fill in the blanks, so the print statement displays the result of the function call in order.
sergejj [24]

Answer:

Rep;ace the blank with

smaller, bigger

So, the complete line is:

smaller,bigger=order_numbers(100,99)

Explanation:

From the question, we understand that the program is to return the order of a number from least to highest

This has been well implemented in order_numbers function

Because the order function returns two values, the order_function must be called in order to accept two values and the syntax is:

<em>value1,value2 = function(return-value1,return-value2)</em>

In this case, the statement is:

smaller,bigger=order_numbers(100,99)

So, in the next line of the main, the values of smaller and bigger are printed:

<em>print(smaller,bigger)</em>

See attachment

Download txt
8 0
3 years ago
write an expression taht evaluated to true if and only if the variable s does not contain the string 'end'
natima [27]

Answer:

//check which string is greater

if(strcmp(name1,name2)>0)

//assign name1 to first, if the

    //name1 is greater than name2

    first=name1;

else

    //assign name2 to first, if the

    //name2 is greater than name1

    first=name2;

5)

//compare name1 and name2

    if(strcmp(name1,name2)>0)

   

         //compare name1 and name3

         if(strcmp(name1,name3)>0)

       

             //assign name1 to max, becuase

             //name1 is greater than name2 and name3

             max=name1;

       

Explanation:

7 0
2 years ago
The five types of personal computers are: desktops, laptops, tablets, smartphones, and
shepuryov [24]

Answer:

microcomputers

Explanation:

8 0
3 years ago
Read the description of Mike’s work, and identify his profession. Mike’s job is to record sounds in a studio. He studies a video
kipiarov [429]
Mike is a Sound Engineer
7 0
2 years ago
Read 2 more answers
Why is it important to identify cables and conductors?​
nlexa [21]

Answer:

While we almost never get to see most of the cables, they power everything so it only makes sense that you should know what the different types of cables and wires are, so that you can pick accordingly and have your equipment, devices and appliances powered properly.

It is also important to identify cables and conductors for safety purposes, such as emergencies linked with electricity.

8 0
2 years ago
Other questions:
  • would specify that only selected members of the payroll and human resources department would have the right to change sensitive
    11·1 answer
  • You want to plug a keyboard into the back of a computer. you know that you need to plug the keyboard cable into a ps/2 port. whi
    9·1 answer
  • Is a way of grading web pages by the number of other web pages that link to them?
    10·1 answer
  • A network administrator needs information about the printers that employees can access. Where can he find the information? The a
    10·2 answers
  • Which computer network component allows data transfers from one computer to another through a telephone line?
    11·2 answers
  • . What is automated testing?
    10·1 answer
  • Using a cell phone while operating a motor vehicle is considered distraction because
    8·1 answer
  • A location in memory used for storing data and given a name in a computer program is called a because the data in the location c
    14·1 answer
  • Directions. Read and analyze the sentences below. There are words or phrases to be corrected. Rewrite it on the blank accrording
    6·1 answer
  • Explain the steps in starting the MS Access from the Start Menu.​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!