[go: up one dir, main page]

0% found this document useful (0 votes)
18 views21 pages

Nesrine-Programming-QP

This document is a question paper for the CIE IGCSE Computer Science course, focusing on programming concepts and arrays. It includes various questions related to pseudocode, data structures, and algorithms, requiring students to demonstrate their understanding of programming principles. The paper is structured into sections with specific tasks, such as declaring variables, processing input, and implementing algorithms for different scenarios.

Uploaded by

wuw6904
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)
18 views21 pages

Nesrine-Programming-QP

This document is a question paper for the CIE IGCSE Computer Science course, focusing on programming concepts and arrays. It includes various questions related to pseudocode, data structures, and algorithms, requiring students to demonstrate their understanding of programming principles. The paper is structured into sections with specific tasks, such as declaring variables, processing input, and implementing algorithms for different scenarios.

Uploaded by

wuw6904
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/ 21

Combined By NESRINE

Head to savemyexams.co.uk for more awesome resources

8.1 Programming Concepts


Question Paper

Course CIE IGCSE Computer Science


Section 8. Programming
Topic 8.1 Programming Concepts
Difficulty Medium

Time allowed: 70
Score: /57
Percentage: /100

Page 1 of 13

© 2015-2023 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers

1/21
Combined By NESRINE

Head to savemyexams.co.uk for more awesome resources

Question 1
Four pseudocode descriptions and five pseudocode statements are shown.
Draw a line to link each pseudocode description to the most appropriate pseudocode statement.

Some pseudocode statements will not be used.

[4]
[4 marks]

Page 2 of 13

© 2015-2023 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers

2/21
Combined By NESRINE

Head to savemyexams.co.uk for more awesome resources

Question 2
Tick (✓) one box to show the named section of a program that performs a specific task.
A file
B function
C parameter
D process
[1]
[1 mark]

Question 3
A function is declared using pseudocode.
FUNCTION ConvertToCm(Inches: REAL) RETURNS REAL
RETURN Inches * 2.4
ENDFUNCTION

Tick (✓) one box which accurately describes the use of the variable Inches
A answer
B call
C parameter
D response
[1]
[1 mark]

Question 4a
The variables X, Y and Z are used to store data in a program:
X stores a string
Y stores a position in the string (e.g. 2)
Z stores the number of characters in the string.
a)
Write pseudocode statements to declare the variables X, Y and Z.
[3]
[3 marks]

Page 3 of 13

© 2015-2023 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers

3/21
Combined By NESRINE

Head to savemyexams.co.uk for more awesome resources

Question 4b
b)
The function Length(X) finds the length of a string X.

The function SubString(X,Y,Z) finds a substring of X starting at position Y and Z characters long. The first character in X is in
position 1.

Write pseudocode statements to:


store the string "Programming is fun" in X
find the length of the string and output it
extract the word fun from the string and output it.
[6]
[6 marks]

Page 4 of 13

© 2015-2023 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers

4/21
Combined By NESRINE

Head to savemyexams.co.uk for more awesome resources

Question 5
TASK 1 – Set up arrays
Set-up one dimensional arrays to store:
• Student names
• Student marks for Test 1, Test 2 and Test 3
o Test 1 is out of 20 marks
o Test 2 is out of 25 marks
o Test 3 is out of 35 marks
• Total score for each student
Input and store the names for 30 students. You may assume that the students’ names are unique.
Input and store the students’ marks for Test 1, Test 2 and Test 3. All the marks must be validated on entry and any invalid marks
rejected.
TASK 2 – Calculate

Calculate the total score for each student and store in the array.
Calculate the average total score for the whole class.

Output each student’s name followed by their total score.


Output the average total score for the class.

TASK 3 – Select
Select the student with the highest total score and output their name and total score.
(i)
Explain how you select the student with the highest score (Task 3). You may include pseudocode or programming
statements to help illustrate your explanation.
[5]
ii)
How does your program work when there is more than one student having the highest score? Explain using your method
given in part (d)(i).
[1]
[6 marks]

Page 5 of 13

© 2015-2023 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers

5/21
Combined By NESRINE

Head to savemyexams.co.uk for more awesome resources

Question 6a
a)
Write an algorithm, using pseudocode or flowchart only, which:

∞ inputs three numbers


∞ outputs the largest of the three numbers
[3]
[3 marks]

Question 6b
b)
Write an algorithm, using pseudocode or flowchart only, which:

∞ inputs 1000 numbers


∞ outputs how many of these numbers were whole numbers (integers)
(You may use INT(x) in your answer, e.g. y = INT(3.8) gives the value y = 3)
[4]
[4 marks]

Page 6 of 13

© 2015-2023 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers

6/21
Combined By NESRINE

Head to savemyexams.co.uk for more awesome resources

Question 7a
Task 1 – Setting up the voting system to allow a tutor group to elect a representative. Write a program to:
allow the tutor to enter the name of the tutor group
allow the tutor to enter the number of students in the tutor group
allow the tutor to enter the number of candidates in the election; maximum of four candidates
allow the tutor to enter the names of the candidates and store them in a suitable data structure
allow each student to input their vote or to abstain
count the votes for each candidate and student abstentions
When all students have voted, display the name of the tutor group, the votes for each candidate and the name of the
candidate who has won the election. If there is a tie for first place, display all candidates with the equal highest number of
votes.
a)
All variables, constants and other identifiers must have meaningful names.

i)
Identify one constant you could have used for Task 1, give the value that would be assigned to it and its use.

Constant .........................................................
Value ................................................................
Use ....................................................................
[3]
ii)
Identify one variable and one array you could have used for Task 1.
Explain the use of each one.

Variable ..........................................................
Use ...................................................................

Array ................................................................
Use ....................................................................
[4]
[7 marks]

Page 7 of 13

© 2015-2023 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers

7/21
Combined By NESRINE

Head to savemyexams.co.uk for more awesome resources

Question 7b
b)
Explain how you should change your program in Task 1 to allow a tutor to enter up to eight candidates for the election.
[4]
[4 marks]

Page 8 of 13

© 2015-2023 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers

8/21
Combined By NESRINE

Head to savemyexams.co.uk for more awesome resources

Question 7c
Task 2 – Checking that students only vote once.
Each student is given a unique voter number by their teacher.
Extend Task 1 to achieve the following:
Allow students to enter their unique voter number before casting their vote
Check whether the student has already voted
if so, supply a suitable message and do not allow them to vote
if not, store the unique voter number, but not their vote, in a suitable data structure, and add their vote to the
relevant candidate count or abstention
c)
Write an algorithm using pseudocode, programming statements or a flowchart to show how your program completes these
parts of Task 2:
Allows students to enter their unique voter number before casting their vote.
Checks whether the student has already voted:
– if so, supplies a suitable message and does not allow them to vote.
– if not, stores the unique voter number, but not their vote, in a suitable data structure.
It is not necessary to show parts completed in Task 1, including counting of votes for each candidate.
[5]
[5 marks]

Page 9 of 13

© 2015-2023 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers

9/21
Combined By NESRINE

Head to savemyexams.co.uk for more awesome resources

Question 7d
Task 3 – Showing statistics and dealing with a tie. Extend Task 2 to achieve the following:
Calculate the percentage of the votes that each candidate received from the number of votes cast, excluding
abstentions
Display the name of each candidate, the number of votes and the percentage of votes they received from the number
of votes cast, excluding abstentions
Display the total number of votes cast in the election and the number of abstentions
In the event of a tie, allow the election to be immediately run again, with only the tied candidates as candidates, and all
the students from the tutor group voting again
d)
Explain how your program completes these parts of Task 3:
Calculate the percentage of the votes that each candidate received from the number of votes cast, excluding
abstentions.
Display the name of each candidate, the number of votes and the percentage of votes they received from the number
of votes cast, excluding abstentions.
Display the total number of votes cast in the election and the number of abstentions.
Any programming statements used in your answer must be fully explained.
[4]
[4 marks]

Page 10 of 13

© 2015-2023 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers

10/21
Combined By NESRINE

Head to savemyexams.co.uk for more awesome resources

Question 8
Name and describe the most appropriate programming data type for each of the examples of data given. Each data type
must be different.

Data: 37
Data type name ............................................................................
Data type description ..................................................................

Data: Cambridge2021
Data type name .............................................................................
Data type description ...................................................................

Data: 47.86
Data type name .............................................................................
Data type description ...................................................................

[6]
[6 marks]

Page 11 of 13

© 2015-2023 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers

11/21
Combined By NESRINE

Head to savemyexams.co.uk for more awesome resources

Question 9
The pseudocode algorithm shown has been written by a teacher to enter marks for the students in her class and then to
apply some simple processing.
Count ← 0
REPEAT
INPUT Score[Count]
IF Score[Count] >= 70
THEN
Grade[Count] ← "A"
ELSE
IF Score[Count] >= 60
THEN
Grade[Count] ← "B"
ELSE
IF Score[Count] >= 50
THEN
Grade[Count] ← "C"
ELSE
IF Score[Count] >= 40
THEN
Grade[Count] ← "D"
ELSE
IF Score[Count] >= 30
THEN
Grade[Count] ← "E"
ELSE
Grade[Count] ← "F"
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
Count ← Count + 1
UNTIL Count = 30

Describe how you could change the algorithm to allow teachers to use it with any size of class.
[3]
[3 marks]

Page 12 of 13

© 2015-2023 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers

12/21
Combined By NESRINE

Head to savemyexams.co.uk for more awesome resources

Page 13 of 13

© 2015-2023 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers

13/21
Combined By NESRINE

Head to savemyexams.co.uk for more awesome resources

8.2 Arrays
Question Paper

Course CIE IGCSE Computer Science


Section 8. Programming
Topic 8.2 Arrays
Difficulty Medium

Time allowed: 30
Score: /24
Percentage: /100

Page 1 of 6

© 2015-2023 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers

14/21
Combined By NESRINE

Head to savemyexams.co.uk for more awesome resources

Question 1
All variables, constants and other identifiers should have meaningful names.

i)
Declare the array to store the students’ names.
[1]
ii)
Declare the arrays to store each student’s marks and total score.
[2]
[3 marks]

Page 2 of 6

© 2015-2023 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers

15/21
Combined By NESRINE

Head to savemyexams.co.uk for more awesome resources

Question 2
The pseudocode algorithm shown has been written by a teacher to enter marks for the students in her class and then to
apply some simple processing.
Count ← 0
REPEAT
INPUT Score[Count]
IF Score[Count] >= 70
THEN
Grade[Count] ← "A"
ELSE
IF Score[Count] >= 60
THEN
Grade[Count] ← "B"
ELSE
IF Score[Count] >= 50
THEN
Grade[Count] ← "C"
ELSE
IF Score[Count] >= 40
THEN
Grade[Count] ← "D"
ELSE
IF Score[Count] >= 30
THEN
Grade[Count] ← "E"
ELSE
Grade[Count] ← "F"
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
Count ← Count + 1
UNTIL Count = 30

Write the pseudocode to output the contents of the arrays Score[] and Grade[] along with suitable messages.
[3]

[3 marks]

Page 3 of 6

© 2015-2023 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers

16/21
Combined By NESRINE

Head to savemyexams.co.uk for more awesome resources

Question 3
Using a single loop, write an algorithm in pseudocode to output 50 names that have been stored in the array, Name[]
[3]
[3 marks]

Page 4 of 6

© 2015-2023 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers

17/21
Combined By NESRINE

Head to savemyexams.co.uk for more awesome resources

Question 4
The 1D array StudentName[ ]contains the names of students in a class. The 2D array StudentMark[ ] contains the mark for each
subject, for each student. The position of each student’s data in the two arrays is the same, for example, the student in
position 10 in StudentName[ ]and StudentMark[ ]is the same.
The variable ClassSize contains the number of students in the class. The variable SubjectNo contains the number of subjects
studied. All students study the same number of subjects.
The arrays and variables have already been set up and the data stored.
Students are awarded a grade based on their average mark.
Average mark Grade awarded
greater than or equal to 70 distinction
greater than or equal to 55 and less than 70 merit
greater than or equal to 40 and less than 55 pass
less than 40 fail

Write a program that meets the following requirements:


calculates the combined total mark for each student for all their subjects
calculates the average mark for each student for all their subjects, rounded to the nearest whole number
outputs for each student:
– name
– combined total mark
– average mark
– grade awarded
calculates, stores and outputs the number of distinctions, merits, passes and fails for the whole class.
You must use pseudocode or program code and add comments to explain how your code works.

You do not need to initialise the data in the array.


[15]
[15 marks]

Page 5 of 6

© 2015-2023 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers

18/21
Combined By NESRINE

Head to savemyexams.co.uk for more awesome resources

Page 6 of 6

© 2015-2023 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers

19/21
Combined By NESRINE

Head to savemyexams.co.uk for more awesome resources

8.3 File Handling


Question Paper

Course CIE IGCSE Computer Science


Section 8. Programming
Topic 8.3 File Handling
Difficulty Medium

Time allowed: 10
Score: /3
Percentage: /100

Page 1 of 2

© 2015-2023 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers

20/21
Combined By NESRINE

Head to savemyexams.co.uk for more awesome resources

Question 1
Explain why a program might need to store data in a file.
[3]
[3 marks]

Page 2 of 2

© 2015-2023 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers

21/21

You might also like