You are on page 1of 3

Topic: Programming Concept

Name: Class: Sec: ID: Date:

Answer the questions

1. What is the difference between FOR ... TO ... NEXT, REPEAT ... UNTILand
WHILE ... DO ... ENDWHILE ?

2. A company has 5000 CDs, DVDs, videos and books in stock. Each item has a
unique 5-digit code with the first digit identifying the type of item, i.e.

1 = CD2 = DVD 3 = video 4 = book

For example, for the code 15642 the 1 identifies that it is a CD, and for the code 30055
the 3 identifies that it is a video.

Write an algorithm, using pseudocode or otherwise, that

Inputs the codes for all 5000 itemsValidates the input codeCalculates how many CDs,
DVDs, videos and books are in stock Outputs the four totals.
3.The height of buildings and number of floors in buildings was being analyzed.
Write an algorithm , using pseudocode only, which
 Inputs an height and number of floors for 200 buildings
 Outputs the average height of all the buildings
 Outputs the number of building with more than 50 floors
 Outputs the height of the tallest building

4. Write an algorithm using pseudocode which takes temparature input over a 100 day
period (once per day) and output the number of days when the teparature was below 20C
and number of days and when the temparature was 20C or above.

You might also like