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

Paper 2 Theory Questions and Answers

helooooooooooooooooooo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views11 pages

Paper 2 Theory Questions and Answers

helooooooooooooooooooo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

GN.Atoll.

Education Center computer science

Paper 2 theory questions and answers

1- Explain the difference between validation and verification?


Validation checks whether the data to be entered is reasonable / sensible / meets the
required criteria
Verification checks whether the data is not changed on entry

2- Describe using an example how data could be verified on data entry?


-double entry // suitable practical example
- the data will be entered twice
- compared by the computer or by a human
OR
-by visual verification // suitable practical example
- the data will be compared with the source document

3- Give an example for verification and validation


Validation: a range check tests the data entered fits with in specified values.
Verification: A double entry checks expects each item of data to be entered twice and
compares both entries to check they are the same.

4- Describe giving a different example for each, the purpose of these validation checks used
in programming.
Range check: to check the value input falls between a given a given upper bound and a
given lower bound. Eg: if month has to be input using an integer, it must be between 1
and 12 inclusive.

Length check: to check if the data input is over/under a certain number of characters
Eg: an international telephone number can be no longer than 15 digits.

Type check: to check if the input is of the correct data type


Eg: if the input is expecting integers to be entered it will not permit a string to be entered.

pg. 1
GN.Atoll.Education Center computer science

Character check: checks that when a string of characters is entered it does not contain
any invalid characters or symbols. Eg : name would not contain characters such as %.

Format check: check that data entered confirm to a pre-defined pattern. Eg: CUB
number must be in the form of CUB999

Presence check: checks to ensure that some data has been entered and the value has not
left blank Eg: an email address must be given for an online transaction.
Check digit : final digit included in a code it is calculated from all the other digits in the
code. Eg: International standard book number

5- List any 4 verification methods


Double entry
Screen / visual check
Parity check
Checksum

6- Explain how double entry is carried out


For double entry the data is entered twice, sometimes by different operators.
The computer system compares both entries and if they are different outputs an
error message requesting that the data is entered again.

7- Explain how screen/ visual check is carried out


is a manual check completed by the user who is entering the data. When the data entry is
complete the data is displayed on the screen and the user is asked to confirm that it is
correct before continuing. The user either checks the data on the screen against a paper
document that is being used as an input form or, confirms whether it is correct from their
own knowledge.

pg. 2
GN.Atoll.Education Center computer science

8- Define test data?


A set of test data is all the items of data required to work through a solution.

9- Describe and give example for each of the following test data
Normal data: a set of data that are accepted.
Erroneous data: the data that will be rejected as the values are not suitable.
Extreme data: extreme data are the largest and smallest values that normal data can take.
Boundary data: used to establish where the largest and smallest value occur. At each
boundary two values are required; one value is accepted and the other value is rejected.

10- Explain the difference between variable and variable constant


A variable is used to store data that can be change during the running of a program
A constant is used to store data that will not be changed during the running of program.
Value only needs to be changed once if circumstances change/ during the initialization
process.

11- Define the following


Array: is a way of storing data that is all related and of the same type. Each item that is
stored in an array can be accessed by referring to its location within the array.
Element: an individual data location in an array
One-dimensional array: array which contains one set of data
Two-dimensional array: array that holds two sets of data

12- Write down the advantages of arrays


To reduce the number of variables used
Any item can be found using an index number to show its place in the list

13- List some disadvantages of using arrays


An array has a fixed size which means you cannot add/delete elements after creation.
In the case of a large number of records, it may take more space than required for storing
the same information.

pg. 3
GN.Atoll.Education Center computer science

14- Write down the difference between library- routine and sub- routine
Library routine: is a set of programming instructions for a given task that is already
available for use. And it is pre-tested and usually performs a task that is frequently
required.
Sub-routine: set of programming instructions for a given task that forms a sub-system
not the whole system. E.g. procedures and functions.

15- Explain the following


Counting: counting is used to find how many numbers / items there are in a list
Totaling: totaling is used to sum a list of numbers
Iteration: when some actions performed as part of an algorithm need repeating
Selection: is the process of making a decision in a program. In a selection a question is
asked and then the correct path is taken depending on the answer.
Sequence: statements are followed in sequence so the order of the statement in a group is
important.
Pre-defined function: a pre-programmed set of instructions that returns a value
Pre-defined procedure: a pre-programmed set of instructions that do not return a value

16- Data types


-An integer is a whole number with no decimal point
- a real number is a number that does have a decimal point
- character is a data type that holds just one character
-Boolean data type is one that will hold two values only

-String a variable or constant that is several characters in length. Strings


vary in length and may even have no characters (known as an empty string);
the characters can be letters and/or digits and/or any other printable symbol
(If a number is stored as a string, then it cannot be used in calculations.)

pg. 4
GN.Atoll.Education Center computer science

17- Define structure diagram


An over view of a program or sub routine

18- List 2 selection methods and explain them


IF – THEN – ELSE: is used to use a condition that can be true/ false
It has IF condition and then the path to follow if the condition is true and the ELSE path
is followed if the condition is false

CASE-OF -ENDCASE: used if there is a choice between several different values.


For case condition the value of the variable decides the path to be taken.
Several values are usually specified and OTHERWISE is the path taken for all other
values.
The end of statement is shown by ENDCASE

19- Explain why you would choose the following statements


IF-THEN-ELSE: If there are many correct answers
CASE-OF-ENDCASE: checking a condition that may be complex
Uses relational operators Checking for a range of values

20- Explain the iterations


FOR -TO -NEXT: used when set number of repetitions .
a variable is setup with a start value and an end value and then incremented in steps of
one until end value is reached and the iteration finishes.

REPEAT-UNTIL : l11is loop structure is used when the number of


repetitions/iterations is not known and the actions arc repeated UNTIL a gi\· condition becomes
true. actions in this loop are always completed at least once.
WHILE-D0-ENDWHILE: This loop structure is used when the number of
repetitions/iterations is not

pg. 5
GN.Atoll.Education Center computer science

known and the actions arc only repeated WHILE a given condition is true. If the WHILE
condition is untrue when the loop is first entered then the actions in the loop arc never
performed.

21- Explain the difference between 1D and 2D arrays

An array is a data structure containing several elements of the same data type
These elements can be accessed using the same identifier name, the position of the elements is
identified using the index.
1D array : is referred as a list of multiple data items of the same data type
2D array : A two-dimensional array can be referred to as a table, with rows and columns.

22- Explain the difference between array index and dimension


Index
An array index is a numerical value that represents the position of an
element within an array.
 The index is used to access or reference a specific element in the
array.
 For example, in an array arr, arr[0] refers to the first element, arr[1]
refers to the second element, and so on.

Dimension (the size of the array )


Array dimension refers to the number of indices or subscripts needed to
uniquely identify an element within an array.

23- Explain the difference between local and global variables

pg. 6
GN.Atoll.Education Center computer science

BASIS FOR
LOCAL VARIABLE GLOBAL VARIABLE
COMPARISON
Variables are declared inside a Variables are declared outside any
Declaration
function. function.
Within a function, inside which they
Scope Throughout the program.
are declared.
Uninitialized local variable result in Uninitialized global variable stores
Value
storage of the garbage value. zero by default.
Accessed only by the statements,
Accessed by any statement in the
Access inside a function in which they are
entire program.
declared.
Data sharing Not provided Facilitated
Created when the function block is Remain in existence for the entire
Life
entered and destroyed upon exit. time your program is executing.
Local variables are stored on the Stored on a fixed location decided by
Storage
stack unless specified. a compiler.
Parameter passing Necessarily required Not required for global variables.
Any modification implied in a local The changes applied in the global
Changes in a variable
variable does not affect the other variable of a function reflect the
value
functions of the program. changes in the whole program.

24- Explain what is a structure diagram


Structure diagrams are a visual design technique used to show the steps needed to
solve a problem

25- Explain subsystems

pg. 7
GN.Atoll.Education Center computer science

each computer system can be divided up into a set of sub-systems.


Each sub-system can be further divided into sub-systems and so on
until each sub-system just performs a single action.
26- Explain linear search and bubble sort
linear search: or sequential search is a method for finding an element within a list. It
sequentially checks each element of the list until a match is found or the whole list has
been searched.
Bubble sort: is a simple sorting algorithm that repeatedly steps through the input list
element by element, comparing the current element with the one after it, swapping
their values if needed.
27- What is an algorithm
an ordered set of steps to solve a problem
28- What is a top-down design
the breaking down of a computer system into a set of sub-systems,
then breaking each subsystem
down into a set of smaller sub-systems, until each sub-system just
performs a single action
29- Explain the difference between procedure and function
procedure – a set of programming statements grouped together under a single name that
can be called to perform
a task in a program, rather than including a copy of the code every time the task is
performed
function – a set of programming statements grouped together under a single name which
can be called to perform a task in a program, rather than including a copy of the code
every time; just like a procedure except a function will return a value back to the main
program
30- Explain the difference between parameter and argument in a procedure/ function
Parameter
A parameter is a variable that is used in the function or procedure
declaration.
It is a placeholder for the actual value that will be passed into the
function or procedure when it is called.

pg. 8
GN.Atoll.Education Center computer science

Parameters define the input that a function or procedure expects


Argument
 An argument is the actual value that is passed to the function or
procedure when it is called.
 Arguments are the concrete values that are assigned to the
parameters.
 The values of arguments are substituted for the corresponding
parameters during the function or procedure execution.

31- Explain the functions of the following library routine functions


» MOD – returns remainder of a division
» DIV – returns the quotient (i.e. the whole number part) of a division
» ROUND – returns a value rounded to a given number of decimal places
» RANDOM – returns a random number.
32- Explain what are parameters Function sum (num1, num2 : INTEGER)
A variable identifier provided as input to a function.
Return num 1+num2
33- Explain what are arguments
} parameters
A value provided as input to a function.
Sum (5,6)

34- What are the things to consider when creating maintainable programs arguments
» Always use meaningful identifier names for:
– variables
– constants
– arrays
– procedures
–functions
» be divided into modules for each task using:
– procedures
– functions
» be fully commented using your programming language’s commenting feature.
35- What is the main purpose of storing data in files
Computer programs store data that will be required again in a file. While any
data stored in RAM will be lost when the computer is switched off, when data is

pg. 9
GN.Atoll.Education Center computer science

saved to a file it is stored permanently. Data stored in a file can thus be accessed
by the same program at a later date or accessed by another program. Data stored
in a file can also be sent to be used on other computer(s).
36- What are text files
A text file is often used to store program source code, configuration data, and
other types of textual information.
You can create a text file using any text editor or word processor. Simply
open a new file and start typing your text. When you are done, save the file
with a .txt extension.
37- What are the uses/ advantages of using text files
One of the main advantages of using text files is that they are simple and
easy to read and edit. They can be opened and edited using a simple text
editor, such as notepad, and they can be easily transferred between different
computer systems.

pg. 10
GN.Atoll.Education Center computer science

pg. 11

You might also like