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
An internet address that ends in .com is operated by
ollegr [7]
.com means company, so it is ran by a company.

4 0
3 years ago
Read 2 more answers
In this problem, you will write three methods to:
gulaghasi [49]

Answer:

see explaination for program code

Explanation:

program code below:

class Names{

public static String[] makeNames(String[] array1, String[] array2){

if(array1.length == 0) return array2;

if(array2.length == 0) return array1;

String[] res = new String[array1.length*array2.length];

int k = 0;

for(int i=0;i<array1.length;i++){

for(int j=0;j<array2.length;j++){

res[k++] = array1[i] + " " + array2[j];

}

}

return res;

}

public static String[] makeNames(String[] array1, String[] array2, String[] array3){

return makeNames(makeNames(array1, array2), array3);

}

public static void print(String[] array){

for(String name : array){

System.out.println(name);

}

}

public static void main(String[] args) {

String[] first = {"David", "Mike", "Katie", "Lucy"};

String[] middle = {"A","B", "C", "D", "E"};

String[] last = {};

String[] names = makeNames(first, middle, last);

print(names);

print(names);

}

}

8 0
3 years ago
You have a large company, and it is important to your business that your employees' work is backed up regularly. Which network w
valkas [14]
Client server network as it has a powerful server which provides all the networks required on the network. Files are usually backed up regularly.

3 0
3 years ago
If you have a lien on your vehicle, you cannot apply for a duplicate copy of your vehicle’s certificate of title.
yKpoI14uk [10]

The answer is False

If you have not made any changes to your title such as changing ownership, you can apply for a duplicate title. Provided your vehicle has been stolen, lost, or the lien on the car has been satisfied, you may stand a chance to obtain a duplicate title. However, you may be required to provide certain information like the vehicle ID number and others and pay a fee .


6 0
4 years ago
Using cell references, enter a formula in cell b6 to calculate monthly payments for the loan described in this worksheet. omit t
olga55 [171]

Answer:

On the Formulas tab, in the Function Library group, click the Financial button, and click PMT. Enter B3/12 in the Rate argument box. Enter B4 in the Nper argument box. Enter B2 in the Pv argument box. Click OK.

Explanation:

Inside any excel spreadsheet like Microsoft Excel or Libre office Calc.

While your cursor is present at cell B6, do the following

On the formulas tab, in the function library group,

click the financial button

Then click PMT

Enter B3/12 in the rate argument box.

Enter b4 in the Nper argument box. Enter B2 in the argument box.

Click ok.

The following assumptions were made:

the annual interest rate is stored in cell B3

the number of payments in cell B4

the loan amount in cell B2.

8 0
3 years ago
Other questions:
  • Stella likes to work with colors and moving pictures. She is good at drawing. Which job role should she choose
    11·2 answers
  • Urgent help<br> Write a program that prints ‘Hello World’ to the screen
    8·1 answer
  • If there is a mistake with one of your bank accounts, who should you contact to resolve the issue
    14·1 answer
  • What is an identified component of a software program that might allow a hacker or other intruder to gain entry and control of a
    10·2 answers
  • Review the two e-mail messages below for their adherence to the guidelines for professional e-mail correspondence you have learn
    6·1 answer
  • How would you convert an integer value to a float value in Python?
    10·1 answer
  • Web résumés are posted to the Internet in HTML format.<br> true or false
    9·2 answers
  • Write a Python program which asks a user for a word and performs letters manipulation. If the word is empty, the program should
    6·1 answer
  • A state government is attempting to reduce the digital divide. Which of the following activities has the greatest potential to c
    14·1 answer
  • Select the correct category of cybersecurity described.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!