Q35.The following pseudocode is executed using the Words dataset and `explode(X)` returns the list of letters in the word `X`. For example, `explode("sweet")` returns `['s', 'w', 'e', 'e', 't']`. What will `count` represent at the end of execution?
```
count = 0, letterList = []
while(Table 1 has more rows) {
Read the first row X in Table 1
letterList = explode(X.Word)
count = count + checkSomething(letterList)
Move X to Table 2
}
Procedure checkSomething(L)
lastLetter = first(L)
restList = rest(L)
foreach letter in restList {
if(letter == lastLetter) {
return(1)
}
lastLetter = letter
}
return(0)
End checkSomething
```
Save
Check
Details
Q35
6 Aug 2023
Q35.The following pseudocode is executed using the Words dataset and `explode(X)` returns the list of letters in the word `X`. For example, `explode("sweet")` returns `['s', 'w', 'e', 'e', 't']`. What will `count` represent at the end of execution?
```
count = 0, letterList = []
while(Table 1 has more rows) {
Read the first row X in Table 1
letterList = explode(X.Word)
count = count + checkSomething(letterList)
Move X to Table 2
}
Procedure checkSomething(L)
lastLetter = first(L)
restList = rest(L)
foreach letter in restList {
if(letter == lastLetter) {
return(1)
}
lastLetter = letter
}
return(0)
End checkSomething
```