0% found this document useful (0 votes)
13 views8 pages

Test - Topic 8

Uploaded by

Melih Gülcan
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)
13 views8 pages

Test - Topic 8

Uploaded by

Melih Gülcan
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/ 8

COMPUTER SCIENCE

Topic 8 - Programming

Test Duration 55 Min

Name: ___________ _____ / 44 Marks

1. Four pseudocode descriptions and four pseudocode statements are shown below. Draw a line
linking each pseudocode description to the most appropriate statement.
[4 Marks]

Some pseudocode statements will not be used.

2. Tick (✓) one box to show the named section of a program that performs a specific task.

[1 Mark]

Page 1 of 8
3.
[1 Mark]

4.

[3 Marks]

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

Page 2 of 8
[6 Marks]

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

5.
[6 Marks]

Page 3 of 8
6.
[3 Marks]

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

7.

[3 Marks]

A ___________________ is a set of programming statements grouped together under a

single name that can be called to perform a task at any point in a program.

A ___________________ is a set of programming statements grouped together under a

single name that can be called to perform a task at any point in a program. In contrast to a

procedure, a function will return a value back to the main program.

_____________________ are the variables that store the values of the arguments passed to

a procedure or function. Some but not all procedures and functions will have parameters.

Page 4 of 8
8. Please fill in the blanks in the File Handling Pseudocode below.
[3 Marks]

DECLARE TextLine: ___________


DECLARE MyFile: STRING
MyFile ← "MyText.txt"
OPEN MyFile FOR ___________
OUTPUT "Please enter a line of text"
INPUT TextLine
WRITEFILE, TextLine
CLOSEFILE(MyFile)
OUTPUT "The file contains this line of text:"
OPEN MyFile FOR __________
READFILE, TextLine
OUTPUT TextLine
CLOSEFILE(MyFile)

9.
[4 Marks]
Programs can use both local and global variables.

Describe, using examples, the difference between local and global variables.

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

Page 5 of 8
....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

10. a) Describe the purpose of each statement in this algorithm. [2 Marks]

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

b) Identify, using pseudocode, another loop structure that the algorithm in part a

could have used. [1 Mark]

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

Page 6 of 8
c) Write an algorithm, using pseudocode, to input a number between 0 and 100

inclusive. The algorithm should prompt for the input and output an error message

if the number is outside this range. [3 Marks]

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

11.

[4 Marks]

» selection
» iteration

Describe each concept and provide an example of program code to show how it is
used.
....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................
Page 7 of 8
Blank Page

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

....................................................................................................................................................................

Page 8 of 8

You might also like