0% found this document useful (0 votes)
21 views11 pages

File Handeling Question

Uploaded by

Rayan ali
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)
21 views11 pages

File Handeling Question

Uploaded by

Rayan ali
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/ 11

FILE HANDLING QUESTIONS

1. Explain why a program might need to store data in a file. [3] (Q9/2210/02/SP/23)
__________________________________________________________________________________
__________________________________________________________________________________
__________________________________________________________________________________
__________________________________________________________________________________

2. Q. a) Circle the two actions that a program needs to take to store data in a file. Activate calculate
close open output print read search sort write [2]
__________________________________________________________________________________
__________________________________________________________________________________

b) A program halted unexpectedly with the error message ‘File not found’ whilst trying to read data
from a file. Outline the actions that the program needs to take to prevent this error occurring. [2]
(Q4/2210/02B/SP/23)
__________________________________________________________________________________
__________________________________________________________________________________

STRUCTURE DIAGRAMS

1. Tick correct one box in each row to identify if the statement a out structure diagrams is true
or false. (Q2/21/M/J/20)

2. A satellite navigation system is an example of a computer system that is made up of sub-


systems. Part of a satellite navigation system:
• allows the user to enter details for a new destination or select a previously saved destination •
displays directions in the form of a visual map or as a list. Draw a structure diagram for this part of
the satellite navigation system. [4] (Q4/2210/02/SP/23)

1|Page
3. A food ordering system is an example of a computer system that is made up of sub-systems. The
food ordering system:
• allows the user to enter the details of the food they want to order and to pay for the order
• displays food available as pictures or as a list.
Complete the structure diagram for the given parts of the food ordering system. (Begin with Food
ordering system)

TEST DATA

1. Give one piece of normal test data and one piece of erroneous test data that could be
used to validate the input of an email address. State the reason for your choice in each case.
Normal test data..............................
Reason.........................................................................................................................................
Erroneous test data..........................
Reason......................................................................................................................................... [4]
(Q3/21/M/J/22)

2. A program checks that the data entered is between 1 and 100 inclusive. Identify one
piece of normal, extreme and erroneous test data for this program, and give a reason for each.
Normal test data
.................................................................................................
Reason
..................................................................................................................................................................
..................................................................................................................................................................
.................................
Extreme test data
...............................................................................................
Reason
..................................................................................................................................................................
..................................................................................................................................................................
.................................
Erroneous test data
............................................................................................
Reason
..................................................................................................................................................................
..................................................................................................................................................................
................................. [6] (Q3/22/O/N/21)

2|Page
3. An algorithm allows a user to input their password and checks that there are at least eight
characters in the password. Then, the user is asked to re-input the password to check that both
inputs are the same. The user is allowed three attempts at inputting a password of the correct length
and a matching pair of passwords. The pre-defined function LEN(X) returns the number of characters
in the string X.
01 Attempt ← 0
02 REPEAT
03 PassCheck ← TRUE
04OUTPUT "Please enter your password”
05INPUT Password
06IF LEN (Password) < 8
07THEN
08 PassCheck ← TRUE
09 ELSE
10 OUTPUT "Please re-enter your password”
11 INPUT Password2
12 IF Password <> Password
13 THEN
14 PassCheck ← FALSE
15 ENDIF
16 ENDIF
17 Attempt ← Attempt + 1
18 UNTIL PassCheck OR Attempt <> 3
19 IF PassCheck
20 THEN
21 OUTPUT "Password success"
22 ELSE
23 OUTPUT "Password fail"
24 ENDIF

c) Give two sets of test data for this algorithm and a reason for choosing each set. Each set of test
data and its reason must be different.
Set1....................................................................................................................
Reason......................................................................................................................................................
.....................................................................................
Set2....................................................................................................................
Reason......................................................................................................................................................
.............................................................................. [4] (Q2c/22/M/J/22)

4. Q. Describe one type of test data that must be used to test if a program accepts valid input data.
[2] (Q4/22/O/N/22)
__________________________________________________________________________________
__________________________________________________________________________________

3|Page
5. This pseudocode algorithm is used as a validation check. PRINT "Input a number from 1 to 5000"
REPEAT
INPUT Number
IF Number < 1 OR Number > 5000
THEN
PRINT "Invalid number, please try again"
ENDIF
UNTIL Number >= 1 AND Number <= 5000 PRINT Number, “is within the correct range"

Identify three different types of test data. For each type, give an example of the test data you would
use to test this algorithm and state a reason for your choice of test.
Type of test data 1
…………………………………………………………...............................................................................................
Test data
.........................................................................................................................................................
Reason
..................................................................................................................................................................
................................................................................................................................................
Type of test data 2
.........................................................................................................................................................
Test data
.........................................................................................................................................................
Reason
..................................................................................................................................................................
................................................................................................................................................
Type of test data 3
.........................................................................................................................................................
Test data
.........................................................................................................................................................
Reason
..................................................................................................................................................................
................................................................................................................ [3] (Q3/22/O/N/20)

6. Q. A programmer has written an algorithm to check that prices are less than $10.00 these
values are used as test data:
10.00
9.99
Ten
State why each value was chosen as test data. [3] (Q8/2210/02/SP/23)
__________________________________________________________________________________

4|Page
__________________________________________________________________________________
__________________________________________________________________________________
__________________________________________________________________________________

7. A program checks if the weight of a baby is at least 2 kilograms. Give, with reasons, two
different values of test data that could be used for a baby’s weight. Each reason must be different.
[4] (Q3/2210/02B/SP/23)
__________________________________________________________________________________
__________________________________________________________________________________
__________________________________________________________________________________
__________________________________________________________________________________

VERIFICATION & VALIDATION CHECKS

1. This section of program code may be used as a validation check.

1 PRINT "Input a value between 0 and 100 inclusive"


2 INPUT Value
3 WHILE Value < 0 OR Value > 100
4 PRINT "Invalid value, try again"
5 INPUT Value
6 END WHILE
7 PRINT "Accepted: ", Value

a) Give a name for this type of validation check. [1]


__________________________________________________________________________________

b) Describe what is happening in this validation check. [2] (Q4ab/21/M/J/19)


__________________________________________________________________________________
__________________________________________________________________________________

2. Programs can perform validation and verification checks when data is entered.

a) Give the names of two different validation checks and state the purpose of each one. [4]
__________________________________________________________________________________
__________________________________________________________________________________
__________________________________________________________________________________
__________________________________________________________________________________

b) Give the name of one verification check. [1]


__________________________________________________________________________________

c) Describe the difference between verification & validation. [2] (Q3/21/M/J/20)


__________________________________________________________________________________
__________________________________________________________________________________

3.

5|Page
4.

5. An algorithm allows a user to input their password and checks that there are at least eight
characters in the password. Then, the user is asked to re-input the password to check that both
inputs are the same. The user is allowed three attempts at inputting a password of the correct length
and a matching pair of passwords. The pre-defined function LEN(X) returns the number of characters
in the string X.

6|Page
b) The algorithm includes two types of check on the data input. Identify and describe each type of
check.
Type of check 1...................................................................................................
Description
..................................................................................................................................................................
..................................................................
Type of check 2...................................................................................................
Description
..................................................................................................................................................................
.................................................................. [4] (Q2b/22/M/J/22)

6. Describe the use of verification on input of data when entering a list of items in stock into a
database. Explain why verification is necessary. [3] (Q3/22/O/N/22)
__________________________________________________________________________________
__________________________________________________________________________________
__________________________________________________________________________________
__________________________________________________________________________________

7. A check digit is to be used to validate an identification number on input.

c) Identify two other validation checks that could be used when inputting this identification number.
[2] (Q3c/23/O/N/22)
__________________________________________________________________________________
__________________________________________________________________________________
__________________________________________________________________________________
__________________________________________________________________________________

7|Page
8. Describe the purpose of validation and verification checks during data entry. Include an
example for each. [4] (Q2/02/SP/23)
__________________________________________________________________________________
__________________________________________________________________________________
__________________________________________________________________________________
__________________________________________________________________________________

9. A range check is used to check that a value input is above 10 and below 20.Tick correct on
box to show which value would be accepted.

A 10 ⬜
B 15 ⬜
C 20 ⬜
D 30 ⬜
[1] (Q1/2210/02B/SP/23)

10. All variables, constants and other identifiers must have meaningful names.
(a) Identify two variables that you could have used for Task 1. Give the data type and state the
use of each variable.

Variable 1 ..................................................................................................................................

Data type ..................................................................................................................................

Use ...........................................................................................................................................

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

Variable 2 ..................................................................................................................................

Data type ..................................................................................................................................

Use ...........................................................................................................................................

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

(b) Data input by a customer for Task 1 includes the day and the hour of arrival.
Identify one suitable validation check for each input and justify your choice. Your validation
checks must be different.
Day of arrival – validation check ...............................................................................................

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

8|Page
Justification ...............................................................................................................................

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

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

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

Hour of arrival – validation check .............................................................................................

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

Justification ...............................................................................................................................

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

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

...................................................................................................................................................
[4] 2210/22/M/J/20

11. A program needs to make sure the value input for a measurement meets the following rules: •
the value is a positive number • a value is always input • the value is less than 1000. (a) Describe the
validation checks that the programmer would need to use.
...................................................................................................................................................

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

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

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

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

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

(b) The program needs editing to include a double entry check for the value input. (i) State why this
check needs to be included.
...........................................................................................................................................
..................................................................................................................................... [1]
2210/22/M/J/23

12. A type of validation check is a length check. Another type of validation check is used to make
sure
that any date entered is in the dd/mm/yyyy style:
dd means day, mm means month and yyyy means year.

9|Page
(a) State the type of validation check used.

............................................................................................................................................. [1]
(b) Give one example of normal test data and one example of abnormal test data you should
use to make sure the check in part (a) is working properly.
State a reason for each of your choices of test data.

Normal ......................................................................................................................................

Reason .....................................................................................................................................

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

Abnormal ..................................................................................................................................

Reason .....................................................................................................................................

...................................................................................................................................................
[4]
(c) Describe how a length check could be used with the date entered.

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

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

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

............................................................................................................................................. [2]
2210/22/O/N/23
13. A programmer is writing a data entry program for booking theatre seats.
The programmer needs the program to accept only whole numbers that are greater than or equal
to one and less than or equal to six.
(a) Give the names of two validation checks that are required for this program.

1 ................................................................................................................................................

2 ................................................................................................................................................
[2

b)Complete this pseudocode to perform your two validation checks, using your answers given
in (a):
OUTPUT "Please enter the number of seats you want to book "
INPUT Seats
...................................................................................................................................................

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

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

10 | P a g e
...................................................................................................................................................

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

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

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

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

...................................................................................................................................................
[5]
(c) Give one item of test data to use when testing this program.
State the reason for your choice of test data.

Test data ...................................................................................................................................

Reason for choice .....................................................................................................................

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

14. Tick (ü) one box to complete this sentence. A validation check to make sure that an email address
contains an ‘@’ sign is a

2210/21 Paper 2 May/June 2024

11 | P a g e

You might also like