Q45.The following pseudocode is executed using the Words dataset and `explode(W)` returns the list of letters in word `W`. At the end of execution, `count` stores the number of words with at least two consecutive occurrences of the same letter. Choose the correct code fragment to complete the procedure.
```
count = 0, letterList = []
while(Table 1 has more rows) {
Read the first row X in Table 1
letterList = explode(X.Word)
count = count + consecute(letterList)
Move X to Table 2
}
Procedure consecute(L)
lastLetter = first(L)
restList = rest(L)
***************
* Fill the code *
***************
End consecute
```
Save
Check
Details
Q45
2 Apr 2023
Q45.The following pseudocode is executed using the Words dataset and `explode(W)` returns the list of letters in word `W`. At the end of execution, `count` stores the number of words with at least two consecutive occurrences of the same letter. Choose the correct code fragment to complete the procedure.
```
count = 0, letterList = []
while(Table 1 has more rows) {
Read the first row X in Table 1
letterList = explode(X.Word)
count = count + consecute(letterList)
Move X to Table 2
}
Procedure consecute(L)
lastLetter = first(L)
restList = rest(L)
***************
* Fill the code *
***************
End consecute
```