0% found this document useful (0 votes)
11 views4 pages

10IGCSE - Test1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views4 pages

10IGCSE - Test1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Test 1 - Topic: Algorithm design and problem solving

Name: _______ Subject:

Date: ________ Grade: 10 IGCSE

1. Study the following pseudocode.


CASE OF MySwitch
1: ThisChar <- ‘a'
2: ThisChar <- 'y'
3: ThisChar <- '7'
OTHERWISE: ThisChar<- ‘*'
ENDCASE
Write pseudocode with the same functionality without using a CASE structure.
….………………………………………………………………………..…………………
….………………………………………………………………………..…………………

….………………………………………………………………………..…………………

….………………………………………………………………………..…………………

….…………………………………………………………………………….……………

….…………………………………………………………………………..………………

….……………………………………………………………..…………..…………… [3]

2. A developer is writing a program to record the results of examinations taken by students


in a school.

The program will be tested to make sure that it works. There are four types of test data that can
be used to test a system: normal, abnormal, extreme and boundary.
Explain what is meant by normal, abnormal, extreme and boundary test data.
Normal ….……………………………………………………………………….…………

….………………………………………………………………………..…………………

Abnormal ….……………………………………………………………………….………

Page 1 of 4
….………………………………………………………………………..…………………

Extreme ….……………………………………………………………………….………

….………………………………………………………………………..…………………

Boundary ….……………………………………………………………………….………

….……………………………………………………………………….………………[4]

3. The following table contains statements written in pseudocode. Show the type of
programming construct each statement represents. Put a tick (✓) in the appropriate column for
each statement.

Statement Selection Repetition Assignment


TempValue[Index] ReadValue(SensorID)
OTHERWISE OUTPUT "ERROR"
UNTIL DayNumber > 7
FOR Count 1 TO 100
[4]
4. An algorithm has been written in pseudocode to generate 50 positive random integers with
values less than or equal to 100. These random integers are stored in the array RandNum[ ]

The function Rand(X, Y) generates a random integer greater than or equal to X and less than Y.
For example, Rand(1, 4) generates 1 or 2 or 3.

i) Find the four errors in the pseudocode and write a correction for each error.

Error 1 ….………………………………………………….…………………….…………

Correction ….…………………………………………….…………………….…………...

Error 2 ….………………………………………………….…………………….…………

Page 2 of 4
Correction ….…………………………………………….…………………….…………...

Error 3 ….………………………………………………….…………………….…………

Correction ….…………………………………………….…………………….…………...

Error 4 ….………………………………………………….…………………….…………

Correction ….…………………………………………….…………………….…………...

[4]

ii) The pseudocode for this algorithm could be shortened by the use of a FOR … NEXT loop.

Rewrite the algorithm using a FOR … NEXT loop.

….…………………………………………………………………………..………………

….…………………………………………………………………………….……………

….…………………………………………………………………………….……………

….………………………………………………………………………..…………………

….……………………………………………………………..…………..……..……… [3]

iii) Two types of loop that may be found in an algorithm are the ‘pre-condition’ and
‘postcondition’ loop. Identify one other type of loop and explain when it should be used.

Type …………………………………………………………………………………………

Explanation ………………………………………………………………………………….

………………………………………………………………………………………………

….………………………………………...……………………..…………..…………… [2]

5. An algorithm will:

• input a sequence of integer values, one at a time.


• ignore all values until the value 27 is input, then sum the remaining values in the
sequence.
• stop summing values when the value 0 is input and then output the sum of the values.
Draw a program flowchart to represent the algorithm. [5]

Page 3 of 4
Page 4 of 4

You might also like