Q13Multiple correct6 Marks1 Sep 2024
For the "Words" dataset, consider a scenario where we want to find the number of sentences containing at least 10 distinct letters. We asked ChatGPT to generate the pseudocode for this task. Below are the two pseudocodes provided by ChatGPT. Which of the following statements is/are correct? It is a Multiple Select Question (MSQ).
```
Pseudocode 1:
count = 0
L = []
while(Table 1 has more rows){
Read the first row X in Table 1
L = addSomething(L, X)
if(X.Word ends with a full stop){
if(length(L) >= 10){
count = count + 1
}
L = []
}
Move X to Table 2
}
Procedure addSomething(M, Y)
i = 1
while(i <= Y.LetterCount){
P = ith letter of Y.Word
if(not(member(M, P))){
M = M ++ [P]
}
i = i + 1
}
return(M)
End addSomething
Pseudocode 2:
count = 0
L = []
while(Table 1 has more rows){
Read the first row X in Table 1
L = addSomething(L, X)
if(X.Word ends with a full stop and length(L) >= 10){
count = count + 1
L = []
}
Move X to Table 2
}
Procedure addSomething(M, Y)
i = 1
while(i <= Y.LetterCount){
P = ith letter of Y.Word
if(not(member(M, P))){
M = M ++ [P]
}
i = i + 1
}
return(M)
End addSomething
```