10. The following pseudocode is executed using the "Words" table. What will be the value of A at
the end of the execution?
8 Marks
Sum = 0, SumT = 0
Count 0. CountT = 0
while (Table 1 has more rows) {
Read the first row X in Table 1
Sum, Count AddWord(x, Sum, Count)
Move X to Table 2
}
Sum / Count
Sum 0. Count = 0, A = 0
Move all rows from Table to Table 1
while (Table 1 has more rows) {
Read the first row X in Table 1
Sum Count = AddWord(X, Sum, Count)
if (X. Word ends with a full stop) {
Sum Count
A I Do Something(C, B, A)
Sum 0 Count = 0
Move X to Table 2
}
Procedure AddWord (Y, SumT, CountT)
Sum T SumT + Y Letter Count
Count T CountT + 1
return (SumT, CountT])
End AddWord
Procedure DoSomething (P, Q, R)
if (P < 0) {
return (R + 1)
else {
return (R)
End DoSomething
A
(Numerical input)
Answers
Answered by
0
Answer:
sum ±1 row....numerical input
Answered by
0
The following pseudocode is executed using the "Words" table. What will be the value of A at the end of the execution
sum = 0, SumT = 0
Count 0. CountT = 0
while (Table 1 has more rows) {
Read the first row X in Table 1
Sum, Count AddWord(x, Sum, Count)
Move X to Table 2
}
- The pseudocode expression INPUT() can be used to request user input. Like DISPLAY(), it functions just like a procedure but doesn't need any parameters. Instead, the evaluation of the INPUT() expression will simply provide the user-supplied input value.
- It is one of the ways that an algorithm for a programme can be represented. It cannot be run on a computer since it lacks a specific syntax like all of the programming languages.
#SPJ3
Similar questions
English,
3 months ago
English,
3 months ago
Geography,
3 months ago
Math,
6 months ago
India Languages,
11 months ago
English,
11 months ago
Social Sciences,
11 months ago