Q31.The following pseudocode is executed using the "Words" dataset. What will `count` represent at the end of the execution?
```
count = 0
while(Table 1 has more rows){
Read the first row X in Table 1
Move X to Table 2
while(Table 1 has more rows){
Read the first row Y from Table 1
count = count + isSimilar(X, Y)
Move Y to Table 3
}
Move all rows from Table 3 to Table 1
}
Procedure isSimilar(A, B)
if(A.LetterCount != B.LetterCount){
return(0)
}
i = 1
while(i <= A.LetterCount){
if(ith letter of A.Word is vowel and ith letter of B.Word is vowel){
return(0)
}
if(ith letter of A.Word is consonant and ith letter of B.Word is consonant){
return(0)
}
i = i + 1
}
return(1)
End isSimilar
```
Save
Check
Details
Q31
10 Jul 2022
Q31.The following pseudocode is executed using the "Words" dataset. What will `count` represent at the end of the execution?
```
count = 0
while(Table 1 has more rows){
Read the first row X in Table 1
Move X to Table 2
while(Table 1 has more rows){
Read the first row Y from Table 1
count = count + isSimilar(X, Y)
Move Y to Table 3
}
Move all rows from Table 3 to Table 1
}
Procedure isSimilar(A, B)
if(A.LetterCount != B.LetterCount){
return(0)
}
i = 1
while(i <= A.LetterCount){
if(ith letter of A.Word is vowel and ith letter of B.Word is vowel){
return(0)
}
if(ith letter of A.Word is consonant and ith letter of B.Word is consonant){
return(0)
}
i = i + 1
}
return(1)
End isSimilar
```