We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 2
Practise questions
1
Write a pseudocode algorithm to read a set of positive integers(terminated by 0)
and print their average as well as the largest of the set.
[cxc 1993]
Write a pseudocode algorithm to read a positive integer N followed by N integers.
For these N integers, the algorithm must count and print the number of zero and
non-zero values
[cxc 1993]
Write a pseudocode algorithm to read a sequence of numbers terminated by the
number 9999 and print the sum of the negative numbers and a sum of the positive
numbers and the product of the two sums.
Write a pseudocode algorithm to generate the first 20 terms of the following
sequence:
1, 3, 3,9, 27, 243, 6561, ......
Use trace tables to show the correctness of your logics for questions 3 & 4 above.
Write an algorithm to read the names and ages of 10 people and print the name of
the oldest person. Assume that there are no persons of the same age. Data is
supplied in the following form: name, age, name, age
Do a trace table to show the final state of the variable in the following pseudocode:
SUM = 0
N= 10
while N < 40 DO
SUM = SUM +N
print N, SUM
N=N+5
endwhileer ae TESST NN AC A AN
10.
The following data represent some sample scores obtained by students ina test:
5 4 7, 10 0 6 0 1 9 8 999
999 is the dummy value which terminates the data. Write pseudocode algorithm to
read any data in the above format and print the number of students scoring O and
the number scoring 10
Icxe 1995}
Write a pseudocode algorithm to read the names of a sequence of products and
their price. The pseudocode terminates when a 0 price for a product is
encountered. The pseudocode should print the number of items purchased and a
grand total. The data will be entered in the following format:
Product, Price, Product, Price, Product, Price ..
Write a pseudocode to read a sequence of numbers terminated by 0 and print the
sum of all the even numbers.