Question

In: Computer Science

What will the value of A represent at the end of execution of the given procedure...

What will the value of A represent at the end of execution of the given procedure on the “Paragraph Words” dataset?

Step 1. Arrange all cards in a single pile called Pile 1

Step 2. Maintain two variables A, B and initialize them to 0
Step 3. If Pile 1 is empty then stop the iteration

Step 4. Read the top card in Pile 1

Step 5. Add Letter count to variable B

Step 6. If the word does not end with a full stop then execute step 9

Step 7. If the word ends with a full stop and B > A then store B in A

Step 8. Reset the variable B to 0

Step 9. Move the current card to another pile called Pile 2 and repeat from step 3

Select answer from the following options:

1. Length of the shortest sentence based on the number of words

2. Length of the longest sentence based on the number of words

3. Length of the longest sentence based on the number of characters

4. Length of the shortest sentence based on the number of characters

5. None of the above

Solutions

Expert Solution

This procedure finds the Length of the longest paragraph based on the number of characters and paragraph ends with full stop. (lettet count = number of characters in a card)

Ans:: None of the above.

If we Assume Each card conatains one sentence and each valid sentence ends with full stop then only the answer will be 3. Length of the longest sentence based on the number of characters

(Assume Each card conatains one sentence and each valid sentence ends with full stop)

If the card contains

Explanation::

Pile1 =[ card_1,card_2,………card_n]

A=B=0

LOOP::    Repeat the following steps if Pile1_Not_Empty, else goto STOP

             {

                     Read top_card   (note:: first iteration it is card1,next iteration card_2 and so on)

                     B=B+ letter_count(top_card) =0+letter_count(top_card)=letter_count(top_card)

.i.e, stores number of letters/characters in card

                    If(word_end_with_fullstop AND B > A), do the following assignment

                                {

                                  A=B; ( Note:: if the current top_card contains more letters than

previous    card, then its count, letter_count(top_card) is stored in A.

  i.e A   contains highest letter count)

                                 }

                      B=0

                    Move top_card to Pile2 (Next card becomes top_card. In each iteration it will be

                                                                                         card_2, card_3 and so on)

                    jump to LOOP

           }

STOP :: stop


Related Solutions

Discuss/explain in simple to understand terms what does the p-value represent for any hypothesis test procedure...
Discuss/explain in simple to understand terms what does the p-value represent for any hypothesis test procedure and why is it important to report the p-value when presenting the findings of a test/research. Include in your discussion a specific example you find online for context. (Do not just repeat one similar to another student's example).
Given the following cash inflow at the end of each year, what is the future value...
Given the following cash inflow at the end of each year, what is the future value of this cash flow at 3%, 10% and 18% interest rates at the end of year 7? Year   Cash Inflow 1 $15,000 2 $22,000 3 $28,000 4 $0 5 $0 6 $0 7 $160,000 What is the future value of this cash flow at 3% interest rate at the end of year 7? What is the future value of this cash flow at 10%...
What does the "P-value" represent? Examples
What does the "P-value" represent? Examples
What is the net book value of a non current asset represent? Does the network value...
What is the net book value of a non current asset represent? Does the network value represent the market value of the asset?
What does gross profit represent? [NOT the calculation, but rather what does it “mean”…] Given this,...
What does gross profit represent? [NOT the calculation, but rather what does it “mean”…] Given this, how would gross profit (also known as gross margin) be computed for a service organization? What might it mean to have a decline in unearned revenues in the current year if the company is a magazine publisher? Explain why the amount of retained earnings reported on the balance sheet is often not the net amount of all accumulated earnings (and losses) less all accumulated...
1. What does the Rf value represent and what is the unit of measure? 2. Which...
1. What does the Rf value represent and what is the unit of measure? 2. Which component elutes first during column chromatography and why? 3. What should be the order of elution during column chromatography; alcohol, ether, ester and ketone, assuming similar molecular weights? These questions relate to a TLC and column chromatography organic chemistry lab
Explain the procedure for testing a hypothesis using the P-value approach? What is the criterion for...
Explain the procedure for testing a hypothesis using the P-value approach? What is the criterion for judging whether to reject the null hypothesis? 6. What does the level of significance represent in a test of hypothesis? Give an example. 7. Explain the difference between "accepting" and "not rejecting" a null hypothesis.
Using the procedure outlined in the appendix at the end of the chapter for geometric average...
Using the procedure outlined in the appendix at the end of the chapter for geometric average growth rates​ (in the section titled​ "Calculating Average​ (Compound) Growth​ Rates," reproduce the​ "Implied (Average) Annual​ Growth" figures​ (for the following​ countries: France,​ Singapore, Botswana,​ India, and Kenya. GDP values are​ PPP-adjusted 2005 constant dollars. Fill in the table below with the geometric average growth rates as a percentage. ​(Round your responses to two decimal places​.) GDP per Capita Implied​ (Average) Annual Growth​ (%)...
what is the best procedure for weighing solids? What is the correct procedure for mixing an...
what is the best procedure for weighing solids? What is the correct procedure for mixing an acid solution with water? Why must precipitation be washed after the super stent liquid has been removed? Name two procedures used to separate precipitates from supernatant liquid?
Write an overloaded procedure using c++ for approximating the value of cos(x), called approx_cos. This procedure...
Write an overloaded procedure using c++ for approximating the value of cos(x), called approx_cos. This procedure should work as follows: A call such as approx_cos(double x, long N) should produce the Nth order Taylor approximation of the cosine function at the point x. You of course need the derive this Taylor expansion in order to implement it. A call such as approx_cos(double x) should approximate the value of the cosine function evaluated at the point x, to at least eight...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT