D Y PATIL INTERNATIONAL SCHOOL
Name: _____________________ Grade:10 Subject: Computer Science
Topic: Revision WS1 Date: ___________ Teacher’s Sign: _________
1. Abstraction, decomposition and structure diagrams are tools used during the program
development lifecycle. Identify the stage of the program development lifecycle where
they are used and describe what they are used for.
i) Abstraction
Stage:
______________________________________________________________________________
Use:__________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
ii) Decomposition
Stage: ______________________________________________________________________________
Use:__________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
iii) Structure diagram
Stage:
_____________________________________________________________________________________
Use:__________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
1
2. a) There are three different types of loop structure in pseudocode. For each one,
describe the structure and write the pseudocode statements needed to output the
names of 20 students that have been stored in the array Student[1:20]. Use the variable
Counter for the iteration.
Loop 1: _______________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
Loop 2: _______________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
Loop 3: _______________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
2
3. Write a bubble sort algorithm in pseudocode to sort a list of ten names, in an array
called Names[], in ascending order
DECLARE NAMES: ARRAY[1:10] OF STRING
DECLARE TEMP: STRING
OUTPUT "ENTER NAME"
FOR I←1 TO 10
INPUT NAMES[I]
NEXT I
FOR I←1 TO 10
FOR J←1 TO 9
IF NAMES[J]>NAMES[J+1] THEN
TEMP←NAMES[J+1]
NAMES[J+1]← NAMES[J]
NAMES[J]←TEMP
ENDIF
NEXT J
NEXT I
FOR I←1 TO 10
OUTPUT NAMES[I]
NEXT I
3
4. Use the trace table and the test data 78, 34, 22, −4, 98, 16, 734, 88, 999 to record a dry
run of this algorithm written in pseudocode.
W←0
X←0
Y ← 100
Z←0
REPEAT
INPUT Mark
IF Mark <> 999
THEN
REPEAT
IF Mark < 0 OR Mark > 100
THEN
INPUT Mark
ENDIF
UNTIL Mark >= 0 AND Mark <= 100
IF Mark > X
THEN
X ← Mark
ENDIF
IF Mark < Y
THEN
Y ← Mark
ENDIF
Z ← Z + Mark
W←W+1
ENDIF
UNTIL Mark = 999
OUTPUT X, Y, Z
W X Y Z Mark OUTPUT
4
5. Put the following pseudocode statements in the correct order for this algorithm. Make
sure that you indent each statement correctly.
// Algorithm to input ten positive numbers and total them, output the total and then
// average
A←0
A←A+C
B←0
B←B+1
D=A/B
DECLARE A, B, C, D : INTEGER
DECLARE D : REAL
INPUT C
OUTPUT A, D
OUTPUT "Please enter a positive number "
REPEAT
REPEAT
UNTIL B = 10
UNTIL C > 0
5
6. Write pseudocode statements to perform the following string handling operations on
the variable MyString.
Find the length _____________________________________________________________________
Convert to upper case ______________________________________________________________
Convert to lower case _______________________________________________________________
Find the first character _______________________________________________________________
6
7. Use the following list of words and phrases to complete the paragraph below.
Each word can be used once, more than once or not at all.
called
code
constant
defined
functions
global
local
parameters
procedures
program
return
value
Tasks that are repeated many times in an algorithm make use of __________________and
__________________ . Use of these can reduce the size of a ________________________
Procedures and functions are _______________________ once and _____________________
many times.
They can be written with and without ________________________ They are the variables
that store the values passed to a procedure or function.
Functions always _________________________ a _______________________ and the value
can be used on the right-hand side of an assignment statement.
A variable that can be used in any part of a program is called a ______________variable.
A variable that is declared within a procedure or function is called a
_____________________ variable.