The Bcs Higher Education Qualifications BCS Level 4 Certificate in IT

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

BCS THE CHARTERED INSTITUTE FOR IT

THE BCS HIGHER EDUCATION QUALIFICATIONS


BCS Level 4 Certificate in IT
SOFTWARE DEVELOPMENT
Tuesday 2nd April 2013 - Afternoon
Time: TWO hours
Section A and Section B each carry 50% of the marks. You are advised to spend about 1 hour on
Section A (30 minutes per question) and 1 hour on Section B (12 minutes per question).
Answer the Section A questions you attempt in Answer Book A
Answer the Section B questions you attempt in Answer Book B
The marks given in brackets are indicative of the weight given to each part of the question.

Calculators are NOT allowed in this examination.


When you are asked to write code, please state the language you are using.

SECTION A
Answer 2 questions (out of 4). Each question carries 30 marks.
A1

a)

Given a value V and an array A, write a section of program code to find out if the value V
occurs anywhere in the array A.
(7 marks)

b)

Convert your code into a function called indexOf which takes V and A as parameters and
returns the index of V in A if it is found, or -1 if it is not found.
(7 marks)

c)

Using the function indexOf, write a function called allDifferent which looks for duplicate values
in array A. The function allDifferent is to return true if there are no duplicates, false otherwise.
(8 marks)

d)

Finally incorporate these ideas into a complete program which reads 100 values from a file
into an array and then prints out a message saying either "The data values are all different" or
"There is at least one repeated value in the data".
(8 marks)

Turn over]

A2

A two dimensional array called Keypad holds information about the arrangement of letters on a
mobile phone keypad.
Keypad 0
0
1
2
3
4

' '

'A'
'B'
'C'

'D'
'E'
'F'

'G'
'H'
'I'

'J'
'K'
'L'

'M'
'N'
'O'

'P'
'Q'
'R'
'S'

'T'
'U'
'V'

'W'
'X'
'Y'
'Z'

If a number key k is pressed a total of n times in succession then Keypad[k][n] holds the resulting
character. This means that Keypad[2][1] contains 'A' and Keypad[9][4] contains 'Z'.
Another array called Message records the key presses that a user has made while sending an
SMS text message - for example:
0
Message 4

1
4

2
0

3
4

4
4

5
4

6
0

7
1

8
0

9
6

10
0

11
8

12
8

13
0

14
6

15
0

16
0

In this array 0 (zero) has been used to indicate a gap between letters and 0 immediately followed
by another 0 indicates the end of the message.
Write a program to decode a message from array Message (which in this example is HI MUM).
(30 marks)
A3

The array A has 10 elements and the following code has been written to shift every value in array
A one place to the right.

void rshift(int* A){


int i;
for(i=0;i<10;i++)
A[i+1]=A[i];
}

A
a)

0
'Q'

1
'W'

2
'E'

3
'R'

4
'T'

5
'Y'

6
'U'

7
'I'

8
'O'

9
'P'

Trace the call of rshift with the values of A shown in the table above.
(6 marks)

b) Describe in your own words two errors in this code.


(6 marks)
c) Give a version of rshift which corrects these errors.
(6 marks)
d)

e)

Modify your answer to c) so that the value which would be 'lost' from the right is placed in the
newly empty place on the left (this is called a cyclic shift to the right) - call this function rshiftc.
(6 marks)
Finally write a function lshiftc which again is a cyclic shift but this time the values shift
leftwards.
(6 marks)

Turn over]

A4

a)

Consider the code below and format it in a more familiar human-readable form.

int f(int k){int i=0;while(i<k)if(A[i]<'E')return(i);return(-1);}


(6 marks)
b)

State whether you agree with the following definitions and correct anything that you feel is
wrong.
Defn i) Free format means that a programmer is free to put in a space between any two
characters in the program.

Defn ii) Free format means that if you take all the spaces out of a program then the program
remains the same and the computer will execute it just the same.
(6 marks)
c) Referring to the code in part a), find and write out only the following:
i)
ii)
iii)
iv)
v)

all the different identifiers


all the different constants
a conditional (logical, boolean) expression
a conditional statement
the statement that is repeated by the loop

[Note that you should copy out exactly what is requested and no more]
(5 x 2 marks)
d)

Describe the structure of a for-loop (a counted loop) and describe the way that it is executed.
(8 marks)

SECTION B
Answer 5 questions (out of 8). Each question carries 12 marks.
B5

A business intends to make a long-term investment that will give them compound interest. The
formula to calculate annual compound interest is:

Where:

 
A = Final Amount
P = Principal Amount or Initial Investment
r = annual interest rate as a decimal
n = number of times interest is compounded each year
t = number of years

B6

a)

Write an expression in pseudocode to calculate the Final Amount using the formula
above.
(4 marks)

b)

Incorporate your expression into pseudocode or a program in a language of your choice


in which variables P, r, n and t are input and the Final Amount is printed for each year.
(8 marks)

Search and sort operations are commonly used on data.


a)

Explain the difference between searching and sorting in computers.


(2 marks)

B7

b)

Describe the operation of the binary chop search in a sorted array, assuming that the
target value is in the array. The answer can be described in words, or by pseudocode or
by actual program code.
(8 marks)

c)

Explain why a binary chop search is more efficient than a linear or sequential search.
(2 marks)

a)

Show diagrammatically a linked list that has 4 nodes, where each node consists of two
data items and a pointer. There is no need to include any data values in your diagram.
(3 marks)

b)

The data included in this list is a name (15 characters) and a membership number (5
digits). Give a declaration for this data structure in a language of your choice. State what
language you are using.
(3 marks)

c)

Develop an algorithm to search the list for a particular membership number requested
interactively. If the number is found, output the name with the number; otherwise output
the message unable to find membership number.
(6 marks)

Turn over]

B8

Documentation is an important part of the process of software development. Write BRIEF notes on
documentation to answer the following questions:
a)
b)
c)
d)
e)
f)

Why is documentation important?


Who is it for?
What does it consist of?
How is it produced?
When is it produced?
What problems can be experienced with documentation?
(6 x 2 marks)

B9

Web based interactive forms contain a range of interface elements that are suitable for the user to
enter data. Identify FOUR elements on a typical website interactive form and in each case, draw
the element and describe the type data entry for which it is most suitable.
Note that it is not necessary to draw the complete web page.
(4 x 3 marks)

B10 Write BRIEF notes to compare and contrast the following pairs of terms.
a)

compiler/interpreter

b)

data structure / program structure

c)

black box test / white box test

d)

hardware / software
(4 x 3 marks)

B11 Prototyping is a widely used software development method when the system requirements are
unclear.
a)

Draw and label a diagram of a Prototyping technique

b)

Briefly explain how Prototyping operates

(6 marks)
(2 marks)
c)

Describe TWO advantages of using Prototyping for developing software


(4 marks)

B12 a)

What is normally meant by the term 'debugging'?


(4 marks)

b)

How is debugging approached in a simple programming environment where the


programmer has only the standard output facilities of the programming language to use
for this purpose?
(4 marks)

c)

What extra facilities to assist in debugging might be provided in a more extensive


development environment?
(4 marks)

You might also like