Question

What will variable A represent after execution of the following procedure on the “Paragraph Words” dataset?...

What will variable A represent after execution of the following 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. If part of speech is “Verb” then increment 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 is equal to 1 then increment 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 Total number of verbs in the dataset Total number of sentences with only one verb in it Total number of sentences in the dataset Total number of sentences with at least one verb in it None of the above

Homework Answers

Answer #1

Answer for given problem is:

Total number of sentences with only one verb in it.

variable A represent Total number of sentences with only one verb in it after execution of the following procedure on the “Paragraph Words” dataset

Code flow:

The code is used on paragraph. The code iterates through every word.

1) For each sentence, variable B stores number of variables in it.

2) At the end of sentence, that is if full stop is found and if B is equal to 1 then A gets incremented by 1.

3) After every sentence B is initialized to 0.

4) The steps are repeated till all words are scanned and paragraph is over

5) value of A is the result

Pile 1 denotes the words still to be iterated and

Pile 2 denotes the words already iterated

Example:

Here is a paragraph of 3 sentences.

ABC Runs fast but walks slow.

XYZ walks fast.

XYZ and ABC.

If given algorithm is applied on this paragraph, the output of every iteration is shown in the table.

word: Top most word in Pile1

Pile 1: Words in Pile 1

Pile 2: Words in Pile 2

A: value of variable A

B: value of variable B

word Pile 1 Pile 2 A B

ABC Runs fast but walks slow.

XYZ walks fast.

XYZ and ABC.

0 0
ABC

Runs fast but walks slow.

XYZ walks fast.

XYZ and ABC.

ABC 0 0
Runs

fast but walks slow.

XYZ walks fast.

XYZ and ABC.

ABC Runs 0 1
fast

but walks slow.

XYZ walks fast.

XYZ and ABC.

ABC Runs fast 0

1

but

walks slow.

XYZ walks fast.

XYZ and ABC.

ABC Runs fast but 0 1
walks

slow.

XYZ walks fast.

XYZ and ABC.

ABC Runs fast but walks 0 2

slow.

XYZ walks fast.

XYZ and ABC.

ABC Runs fast but walks slow. 0 0
XYZ

walks fast.

XYZ and ABC.

ABC Runs fast but walks slow.

XYZ

0 0
walks

fast.

XYZ and ABC.

ABC Runs fast but walks slow.

XYZ walks

0 1
fast. XYZ and ABC.

ABC Runs fast but walks slow.

XYZ walks fast.

1 0
XYZ and ABC.

ABC Runs fast but walks slow.

XYZ walks fast.

XYZ

1 0
and ABC

ABC Runs fast but walks slow.

XYZ walks fast.

XYZ and

1 0
ABC. -

ABC Runs fast but walks slow.

XYZ walks fast.

XYZ and ABC.

1 0

1st sentence contain 2 verbs- runs and walks (A=0)

2nd sentence contains 1 verb- walks (A=1) A gets incremented as this sentence has exactly 1 verb

3rd sentence doesn't contain verb (A=1)

Here it is assumed that every sentence ends with a full stop.

So as only 1 sentence in the paragraph contain exact 1 verb answer is 1 which is denoted by 'A'

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions