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

Past Paper 2 Questions

Uploaded by

7 snow
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)
232 views11 pages

Past Paper 2 Questions

Uploaded by

7 snow
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

Past Paper 2 Questions

1.) 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.

Check 1 ..............................................................................................................................................

Purpose .............................................................................................................................................

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

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

Check 2 ..............................................................................................................................................

Purpose .............................................................................................................................................

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

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

(b) Give the name of one verification check.

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

(c) Describe the difference between validation and verification

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

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

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

………...................................................................................................................................................
2.) Most programming languages include basic data types. Ahmad is describing the basic data types he
has used.
State the data type that Ahmad is describing in each sentence.
Choose the data type from this list of programming terms.
Array Boolean Char Constant Function Integer
Iteration Procedure Real String Variable

A number with a fractional part that can be positive or negative and used in calculations
Data type ..........................................................................................................................................

A whole number that can be positive, negative or zero and used in calculations
Data type ..........................................................................................................................................

A single number, symbol or letter


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

A sequence of characters
Data type ..........................................................................................................................................

A data type with two values, True or False


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

3.) Arrays are data structures used in programming. Explain what is meant by the terms dimension and
index in an array. Use examples of arrays in your explanations

Dimension

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

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

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

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

Index

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

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

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

………………………………………………………………………………………………………………………………………………………………….
4.) Four programming concepts and five descriptions are shown.
Draw a line to connect each Programming concept to its correct Description. Not all Descriptions will be
connected to a Programming concept.

5.) A one-dimensional array dataArray[20] needs each element set to zero.


(a) Write a pseudocode routine that sets each element to zero. Use the most suitable loop structure

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

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

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

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

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

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

(b) Explain why you chose this loop structure

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

………………………………………………………………………………………………………………………………………………………………….
6.) Tick (√) one box in each row to identify if the statement is about validation, verification or neither.

Statement Validation (√) Verification (√) Neither (√)

a check where data is re-entered to


make sure no errors have been
introduced during data entry
an automatic check to make sure the
data entered has the correct number
of characters
a check to make sure the data entered
is sensible
a check to make sure the data entered
is correct

7.) (a) Describe a one-dimensional array. Include an example of an array declaration

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

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

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

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

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

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

(b) Explain how indexing could be used to search for a value stored in a one-dimensional array

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

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

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

………………………………………………………………………………………………………………………………………………………………….
8.) Draw a line to connect each programming concept to the most appropriate description.

9.) 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.

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

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

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

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

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

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

10.) Describe one type of test data that must be used to test if a program accepts valid input data.

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

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

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

………………………………………………………………………………………………………………………………………………………………….
11.) Four descriptions of stages in the program development life cycle are shown.
Draw one line to link each description to its most appropriate program development life cycle stage.
Not all program development life cycle stages will be used

12.) State three different features of a high-level programming language that a programmer could use to
make sure that their program will be easier to understand by another programmer.
Give an example for each feature.

Feature 1 …………………………………………………………………………………………………………………………………………………

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

Example ……………………………………………………………………………………………………………..……………………………………

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

Feature 2 …………………………………………………………………………………………………………………………………………………

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

Example ……………………………………………………………………………………………………………..……………………………………

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

Feature 3 …………………………………………………………………………………………………………………………………………………

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

Example ……………………………………………………………………………………………………………..……………………………………

………………………………………………………………………………………………………………………………………………………………….
13.) Explain why a programmer would use procedures and parameters when writing a program.

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

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

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

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

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

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

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

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

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

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

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

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

14.) Tick (3) one box to show which library routine returns the remainder of a division
Mark Scheme
1.a) Check: Range, Length, Type, Check Digit
Purpose:
- To make sure the data entered falls within a specific set of values.
- To make sure the data entered is not longer than specified.
- To make sure the data entered follows rules related to whether it is numbers or letters.
- To make sure an identification code entered is genuine or possible

1.b) Double entry/Visual check

1.c) Validation checks if the data entered is possible/it cannot check if data has been entered correctly.
Verification checks if the data entered matches the data submitted for entry/ it does not check if data
matches set criteria.

2.) Real, Integer, Char, String, Boolean

3.) The dimension is the number of indexes required to access an element.


The index is the position of the element in an array.
For example Array[25] is the 25th element of a one-dimensional array called Array[ ].

4.)
5.a)
FOR Count 1 TO 20
dataArray[Count] = 0
endloop

5.b) A FOR loop has a fixed number of repetitions


No need to manage the loop counter
no need to use another variable for the array index

6)

7.a) a list of items…


• … of the same data type
• … stored under a single identifier
• … with a single index to identify each element
EXAMPLE: int RoomNum[] = new int[10]

7.b) using a counter to index the array so that the same code can be repeatedly used to check every
element in the array.

8.)
9.) verification is used to make sure the items are accurately copied
types: double entry, visual check
entering data twice to ensure no errors have occurred, human-eye checking of data to ensure its copied
accurately

10.) One mark per mark point


• *type of test data …
• … description of test data*
EXAMPLE: integer (int), data type that accepts whole numbers

11.)

12.) Feature 1: ensuring that all identifiers have meaningful names


example: int RoomNum
Feature 2: using comments to explain how the program works
example: //all values are zeroed before the next calculation
Feature 3: using procedures and functions for the tasks within a program
example: CalculateInterest(Deposit, Rate)
13.) Procedures:
- to enable the programmer to write a collection of programming statements under a single identifier
allows procedures and functions to be re-used within the program or in other programs
- to enable different programmers to work on different procedures in the same project
- to make programs easier to maintain due to being shorter
Parameters:
- to pass values from the main program to a procedure so that they can be used in the procedure
- allow the procedure to be re-used with different data

14.) B

By: Qasim Ali , S.Ali Al-Sharaf , Hasan Al-Qayem

You might also like