Question

In: Advanced Math

How many times is line (5) executed in the following pseudocode? Enter your answer in the...

How many times is line (5) executed in the following pseudocode? Enter your answer in the box below.

NOTE: Please read the pseudocode very carefully.

(1) n=14n=14

(2) m=16m=16

(3) for i=1i=1 to n+2n+2

(4) ---- for j=1j=1 to mm

(5) -------- print (i,j)

Solutions

Expert Solution

(1) n = 14

(2) m = 16

(3) for i = 1 to n+2

(4)---- for j = 1 to m

(5)-------- print(i,j)

first for loop will run 14+2 = 16 times and second loop will run again 16 times because second loop is in first loop so print(i,j) will run 16*16 = 256 times. Output in matrix form

1,1 1,2 1,3 1,4 1,5 1,6 1,7 1,8 1,9 1,10 1,11 1,12 1,13 1,14 1,15 1,16
2,1 2,2 2,3 2,4 2,5 2,6 2,7 2,8 2,9 2,10 2,11 2,12 2,13 2,14 2,15 2,16
3,1 3,2 3,3 3,4 3,5 3,6 3,7 3,8 3,9 3,10 3,11 3,12 3,13 3,14 3,15 3,16
4,1 4,2 4,3 4,4 4,5 4,6 4,7 4,8 4,9 4,10 4,11 4,12 4,13 4,14 4,15 4,16
5,1 5,2 5,3 5,4 5,5 5,6 5,7 5,8 5,9 5,10 5,11 5,12 5,13 5,14 5,15 5,16
6,1 6,2 6,3 6,4 6,5 6,6 6,7 6,8 6,9 6,10 6,11 6,12 6,13 6,14 6,15 6,16
7,1 7,2 7,3 7,4 7,5 7,6 7,7 7,8 7,9 7,10 7,11 7,12 7,13 7,14 7,15 7,16
8,1 8,2 8,3 8,4 8,5 8,6 8,7 8,8 8,9 8,10 8,11 8,12 8,13 8,14 8,15 8,16
9,1 9,2 9,3 9,4 9,5 9,6 9,7 9,8 9,9 9,10 9,11 9,12 9,13 9,14 9,15 9,16
10,1 10,2 10,3 10,4 10,5 10,6 10,7 10,8 10,9 10,10 10,11 10,12 10,13 10,14 10,15 10,16
11,1 11,2 11,3 11,4 11,5 11,6 11,7 11,8 11,9 11,10 11,11 11,12 11,13 11,14 11,15 11,16
12,1 12,2 12,3 12,4 12,5 12,6 12,7 12,8 12,9 12,10 12,11 12,12 12,13 12,14 12,15 12,16
13,1 13,2 13,3 13,4 13,5 13,6 13,7 13,8 13,9 13,10 13,11 13,12 13,13 13,14 13,15 13,16
14,1 14,2 14,3 14,4 14,5 14,6 14,7 14,8 14,9 14,10 14,11 14,12 14,13 14,14 14,15 14,16
15,1 15,2 15,3 15,4 15,5 15,6 15,7 15,8 15,9 15,10 15,11 15,12 15,13 15,14 15,15 15,16
16,1 16,2 16,3 16,4 16,5 16,6 16,7 16,8 16,9 16,10 16,11 16,12 16,13 16,14 16,15 16,16

Related Solutions

assume that the following pseudocode is executed in a program module main declare x = 1...
assume that the following pseudocode is executed in a program module main declare x = 1 declare sum = 0 declare max = 5 while ( x < max) Display "x is ", x set x = x + 1 set sum = s + x end while end module after the execution of this program the final value of x is_____ and the final value of sum is_____
Enter your answer in the provided box. How many grams of solid barium sulfate form when...
Enter your answer in the provided box. How many grams of solid barium sulfate form when 45.0 mL of 0.160 M barium chloride reacts with 69.0 mL of 0.065 M sodium sulfate? Aqueous sodium chloride forms also.
Note: for the following you may enter your answers as calculations using * for times; /...
Note: for the following you may enter your answers as calculations using * for times; / for divide and ** for to the power. For example, 10 over 7 cubed would be 10/7**3. A program to produce greeting cards has 92 pictures to choose from and 17 different sayings. If you randomly select a picture and a saying to make a card, what is the probability of selecting a particular card if all outcomes are equally likely? What is the...
Enter your answer in the provided box. Many metals react with oxygen gas to form the...
Enter your answer in the provided box. Many metals react with oxygen gas to form the metal oxide. For example, calcium reacts as follows: 2Ca(s) + O2(g) → 2CaO(s) Calculate the mass of calcium oxide that can be prepared from 6.87 g of Ca and 4.58 g of O2. _____ g
C++ Visual Studios How many times will "!" print? int i = -5 while(-5 <= i...
C++ Visual Studios How many times will "!" print? int i = -5 while(-5 <= i <= 0) { cout << "!"; --i; }
In your own words please answer the following, or some of them: 5. How was the...
In your own words please answer the following, or some of them: 5. How was the income tax formula for individuals changed for 2018 by the Tax Cuts and Jobs Act? 6. Why are some deductions called “above the line” deductions and others called “below the line” deductions? What is the “line”? 7. For tax purposes, why is the married filing jointly tax status generally preferable to the married filing separately filing status? Why might a married taxpayer prefer not...
How many electrons in an atom can have the following sets of quantum numbers? Enter the...
How many electrons in an atom can have the following sets of quantum numbers? Enter the maximum number of electrons into the table. Quantum Numbers Number of Electrons n = 2, l = 1, ml = 0, ms = +1/2 n = 2, l = 2 n = 2, l = 0, ml = 0, ms = -1/2 n = 3, l = 2
Read the article regarding “How to Enter a Foreign Market” and then answer the following questions...
Read the article regarding “How to Enter a Foreign Market” and then answer the following questions based on the Exavier Candy Company scenario. If Exavier Candy Company were to go global what would they need to find out concerning marketing of their products? Be specific. What would be their best first international market (country or region) possibility and why? What management/financial considerations would need to be considered?
1. If you were to toss a fair coin 5 times, how many different possible sequences...
1. If you were to toss a fair coin 5 times, how many different possible sequences of flips would there be? 2. Suppose that employees at a large company are assigned an ID number which contains 5 numbers and 2 letters. How many possible combinations are there in this system?
Write the following linear program in standard form. If your answer is zero, enter “0”. If...
Write the following linear program in standard form. If your answer is zero, enter “0”. If the constant is "1" it must be entered in the box. Max 12A + 6B s.t. A − 2B ≤ 420 6A + 8B ≤ 1,300 10A − 2B ≤ 250 A, B ≥ 0 A + B + S1 + S2 + S3 s.t. A − B + S1 A + B + S2 A − B + S3 A, B, S1, S2,...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT