Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
160 views19 pages

Computer Science 15 Marks Questions

Uploaded by

majidzaheer27
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)
160 views19 pages

Computer Science 15 Marks Questions

Uploaded by

majidzaheer27
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/ 19

15 MARKS

QUESTIONS
For IGCSE Computer Science
Q1) M/J/23/21
A one-dimensional (1D) array Days[ ] contains the names of the days of the week. A two-dimensional
(2D) array Readings [ ] is used to store 24 temperature readings, taken once an hour, for each of the
seven days of the week. A 1D array AverageTemp[ ] is used to store the average temperature for each
day of the week.

The position of any day's data is the same in all three arrays. For example, if Wednesday is in index 4 of
Days [ ], Wednesday's temperature readings are in index 4 of Readings[ ] andWednesday's average
temperature is in index 4 of AverageTemp [ ]

The temperature readings are in Celsius to one decimal place. Temperatures can only be from-20.0°C to
+50.0°C inclusive.

Write a program that meets the following requirements:


● input and validate the hourly temperatures for one week
● calculate and store the average temperature for each day of the week
● calculate the average temperature for the whole week
● convert all the average temperatures from Celsius to Fahrenheit by using the formulaFahrenheit
= Celsius * 9/5 +32
● output the average temperature in Celsius and in Fahrenheit for each day
● output the overall average temperature in Celsius and in Fahrenheit for the whole week.

You must use pseudocode or program code and add comments to explain how your code works.

You do not need to declare any arrays, variables or constants; you may assume that this has already
been done.

All inputs and outputs must contain suitable messages.

All data output must be rounded to one decimal place.

You will need to initialise and populate the array Days [ ] at the start of the program.

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

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

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

1
………………………………………………………………………………………………………………………….

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

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

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

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

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

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

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

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

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

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

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

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

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

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

2
………………………………………………………………………………………………………………………….

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

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

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

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

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

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

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

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

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

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

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

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

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

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

…………………………………………………………………………………………………………………….[15]

3
Q2) M/J/23/22
A two-dimensional (2D) array Account [ ] contains account holders' names and passwords for a
banking program.
A 2D array AccDetails[ ] has three columns containing the following details:
● column one stores the balance - the amount of money in the account, for example
250.00
● column two stores the overdraft limit - the maximum total amount an account holder
can borrow from the bank after the account balance reaches 0.00, for example 100.00
● column three stores the withdrawal limit - the amount of money that can be withdrawn
at one time,for example 200.00
The amount of money in a bank account can be negative (overdrawn) but not by more than the
overdraft limit.
For example, an account with an overdraft limit of 100.00 must have a balance that is greater
than or equal to-100.00
Suitable error messages must be displayed if a withdrawal cannot take place, for example if
the overdraft limit or the size of withdrawal is exceeded.
The bank account ID gives the index of each account holder's data held in the two arrays.
For example, account ID 20's details would be held in:
Account [20,1] and Account [20,2]
AccDetails[20,1] AccDetails[20,2] and AccDetails [20,3]
The variable Si ze contains the number of accounts.
The arrays and variable Si ze have already been set up and the data stored.
Write a program that meets the following requirements:
● checks the account ID exists and the name and password entered by the account
holder match the name and password stored in Account [ ] before any action can take
place
● displays a menu showing the four actions available for the account holder to choose
from:
1. display balance
2. withdraw money
3. deposit money
4. exit
● allows an action to be chosen and completed. Each action is completed by a procedure
with a parameter of the account ID.
You must use pseudocode or program code and add comments to explain how your code
works.All inputs and outputs must contain suitable messages.

You only need to declare any local arrays and local variables that you use.

You do not need to declare and initialise the data in the global arrays Account[ ] and AccDetails[ ] and the variable
Size

4
………………………………………………………………………………………………………………………….

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

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

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

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

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

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

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

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

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

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

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

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

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

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

5
………………………………………………………………………………………………………………………….

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

6
………………………………………………………………………………………………………………………….

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

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

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

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

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

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

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

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

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

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

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

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

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

……………………………………………………………………………………………………………………[15]

7
Q3) M/J/23/23
A two-dimensional (2D) array Contacts[ ] is used to store names and telephone
numbers. Allthe data is stored as strings. The array must have the capacity to
store 100 contacts in the form of:
● column 1 - contact names as: last name, first name
for example: Smith, John
● column 2 - telephone numbers.

The variable CurrentSize shows how many contacts are in the array.

Write a program that meets the following requirements:


● display a menu of choices:
-enter new contact details
-display all the contact details
-delete all the contact details
● validate the menu input
● allow up to a maximum of five new contacts to be added to the array at
any one time
● do not allow more than 100 contacts in total
● after new contacts have been added, sort the array by contact name, as
long as there are at least two contacts in the array
● output the whole of the array
● delete the contents of the array.

You must use pseudocode or program code and add comments to explain how
your code works.

You do not need to declare any arrays, variables or constants; you may assume
that this has already been done.

All inputs and outputs must contain suitable messages.

You do not need to initialise the data in the array Contacts [ ] and the variable
CurrentSize

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

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

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

8
………………………………………………………………………………………………………………………….

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

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

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

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

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

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

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

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

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

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

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

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

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

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

9
………………………………………………………………………………………………………………………….

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

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

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

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

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

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

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

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

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

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

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

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

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

……………………………………………………………………………………………………………………[15]

10
Q4)F/M/23/22
The one-dimensional (1D) array TeamName[ ] contains the names of teams in a sports
league.The two-dimensional (2D) array TeamPoints[ ] contains the points awarded for
each match.The position of each team's data in the two arrays is the same. For
example, the team stored at index 10 in TeamName [ ] and TeamPoints[ ] is the same.

The variable LeagueSize contains the number of teams in the league. The variable
MatchNo contains the number of matches played. All teams have played the same
number of matches.

The arrays and variables have already been set up and the data stored.
Each match can be played at home or away. Points are recorded for the match results
of eachteam with the following values:
● 3-away win
● 2-home win
● 1-drawn match
● 0 - lost match.

Write a program that meets the following requirements:


● calculates the total points for all matches played for each team
● counts the total number of away wins, home wins, drawn matches and lost
matches for each team
● outputs for each team:
— name
— total points
— total number of away wins, home wins, drawn matches and lost
matches
● finds and outputs the name of the team with the highest total points
● finds and outputs the name of the team with the lowest total points.

You must use pseudocode or program code and add comments to explain how your
code works.

You do not need to declare any arrays, variables or constants; you may assume that
this has already been done.

All inputs and outputs must contain suitable messages.

You do not need to initialise the data in the arrays TeamName[ ] and TeamPoints[ ] or the variables
LeagueSize and MatchNo

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

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

11
………………………………………………………………………………………………………………………….

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

12
………………………………………………………………………………………………………………………….

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

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

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

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

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

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

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

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

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

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

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

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

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

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

13
………………………………………………………………………………………………………………………….

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

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

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

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

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

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

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

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

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

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

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

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

……………………………………………………………………………………………………………………[15]

14
Q5)SP/23
The names of patients are stored in the one-dimensional (1D) array Patient[ ] of
type string.A separate two-dimensional (2D) array Readings [ ] stores the latest
data recorded about each patient. The array already contains the readings
taken by a nurse for each patient:
● temperature measured to one decimal place
● pulse rate, a whole number.

Temperature readings should be in the range 31.6 to 37.2 inclusive.


Pulse readings should be in the range 55.0 to 100.0 inclusive.

The hospital number given to the patient is used for the index on both arrays,
this is a value between 1 and 1000 inclusive.

When the data for a patient is checked a warning is given if any of the readings
are out of range.If both readings are out of range, then a severe warning is
given.

Write a procedure, using pseudocode or program code, that meets the


following requirements:
● takes the hospital number as a parameter
● checks if the number is valid
● outputs an error message and exits the procedure if the number is not
valid
● if the hospital number is valid:
— output the patient's name
— output 'Normal readings' if both the readings are within range
— output 'Warning' and the name of the reading e.g. 'Pulse' if one reading
is out of range
— output 'Severe warning' and the names of the two readings 'Pulse and
temperature' if一both readings are out of range
— exits the procedure.
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 arrays.


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

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

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

15
………………………………………………………………………………………………………………………….

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

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

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

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

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

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

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

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

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

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

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

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

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

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

16
………………………………………………………………………………………………………………………….

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

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

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

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

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

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

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

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

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

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

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

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

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

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

……………………………………………………………………………………………………………………[15]

17
[BLANK PAGE]

18

You might also like