Issuu on Google+

M150 Data, computing and information

Assignment Booklet 2

2010B Contents TMA M150 02

Cut-off date: 18 May 2010 (12 noon)


This assignment should be submitted via the electronic TMA (eTMA) system. You should write your solutions to the questions in a single word­ processed document, which we will refer to as your Solution Document. Head the document with your name, the number of the TMA (as given above) and your Personal Identifier. Submit your document as a zip archive file to the eTMA system on or preferably before the cut-off date shown above. You will need to make sure that you save your document in a format that your tutor can read, either .doc or .rtf. If you are in any doubt, please contact your tutor. The eTMA system can be accessed from your StudentHome page, and the system itself will give you further guidance on how to create and submit a Zip archive file. Your tutor will mark your script and return it to you via the eTMA system. Your mark for the TMA will be automatically recorded by the eTMA system. TMA 02 assesses your work on Units 4, 5, 6 and the first three sections of Unit 7 of M150. The marks allocated to each part of a question are indicated in the margin. The total marks for each question are shown at the beginning of each question.

Copyright Š 2010 The Open University

WEB 00894 9 13.1

Important notes

Citing references If your answer to a question draws on the course texts or any other source, then you should reference that source. It is important that the work of others is acknowledged: firstly, so that it does not appear you are claiming it as your own work and, secondly, so that the reader can consult the original source if they wish to do so. In M150, we use a version of the popular Harvard system of citing references. In this system, you insert citations in the text, giving the author’s name and the year of publication. At the end of the assignment you have a references section, listing the full references in alphabetical order by author. For example, you might have inserted the text citation: ‘We are in the midst of a major change in how we relate to technology.’ (Norman, 2007). In the references section, you would then include the entry: Norman, D.A. (2007) The design of future things, New York, Basic Books. The assignment page of the M150 website has a link to a help sheet on referencing. This covers various kinds of reference, but for M150 purposes you will normally only need to use a few kinds: Course texts – in the help sheet, see the example from T281. Newspaper: online – see the example from the Education Guardian. World Wide Web documents and sites – see the example of Spitzer, K.L., Eisenberg, M.B., & Lowe, C.A., and the example from the Open University Library. We recognise referencing is complicated, and so you will be forgiven for making the occasional small error in the format. Plagiarism In line with OU regulations, steps will be taken to ensure that the work you have submitted as this TMA is your own. This may include a sampling process to check that your work has not been copied from another student or from external sources such as the internet. Plagiarism will be severely dealt with by the University. A very clear statement on what constitutes plagiarism can be found at CMEs As CME 02 contains questions on Units 4, 5, 6 and 7, you may find it useful to attempt CME 02 before you start working on this TMA. Note that the complete set of CMEs (i.e. CMEs 01 to 04) also provide specimen questions for CMA 41, which you will do at the end of the course as the final piece of course assessment.

page 2 of 16

TMA M150 02 Question 1

Cut-off date: 18 May 2010 (12 noon)

(25 marks)

This question tests your understanding of Unit 4. It also contributes to the following general learning outcomes for the course: �

describe some of the common uses of data and how they influence the way the data is stored;

read and understand a simple computer program;

write short discursive pieces appropriate to the subject area, suitable for both technical and non-technical audiences.

When answering part (ii) you will need to consult the M150 HTML Essentials card. (i) Briefly explain what is meant by the term styling applied to an electronic document, and outline how this is achieved in the case of: • a word-processed document • a web page

[120 words]

(4 marks)

A note on word limits Sometimes a question sets a limit on the number of words you are allowed to use. This is because being concise is an important skill in report writing, and because a limit saves you from spending too much time writing more than is expected. If a question has a word limit, it will be indicated as in part (i) above, with the limit shown in square brackets like this: [120 words] At the end of an answer you should write how many words you used. Word processors include a tool to count words for you. Select the text concerned and, depending on the word processor, choose Word Count from the Tools menu or read the word count directly from the status bar. You will normally lose 1 mark if your answer exceeds the word limit, or if you do not state how many words you used. Note that the list of references at the end of an answer is not included in the word count.

page 3 of 16

(ii) Popular gardening magazine Garden Path sometimes runs special offers for its readers. They currently have an offer for spring bulbs, and readers may get details and order online. This means that a new page has to be added to the magazine’s website, and the web developer has come up with the page shown in Figure 1.

Figure 1

A sample web page

page 4 of 16

The HTML for this page is shown in Figure 2.



<TITLE>Reader offer</TITLE>



<H1>Special reader offer</H1>

<img src="daffodils.jpg">

<P>Lovely spring colour for your garden!</P>




<I>Dutch Master</I><BR>

50 bulbs for £5.50</P>





50 bulbs for £5.00</P>




<I>Joan of Arc</I><BR>

100 bulbs for £6.50</P>




<I>Galanthus nivalis</I><BR>

250 bulbs for £8.00</P>



<P><B>Free delivery for orders over £10</B></P>

<P><B>10% discount on orders over £20!</B></P>

<P><A HREF="#order.html">Order online</A> now!</P>



Figure 2 The HTML that produced the sample web page This HTML can be found in the file M150_TMA02_2010B_Q1(ii).html which you downloaded with this assignment. If you open this file in a browser, you should see something similar to Figure 1. (Note: it may not look exactly the same, as the file may be displayed slightly differently in different browsers.)

page 5 of 16

Study the HTML in Figure 2, and answer the following questions.

(a) What do the tags <P> and </P> mean? What would happen if the </P> tag was omitted? (b) It is decided to display the line ‘Lovely spring colour for your garden!’ as a level 2 heading. Write down the modified line of marked-up text. (c) Suppose we want to change the list of plant types to a bulleted list instead of a numbered list. What changes would need to be made to the HTML to achieve this? (d) It is decided to highlight the text ‘10% discount on orders over £20!’ in italics as well as bold type. Write down the modified line of marked-up text. (e) The web developer intended the hyperlink Order online to provide a link to a document order.html in the same folder. Although the text is displayed as a hyperlink, an error means that clicking it has no effect, and it does not allow the user to navigate to the target document. Say what is wrong, and write the line of marked-up text with the error corrected. (Note: in case you want to test your solution a file order.html is provided.) (11 marks)

(iii) (a) Readers may want to access the magazine’s website on different types of computer, including handheld devices and mobile phones. Explain briefly how HTML helps to make this possible. (b) The editor of Garden Path is considering whether they could cut costs by publishing the magazine only on the internet, and not on paper. Readers would pay to access the online content. Give two reasons why some readers might not be happy with that development. (4 marks)

page 6 of 16

(iv) Consider the XML shown in Figure 3, and answer the questions that follow.

<?xml version="1.0" encoding="utf-8"?> <PLANTLIST> <PLANT> <TYPE>Daffodil</TYPE> <VARIETY>Dutch Master</VARIETY> <PACKSIZE>50</PACKSIZE> <PRICE>5.0</PRICE> </PLANT> <PLANT> <TYPE>Tulip</TYPE> <VARIETY>Apeldoorn</VARIETY> <PACKSIZE>50</PACKSIZE> <PRICE>5.5</PRICE> </PLANT> <PLANT> <TYPE>Crocus</TYPE> <VARIETY>Joan of Arc</VARIETY> <PACKSIZE>100</PACKSIZE> <PRICE>6.5</PRICE> </PLANT> <PLANT> <TYPE>Snowdrop</TYPE> <VARIETY>Galanthus nivalis</VARIETY> <PACKSIZE>250</PACKSIZE> <PRICE>8.0</PRICE> </PLANT> </PLANTLIST> Figure 3

An XML page

(a) What is the purpose of the <PLANTLIST> and </PLANTLIST> tags? (b) Which pair of tags delimit each plant description? (c) What are the tags that describe the properties of each plant for sale? (6 marks)

page 7 of 16

Question 2

(25 marks)

This question tests your understanding of Unit 5. It also contributes to the following general learning outcomes for the course: �

describe some of the common uses of data and how they influence the way the data is stored;

write short discursive pieces appropriate to the subject area, suitable for both technical and non-technical audiences;

discuss the legal and ethical issues surrounding data acquisition, privacy, accuracy, surveillance, and the use of cryptography (and its possible compromise by legislation).

(i) Figure 4 shows a typical Windows Explorer window. In the left-hand pane the folder ‘TMA02’ is highlighted (i.e. selected). Study the file structure shown and answer the following questions.

Figure 4

A Windows Explorer window

(a) Give the full path name of the file Q1.doc. (b) Could there be another file on the disk called Q1.doc? Explain your answer. (c) Suppose that we move the file Q1.doc from folder TMA02 to folder TMA01. Explain in a sentence or two what happens to the document in terms of the organisation of storage on the disk. (7 marks)

page 8 of 16

(ii) A smart and computer savvy detective has been called in to investigate a ‘data mining’ company, because there is a suspicion that the company’s public statements may be concealing something. According to the company, it only stores information on the purchases, shopping habits, leisure interests, credit history etc. of individual citizens, which it sells legitimately for marketing purposes. No other personal data is stored.

This is based on the plot of Jeffery Deaver’s novel The Broken Window (Hodder and Stoughton, 2008).

However the detective has uncovered the following two facts: �

The data the company can legitimately hold about an individual only takes up 25 KB on average;

The company owns 500 PB (petabytes) of data storage capacity.

Explain why the detective suspects that there is something seriously wrong with the company’s statements. Key facts to use are �

1 petabyte (PB) = 1024 TB;

All the people alive today only add up to roughly 6800 million.

You should show any calculations you make and briefly explain them (4 marks)

(iii) Consider the following email address: Which part of this address represents �

the domain?

the user name?

the top-level domain? (3 marks)

(iv) (a) Garden Path magazine has hundreds of subscribers, and stores information about them including their names, addresses and subscription dates. Why, according to Unit 5, is it better to store this information in a database rather than in a text document? (b) This part refers to Tables 4.1 and 4.2 in Section 4.1 of Unit 5. From the information in the tables, how many members of staff at the XYZ Company own white cars with an engine size greater than 1500 cc? (c) Garden Path magazine also has a database of multimedia content, for example photographs of plants, and videos showing gardening procedures such as pruning, grafting, etc. Explain briefly why metadata is needed to make this database useful to the magazine staff. (5 marks)

(v) A recent article describes how people the author calls ‘crooks’ are targeting webmail accounts (email accounts that are accessed via a website, rather than by using an email program). They often use ‘keylogger’ spyware installed on the victim’s computer (or on any other machines they might use) to discover their webmail account username and password. They then email everyone in the account’s contact list, often trying to get readers to visit an e-commerce website, but sometimes making direct requests for money. The emails are coming from a genuine account, and so do not get blocked by anti-spam software.

page 9 of 16

One famous victim of this type of attack was the Secretary of State for Justice, Jack Straw. See: BBC (2009) Straw Hit by Internet Fraudsters [online] cs/7908498 (accessed 3 September 2009).

Discuss this scenario with reference to the ten principles of computer ethics which you can find listed in Section 5.3 of Unit 5. Which principles do you judge to have been infringed by the unauthorized users of the webmail accounts, and why? (For each principle you include you should quote it, and explain in a sentence or two how it has been contravened.) (Note: we do not expect you to be concerned with legal issues; you need only discuss the ethical aspects.) [200 words] Reference: Larkin, E. (2009) E-mail Crooks Target Webmail Accounts, PC World, 24 June 2009 [online] Available at: unts.html (accessed 4 September 2009). (6 marks)

page 10 of 16

Question 3

(25 marks)

This question assesses your understanding of Unit 6. It also contributes to the

following general learning outcomes for the course:


describe the basic composition of a simple computing system;


analyse a small computer program in terms of its inputs, programming

structures and outputs;


analyse a simple problem in terms of the necessary operations that are

required to develop a program.

(i) The following is a simple program, similar to the one discussed in Unit 6,

Subsection 4.2. Study the program, and answer the following questions. You

will also need to consult Subsection 5.1 for part (a).







(a) What type of language is being used in this program? Would it be

classified as a low-level or a high-level language? Give a reason for your


(b) Assuming the mnemonic codes are the same as those used in Unit 6,

describe in a sentence or two what the program will do when it is


(c) The program makes use of a register. Explain briefly what registers are,

and what they are used for.

(8 marks)


The exit from a car park is controlled by a system that checks tickets that drivers insert into a slot, and operates a barrier to allow cars to leave. The system has two modes: manual and automatic. The following operations are repeated as long as the system is in automatic mode. The system reads the next ticket. If it is valid, the system allows the car to pass. Otherwise the system ejects the ticket and calls an attendant. In either case the system can return to reading the next ticket (since the attendant will either issue a valid ticket, or move the car away from the exit). Following the example algorithms given in Unit 6, Section 6, write a set of

instructions for the system to control the barrier, using a repetition structure

and a selection structure. (Note: we are looking for a single set of instructions

that uses both structures, not two separate sets. You are asked to provide a

set of written instructions, not a diagram.)

In your answer you should use indentation to help make the structure of the

algorithm clear.

(4 marks)

page 11 of 16

In real life such systems are often controlled by small, robust computers called programmable logic controllers.

(iii) Figure 5 shows an algorithm that uses a while loop. For reference we have numbered the instructions. (1) (2) (3) (4) (5) (6)

set number to 2 while (NOT(number greater than 5)) write value of number in the output window move to the next line of the output window increase number by 2 write 'The End'

Figure 5 An algorithm using a while loop (a) Draw a trace table like that given on page 68 of Unit 6, showing what will happen when the algorithm is executed. (b) Suppose that instruction (2) was changed to: while (NOT(number is 5)) What would happen when this modified algorithm was run? (8 marks)

(iv) Truth tables can be used to show whether or not two Boolean expressions are equivalent. By copying (please make sure you copy the first two columns exactly as shown) and completing the truth tables given in Figure 6 below, show that NOT (NOT A OR B)

is equivalent to


Make sure you end your answer with a proper conclusion.


























Figure 6 Two truth tables to be completed (5 marks)

page 12 of 16

Question 4

(25 marks)

This question assesses your understanding of Unit 6 and Sections 1 to 3 of Unit 7. It also contributes to the following general learning outcomes for the course: �

analyse a small computer program in terms of its inputs, programming structures and outputs;

analyse a simple problem in terms of the necessary operations that are required to develop a program;

modify part of a computer program to incorporate specified operations on given data by choosing appropriate program structures.

(i) Suppose the JavaScript variables first and second have already been declared, and that the lines of JavaScript below are now executed in sequence. Write down the value of first and second after each line has been executed. Where the value is not known, write ‘undefined’. (a) first = 5; (b) second = first + 3; (c) first = first - second / 2 + 3; (d) second = first * 3; (4 marks)

(ii) The extract given in Figure 7 is an incomplete version of a JavaScript program that will output a ‘knock knock’ joke. It will prompt the user twice: �

once for a name to appear as the response to ‘Who’s there?’;

once for the string to go after the name to complete the punch line.

For example, if the user entered Isabel

in response to the first prompt, and not working? I had to knock!

in response to the second prompt, the program would display on the screen: Knock knock!

Who's there?


Isabel who?

Isabel not working? I had to knock!

(Note: to include an apostrophe in a JavaScript string it must be preceded by the escape character. See Program_7.3.9 and the JavaScript Essentials card.) The program should simply accept whatever strings the user enters; it is not required to check that the input is sensible (or even remotely funny!).

page 13 of 16



<TITLE>TMA 02 Q4(ii)</TITLE>


var name;

// Declare other variable here

name = window.prompt('Please enter a name to use in the joke', '');

// Prompt for other value here

// Output the customised joke here






Figure 7 An incomplete program to output a ‘knock knock’ joke The incomplete version of the program shown in Figure 7 can be found in the file M150_TMA02_20010B_Q4(ii).html that you downloaded with this assignment. (a) Complete the program by adding the extra lines of JavaScript needed to make the program work as specified above. You may find it useful to look at Activity 2.10 and its solution. Insert a copy of your completed program into your Solution Document. Important: please also include your completed M150_TMA02_2010B_Q4(ii).html file in the zip archive file you submit to the eTMA system. (It is possible that your tutor may want to run your program.) (b) When you have finished the program, run it. In your Solution Document include two screenshots: �

one showing the program prompting for the name to use, with the user having entered a response but not yet pressed OK;

one showing the joke displayed in the browser window. (5 marks)

(iii) Garden Path magazine offers incentives for readers who respond to the special offer on their website. Orders over £10 are delivered free, otherwise there is a charge of £2.50 per order. Orders over £20 also qualify for a 10% discount. Figure 8 shows an incomplete version of a program that will accept as an input the total value of the order, and output the amount payable. Note that the program already prompts the user for the total value of the order and converts the response to a number.

page 14 of 16



<TITLE>TMA 02 Q4(iii)</TITLE>


// A price calculation program for Garden Path magazine

var orderTotal;

// Total value of the order in pounds

orderTotal = window.prompt

('Please enter the total value of the order in pounds', ''); orderTotal = parseFloat(orderTotal); // Insert your code here </SCRIPT> </HEAD> <BODY> </BODY> </HTML>

Figure 8 Incomplete price calculation program Your task is to complete the coding of the program according to the

following specifications:

if the total value of the order is £10 or less, £2.50 delivery charge should be added;

if the total value of the order is more than £10 but not more than £20, no delivery charge is added (i.e. the total is left unchanged);

if the total value of the order is more than £20 there is no delivery charge, and 10% is deducted from the total;

in all cases the program should display the amount payable by the customer.

A copy of the incomplete program shown in Figure 8 can be found in the file M150_TMA02_2010B_Q4(iii).html that you downloaded with this assignment. (a) Write an algorithm that shows the logic of the program that you will write to meet the above specifications. You may find it helpful to look at the example on page 62 of Unit 6, under ‘More than two alternatives’. Your algorithm should consist of a set of written instructions. Use indentation to make the structure clear. (b) Using Program_7.3.9 to remind you how to use nested if...else structures, and drawing on your answer to part (a), complete the program so that it outputs an appropriate message, according to the specifications given above. Please note the following important points: �

There is no need for your program to check that the user’s input represents a valid number; you may assume that this will always be the case.

There is also no need to check that the number entered represents a sensible amount for the total value of an order for plants!

page 15 of 16

You do not need to worry about the number of decimal places shown in the output. Simply accept whatever number of decimal places JavaScript produces.

You should use indentation to help make the structure of your program clear, as described on pages 17 and 18 of the M150 Software Guide.

You should try to ensure that the messages output are clear, and use correct spelling and grammar.

Insert a copy of your completed program into your Solution Document. Please also include your completed M150_TMA02_20010B_Q4(iii).html file in the zip archive file that you submit to the eTMA system. (c) Run your program with each of the following inputs for the total value of the order: �




For each test, insert a screen shot showing the output into your Solution Document. (d) The tests you ran in part (c) are not sufficient on their own to give us confidence that the program will work correctly for all possible values that the user might input for the total value of the order. Explain briefly (in one or two sentences) why these tests are not adequate, and say what additional tests you would advise. (Note: you are not required to carry out these tests; you only need to say what the additional input values should be.) (16 marks)


page 16 of 16