Q28.The following pseudocode is executed using the "Words" dataset. `A` counts the number of pairs of words which have equal number of vowels and consonants. But the pseudocode may have mistakes in one or more lines. Identify all such lines, if any. Assume that all statements not listed in the options below are free of errors.
```
A = 0
while(Pile 1 has more cards){
Read the top card X from Pile 1
countV = 0, countC = 0
countV, countC = countSomething(X, countV, countC)
Move X to Pile 2
while(Pile 1 has more cards){
Read the top card Y from Pile 1
Move Y to Pile 3
countV1 = 0, countC1 = 0
countV1, countC1 = countSomething(Y, countV1, countC1)
if(countV == countV1 and countC != countC){
A = A + 1
}
}
Move all cards from Pile 3 to Pile 2
}
Procedure countSomething(Z, B, C)
I = Z.LetterCount
while(I >= 1){
if(Ith letter of Z.Word is vowel){
B = B + 1
}
else{
C = C + 1
}
I = I + 1
}
return(B, C)
End countSomething
```
Save
Check
Details
Q28
5 Jun 2022
Q28.The following pseudocode is executed using the "Words" dataset. `A` counts the number of pairs of words which have equal number of vowels and consonants. But the pseudocode may have mistakes in one or more lines. Identify all such lines, if any. Assume that all statements not listed in the options below are free of errors.
```
A = 0
while(Pile 1 has more cards){
Read the top card X from Pile 1
countV = 0, countC = 0
countV, countC = countSomething(X, countV, countC)
Move X to Pile 2
while(Pile 1 has more cards){
Read the top card Y from Pile 1
Move Y to Pile 3
countV1 = 0, countC1 = 0
countV1, countC1 = countSomething(Y, countV1, countC1)
if(countV == countV1 and countC != countC){
A = A + 1
}
}
Move all cards from Pile 3 to Pile 2
}
Procedure countSomething(Z, B, C)
I = Z.LetterCount
while(I >= 1){
if(Ith letter of Z.Word is vowel){
B = B + 1
}
else{
C = C + 1
}
I = I + 1
}
return(B, C)
End countSomething
```