cs(h)15b! - madras college · 2016-01-19 · cs(h)15b! computing science! !!!! ... dorothy could...
TRANSCRIPT
FOR OFFICIAL USE
National Qualifications
Mark
CS(H)15B Computing Science
Duration — 2 hours Fill in these boxes and read what is printed below. Full name of centre Town
Forenames(s) Surname Number of seat
Date of birth Day Month Year Scottish candidate number
D D M M Y Y
Total marks – 90 SECTION 1 – 20 marks
Attempt ALL questions.
SECTION 2 – 70 marks
Attempt ALL questions.
Show all workings.
Write your answers clearly in the spaces provided in this booklet. Additional space for
answers is provided at the end of this booklet. If you use this space you must clearly identify the question number you are attempting.
Use blue or black ink.
Before leaving the examination room you must give this booklet to the invigilator. If you do not, you may lose all marks for this paper.
© 2014 Perfect Papers – All rights reserved
SAMPLE COPY -
NOT FOR USE AS AN EXAM
Page two
MARKS DO NOT
WRITE IN THIS
MARGIN
SECTION 1 – 20 marks Attempt ALL questions 1. State what is meant by the term boolean variable. 1 2. Dorothy has just started programming and has created an algorithm to search
the array miles which holds 100 numbers.
Dorothy wishes to find the largest number in the array and has developed the
following algorithm.
Line
1 SET max_value TO 0
2 SET counter TO 1
3 REPEAT
4 IF miles[counter] > max_value THEN
5 SET max_value TO miles[counter]
6 END IF
7 SET counter TO counter + 1
8 UNTIL counter = 101
9 SEND max_value TO DISPLAY
Dorothy could use a variable called max_position as part of this algorithm.
She inserts a line of code after line 2.
SET max_position TO 1
With reference to the line numbers shown, state additional lines of code Dorothy would add to the program if she wished to use this variable. 2
SAMPLE COPY -
NOT FOR USE AS AN EXAM
Page three
MARKS DO NOT
WRITE IN THIS
MARGIN
3. A programming language uses 64-bits to represent real numbers such as the negative value -0.00000024. Explain how the 64-bits could be allocated to store such numbers. 3
4. David is a systems analyst and has begun work on a new project. Explain why
David will interview the client as part of his initial analysis for the project. 2
5. (a) State what is meant by the term logic error in programming. 1 (b) Explain why such errors may be difficult to detect. 1
SAMPLE COPY -
NOT FOR USE AS AN EXAM
Page four
MARKS DO NOT WRITE IN
THIS MARGIN
6. Wire-framing is an effective design notation which can be used to create low fidelity and high fidelity designs.
(a) Explain the difference between low fidelity and high fidelity designs. 2 (b) Explain how the combination of wire-framing and rapid application
development (RAD) would assist a developer when working with a client. 2
7. Books For You is a large online retailer. To ensure the security of the data in
their online ordering system, they make weekly backups of the whole system. Explain what additional backups would be required to ensure no loss of data in the event of a system failure. 2
SAMPLE COPY -
NOT FOR USE AS AN EXAM
Page five
MARKS DO NOT
WRITE IN THIS
MARGIN
8. Biometrics are being used increasingly as additional security precautions to access systems and data.
Explain two draw backs of using biometrics for authentication. 2 9. (a) EasySoft is developing a new software package. State when the
company would use beta testing. 1
(b) EasySoft, when developing their new software package, also make use
of usability testing. Describe a typical example of usability testing. 1
SAMPLE COPY -
NOT FOR USE AS AN EXAM
Page six
SECTION 2 – 70 marks MARKS DO NOT
WRITE IN THIS
MARGIN
Attempt ALL questions 10. A program has been written to manage the contacts on a mobile phone. The
program makes use of the following record structure.
RECORD TYPE contact
STRING: firstname
STRING: lastname
STRING: home_number
STRING: mobile_number
INTEGER: ring_tone
END RECORD
(a) Explain why a record is used for this data rather than individual
variables. 2
(b) The program will process 200 contacts. Declare a variable that can
store the 200 contacts. 2
SAMPLE COPY -
NOT FOR USE AS AN EXAM
Page seven
Question 10 (continued) MARKS DO NOT
WRITE IN THIS
MARGIN
(c) The program is to find and display the firstname, lastname and
mobile_number of all the contacts with a lastname entered by the user. Write a program that will search the contacts and display the required results. Your program should make use of your variable from 10(b). 5
SAMPLE COPY -
NOT FOR USE AS AN EXAM
Page eight
MARKS DO NOT
WRITE IN THIS
MARGIN
11. HomeAdvice have developed a function to return the council tax banding for properties in the top four bands (E, F, G, H) based on the house value. Council tax bands are calculated according to the following table:
House value Council Tax Band Less than 80000 E 80000 and over (but less than 106000) F 106000 and over (but less than 212000) G 212000 and over H The input and output of this function are shown in the diagram below.
The function was developed using the following algorithm to determine a
council tax band for any house value.
Line
1 SET taxband TO “-“
2 IF housevalue < 80000 THEN
3 SET taxband TO “E”
4 END IF
5 IF housevalue >= 80000 AND housevalue < 106000 THEN
6 SET taxband TO “F”
7 END IF
8 IF housevalue >= 106000 AND housevalue < 212000 THEN
9 SET taxband TO “G”
10 END IF
11 IF housevalue > 212000 THEN
12 SET taxband TO “H”
13 END IF
14 RETURN taxband
SAMPLE COPY -
NOT FOR USE AS AN EXAM
Page nine
MARKS DO NOT
WRITE IN THIS
MARGIN
Question 11 (continued) (a) Explain why this algorithm would return an incorrect taxband if the
housevalue is 212000. 2
(b) The developer of the function has said that the use of a series of IF statements is inefficient.
Using pseudocode or a language with which you are familiar, rewrite the algorithm to correct the error and make the code more efficient. 3
SAMPLE COPY -
NOT FOR USE AS AN EXAM
Page ten
MARKS DO NOT
WRITE IN THIS
MARGIN
(c) Danny works for HomeAdvice and is writing a program to calculate
housevalue’s and provide information about council tax bands. He has downloaded the corrected function, taxband, from the development server. Danny’s program calculates the current housevalue by multiplying two variables: base_price and percentage_increase together. The program also stores the value of the taxband in a variable called band.
Using pseudocode or a language with which you are familiar, write an
algorithm for a subroutine that will:
• Ask the user for the values for variables base_price and
percentage_increase.
• Use the function to assign the variable band • Display band on screen. 3 (d) Danny has been asked to complete a test plan for the software he has
been developing. Explain why a test plan is an important document for the software development processes. 2
SAMPLE COPY -
NOT FOR USE AS AN EXAM
Page eleven
MARKS DO NOT
WRITE IN THIS
MARGIN
12. Choose a contemporary development in software development languages. (a) Briefly describe the main features of this development. 2 (b) Describe one beneficial economic impact of this development. 1 (c) Describe one problem that this development might cause for society. 1
SAMPLE COPY -
NOT FOR USE AS AN EXAM
Page twelve
MARKS DO NOT
WRITE IN THIS
MARGIN
13. Paul requires a program to calculate the uncompressed size of a number of bit-
mapped graphics. The program will use the height and width (in pixels) and the bit-depth of each image to calculate the size. The data for the program is held in a text file.
(a) The image above is 1920 wide and 1080 high. It has uses 65536 colours.
Calculate the storage required to hold the uncompressed image data. 3
(b) Explain why an image using 258 colours would require the same amount
of storage as an image using 512 colours. 2
SAMPLE COPY -
NOT FOR USE AS AN EXAM
Page thirteen
Question 13 (continued) MARKS DO NOT
WRITE IN THIS
MARGIN
(c) The values for image height, width and bit-depth are to be read from a
text file and stored in three separate arrays.
The values in the file are stored in the following format. Text file
{ width 460
Image 1 height 230 bitdepth 8
{ width 1920
Image 2 height 1080 bitdepth 16
{ width 716
Image 3 height 230 bitdepth 8 … … … Using pseudocode or a language with which you are familiar, write the
algorithm to read in all the values from a text file called “imagedata” and store them in the appropriate array. 4
SAMPLE COPY -
NOT FOR USE AS AN EXAM
Page fourteen
MARKS DO NOT
WRITE IN THIS
MARGIN
Question 13 (continued) (d) The program is implemented using an object-oriented language that
makes use of methods. 2
(i) Describe two key characteristics of an object-oriented language. (ii) Explain the difference between a method and a function. 2
SAMPLE COPY -
NOT FOR USE AS AN EXAM
Page fifteen
MARKS DO NOT
WRITE IN THIS
MARGIN
14. CorrieCats run holiday lodging for cats when their owners are away. They have
three rooms which the cats stay in and each room has a single dedicated helper. The company has a database to store details of the cats, their accommodation, the cat owners and the helpers. The data is stored in the following tables.
Owner Room Cat Helper OwnerID RoomID CatID HelperID OwnerName RoomName CatName HelperName OwnerAddress CatDietNeeds HelperMobile OwnerMobile IndoorOnly RoomID* OwnerEmail MedicalInfo RoomID* OwnerID* (a) State the type of relationship between the following tables: Room and Cat Room and Helper 2 (b) The following form is used to enter details for each cat. Cat Name Percival Cat Diet Needs No Gravy Based Food Indoor Only Yes Medical Information Fully vaccinated, no illness on record Room ID 2 Owner ID 231 (i) Describe two ways of improving the usability of this form. 2 (ii) Explain why CatID is not shown on this form. 1
SAMPLE COPY -
NOT FOR USE AS AN EXAM
Page sixteen
MARKS DO NOT
WRITE IN THIS
MARGIN
Question 14 (continued) (c) The following is produced for a helper.
HelperName: Christian Grey RoomID: 2
Cat Name Owner Mobile IndoorOnly CatDietneeds
Ralph 07298 928192 Yes No Milk
Kermit 07298 928192 No None
Gonzo 07332 119221 Yes Low Fat
Piggy 07488 561920 Yes None
Describe how CorrieCats would use the database software to produce this report. 5
(d) The database software runs on a computer in the company office. The computer has a high-powered processor but is takes a long time to complete queries on the stored data.
(i) Explain why the queries may be taking so long to complete. 2
SAMPLE COPY -
NOT FOR USE AS AN EXAM
Page seventeen
MARKS DO NOT
WRITE IN THIS
MARGIN
Question 14 (continued) (ii) Suggest a way of reducing the time taken to complete a query. 1 15. VideoGarage is online tool that has just started development. The online tool
will edit and store video clips uploaded from mobile devices.
The developers are considering making the project open-source. (a) Describe two advantages of making the tool open-source at this stage of
development. 2
(b) Describe two difficulties the developers may face if they make the tool
open-source. 2
SAMPLE COPY -
NOT FOR USE AS AN EXAM
Page eighteen
MARKS DO NOT
WRITE IN THIS
MARGIN
Question 15 (continued) (c) VideoGarage is designed to makes use of lossless and lossy compression. Describe why lossy compression is generally more successful than lossless
compression in reducing the size of video files. 3
(d) VideoGarage is developed making use of server-side scripting and client-
side scripting and the tool runs as an application inside a web browser.
(i) The developers attempted to have video processing completed
entirely by client-sided scripting. Explain why this approach was unlikely to be successful for all users. 2
(ii) The processing of videos is changed so that it is carried out using
server-side scripting. Explain why this approach would have an impact on the hardware used to operate the tool. 2
SAMPLE COPY -
NOT FOR USE AS AN EXAM
Page nineteen
MARKS DO NOT
WRITE IN THIS
MARGIN
16. SmartBuys is an online car sales web site. It uses a dynamic database-driven
website to display the range of cars it has for sale. Details of each car are held within a relational database.
(a) Describe two reasons why a dynamic database-driven website is a benefit
for site visitors. 2
(b) To complete a purchase using the site, each user has to complete a
registration form to create a unique username and secure password.
(i) Describe one example of input validation that could be applied to
a username when it is first registered. 1
SAMPLE COPY -
NOT FOR USE AS AN EXAM
Page twenty
[B
MARKS DO NOT
WRITE IN THIS
MARGIN
Question 16 (continued) (b) (ii) Having a secure password may not prevent hackers using an
account. Explain how a hacker could attack a computer to gain a user’s password. 2
(c) When entering a car to be sold, the user must enter a valid car
registration number. This validation process is carried out by code written in a scripting language.
The first part of the validation process is to ensure that the registration
number entered is in the format LL00 LLL (letter, letter, number, number, space, letter, letter, letter).
In the language used, the syntax for an IF statement is:
If (expression)
{ commands(s)
}
The following code is used to validate the registration number. If (((gettype(registration.substring(0,1)) == “string”) &&
((gettype(registration.substring(2,3)) == “number”) &&
(registration.substring(4,4) == “ ”) && ((gettype(registration.substring(5,7)) == “string” ))
{ //valid registration format return true;
}
(i) Explain the operation of the substring command shown above. 1
SAMPLE COPY -
NOT FOR USE AS AN EXAM
Page twenty-one
MARKS DO NOT
WRITE IN THIS
MARGIN Question 16 (continued)
(c) (ii) Explain the operation of the gettype function shown above. 1
(c) (iii) Explain how the code above would process the validation of the registration number: SW12 LJX 2
SAMPLE COPY -
NOT FOR USE AS AN EXAM