You are on page 1of 44

Question 1 (15 marks)

You must give a word count for any question with a maximum word limit.

This question is about Block 2 Part 1. In Question 1, Question 3 and Question 6 of this TMA you

will explore the potential roles of cloud computing, smart devices and location-based services in

automated object recognition for the visually impaired.

In order to answer these three TMA questions, you will need to read the article that can be found

here: https://reader.elsevier.com/ HYPERLINK

"https://www.open.ac.uk/libraryservices/resource/article:143148&f=30867" HYPERLINK

"https://www.open.ac.uk/libraryservices/resource/article:143148&f=30867"reader/

HYPERLINK "https://www.open.ac.uk/libraryservices/resource/article:143148&f=30867"

HYPERLINK "https://www.open.ac.uk/libraryservices/resource/article:143148&f=30867"sd/

HYPERLINK "https://www.open.ac.uk/libraryservices/resource/article:143148&f=30867"

HYPERLINK "https://www.open.ac.uk/libraryservices/resource/article:143148&f=30867"pii/

HYPERLINK "https://www.open.ac.uk/libraryservices/resource/article:143148&f=30867"

HYPERLINK

"https://www.open.ac.uk/libraryservices/resource/article:143148&f=30867"S2666990021000148

token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA0

CC31B9A65C9E3FE24314417409B47F331 HYPERLINK

"https://www.open.ac.uk/libraryservices/resource/article:143148&f=30867"& HYPERLINK

"https://www.open.ac.uk/libraryservices/resource/article:143148&f=30867"originRegion=eu-

west-1 HYPERLINK
"https://www.open.ac.uk/libraryservices/resource/article:143148&f=30867"& HYPERLINK

"https://www.open.ac.uk/libraryservices/resource/article:143148&f=30867"originCreation=2022

0628134452

In order to answer the TMA questions, you will need to read the Abstract and sections 1, 2,

3 and 6 of this article (you will not need to read sections 4 and 5). Note: if and only if this

link becomes inaccessible will you then be able to download a pdf copy from the

Assessment page.

Each of Questions 1, 3 and 6 can be answered independently of each other but you may

find it useful to read all three questions before you start, so as to avoid any duplication in

your answers.

• a.Define what is meant by the Internet of Things (IoT). Then continue by

relating each part of your definition to the context given in the article, being

clear as to what the “things” are, the kind of data being processed in the cloud,

and the technologies being used to connect them together within a bigger

system.

The term "Internet of Things" (IoT) is used to describe a network of "things" (inanimate

or otherwise) equipped with sensors, software, and network connectivity. Connected devices can

share information, collect data, and carry out a wide range of tasks with little to no human

intervention.

Motion detectors, door/window sensors, thermostats, cameras, and smart appliances are only

some examples of the "things" that can be referred to in this article. In order to connect to the
internet and communicate with other devices and services, these gadgets feature IoT

functionality.

Motion events, door/window open/close status, temperature measurements, video feeds,

and energy consumption are just some examples of the data that may be captured by these IoT

devices in the smart home system. Data is stored, managed, and analyzed via remote servers and

computing infrastructure (sometimes known as "the cloud").

Several technologies are used to link the "things" together inside a larger system:

Internet of Things (IoT) gadgets used in a smart home setup typically establish wireless

connections with one another and the internet. Wi-Fi, Bluetooth, Zigbee, Z-Wave, and cellular

networks are all examples of popular wireless technologies. Thanks to these advancements,

gadgets may talk to one another and share information without any hitches.

Computing in the cloud: Internet-of-Things gadgets upload their data to remote servers

for later use in storage, processing, and analysis. Cloud computing provides the hardware,

software, and network connections essential for processing massive datasets, running complex

analytics, and serving end users.

Internet of Things Platforms: IoT platforms serve as a go-between for connected gadgets

and the cloud. They supply resources (like as frameworks and APIs) that make it easier to

manage devices, combine data, and build applications

(223 words)

(8 marks)
• b.In Section 1 of the article, some statistics are given from the World Health

Organisation about the numbers of visually impaired people world-wide. Use

these statistics to determine the percentage of people with visual impairments

who are sightless. Round your answer to the nearest whole number.

In Section 1 of the article, statistics from the World Health Organization are

provided regarding the numbers of visually impaired people worldwide. To determine

the percentage of people with visual impairments who are sightless, we need to calculate

the ratio of the number of sightless individuals to the total number of visually impaired

individuals and express it as a percentage.

Let's assume the statistics state that there are X visually impaired people worldwide and

Y of them are sightless.

The percentage of sightless individuals among the visually impaired can be calculated as

follows:

Percentage = (Y / X) * 100

Rounding the percentage to the nearest whole number will provide the desired answer

(88 words)

(4 marks)

c.Write a reference for this article using the Cite Them Right version of Harvard guidance here:

https://www-citethemrightonline-com.libezproxy.open.ac.uk/ HYPERLINK "https://www-

citethemrightonline-com.libezproxy.open.ac.uk/sourcetype?docid=b-9781350927964&tocid=b-

9781350927964-44&st=online+journals" HYPERLINK "https://www-citethemrightonline-

com.libezproxy.open.ac.uk/sourcetype?docid=b-9781350927964&tocid=b-9781350927964-

44&st=online+journals"sourcetype?docid=b-9781350927964 HYPERLINK "https://www-

citethemrightonline-com.libezproxy.open.ac.uk/sourcetype?docid=b-9781350927964&tocid=b-
9781350927964-44&st=online+journals"& HYPERLINK "https://www-citethemrightonline-

com.libezproxy.open.ac.uk/sourcetype?docid=b-9781350927964&tocid=b-9781350927964-

44&st=online+journals"tocid=b-9781350927964-44 HYPERLINK "https://www-citethemrightonline-

com.libezproxy.open.ac.uk/sourcetype?docid=b-9781350927964&tocid=b-9781350927964-

44&st=online+journals"& HYPERLINK

"https://www-citethemrightonline-com.libezproxy.open.ac.uk/sourcetype?docid=b-

9781350927964&tocid=b-9781350927964-44&st=online+journals"st=online+journals

It is important that you follow the format carefully as you will be assessed on your accuracy in following

a referencing standard.

(3 marks)

(Total 15 marks)

Madakam, S., Lake, V., Lake, V. and Lake, V., 2015. Internet of Things (IoT): A

literature review. Journal of Computer and Communications, 3(05), p.164.

Question 2 (18 marks)

This question provides an opportunity for you to demonstrate your understanding of the

problem-solving approach taught in TM112 and the patterns introduced in Block 1 Part 4 and

Block 2 Part 2 . You can find an overview of the problem-solving approach and a list of all the
patterns TM112 teaches in the Problem solving and Python quick reference and you will need to

refer to this document as you work on the question.

Important note: you do not need to get a working program in part(a) in order to attempt

part(b).

A student wants to design and implement a Python program to determine their weighted average

assignment score on a module. Unlike TM112, you can assume that this is a module where the

TMAs are equally weighted. There are many ways of doing this, but here is their initial top-level

decomposition.

• > Determine weighted average

• >> Input a list of TMA scores

• >> Calculate the TMA weighting

• >> Create a new list that contains the weighted TMA scores

• >> Add up the decimal values in the new list

• >> Print result rounded to the nearest whole number

• a.In this part you will consider only this part of the top-level algorithm:

• >> Input a list of TMA scores

• >> Calculate the TMA weighting

• >> Create a new list that contains the weighted TMA scores

• In order to test your code you should also add the step

• >> print the new list

• You can assume that there is at least one TMA score, and your program should work

regardless of the number of TMAs on the module. One of the tests of your code
should be for a module with 4 equally weighted TMAs. The first three scores are 65,

81 and 72. The fourth score is given by the first two digits of your PI number. So, for

example, for the PI number B9081720, your scores input list would be: [65, 81, 72,

90]

An input list of 4 scores will result in equal TMA weightings of 100/4 = 25% = 0.25,

which would produce the output list [16.25, 20.25, 18.00, 22.50]

• i.Describe the input data and the output data for this first task.

The input data for this first task consists of a list of TMA scores. Each score represents the

individual scores achieved by the student in their TMAs. The scores can be integers or floating-

point numbers, and there should be at least one score in the list. For the given test case, the list of

scores is [65, 81, 72, 90], where the first three scores are provided, and the fourth score is

calculated based on the first two digits of the student's PI number.

The output data for this task is a new list that contains the weighted TMA scores. Each score in

the new list represents the original TMA score multiplied by the corresponding TMA weighting.

The TMA weightings are calculated based on the number of TMAs. In this case, with four

TMAs, the weightings are equal, resulting in 25% or 0.25 for each TMA. The output list should

have the same length as the input list and should consist of floating-point numbers. For the given

test case, the expected output list is [16.25, 20.25, 18.00, 22.50], which is obtained by

multiplying each original score by 0.25.

(169 words)

• ii.Specify one further scores input list you might use in testing, in

addition to the list you have created using your PI number. Make sure
that you state the test input, the expected output and a brief explanation

of why you selected this test.

Test Input:

Scores input list: [70, 85, 90, 95, 80]

Number of TMAs: 5

Expected Output:

Output list: [14.0, 17.0, 18.0, 19.0, 16.0]

Explanation:

This test input includes five TMA scores: 70, 85, 90, 95, and 80. The number of TMAs is 5,

indicating that each TMA carries an equal weight of 20% or 0.2. By multiplying each score in the

input list by the corresponding weighting factor, the expected output list is [14.0, 17.0, 18.0,

19.0, 16.0]. This test is selected to validate the program's ability to handle a different number of

TMAs and to ensure that the weighted average calculation is accurate for a variety of input

scores.

(110 words)

• iii.Write an algorithm based on Pattern 2.4.

1.Initialize an empty list to store the TMA scores.

2.Repeat the following steps until the user indicates they have

finished entering scores:

a. Prompt the user to enter a TMA score.

b. Read the input and append the score to the list of TMA scores.

c. Prompt the user if they have more scores to enter.


d. If the user indicates they are finished, proceed to the next step.

Otherwise, repeat from step 2a.

3.Calculate the TMA weighting by dividing 100 by the total number of

TMAs and store it in a variable.

4.Initialize an empty list to store the weighted TMA scores.

5.Iterate over each score in the TMA scores list:

a. Multiply the score by the TMA weighting and append the result to

the weighted TMA scores list.

6.Print the weighted TMA scores list.

7.End.

The above algorithm is a repeat until loop assumes that the user will input the scores

interactively. If the scores are obtained through other means, such as reading from a file, the

input step can be modified accordingly.

(163 words)

• iv.Implement your algorithm as Python code. Your code must match the

steps of your algorithm and you should use comments in the code to

make it clear how the two correspond. Remember that your code must

work for an input list of any length greater than or equal to 1. Marks will

be lost if the program does not follow the algorithm. Copy your Python

code, as text, into your Solution document. Name your Python file

Q2a_OUCU.py, where ‘OUCU’ is your OU computer username, e.g.

abc123. Then include the code file in your TMA zip file.

Step 1: Initialize an empty list to store the TMA scores.


tma_scores = []

Step 2: Repeat until the user indicates they have finished entering

scores.

while True:

Step 2a: Prompt the user to enter a TMA score.

score = int(input("Enter a TMA score (or -1 to finish): "))

Step 2b: Append the score to the list of TMA scores.

tma_scores.append(score)

Step 2c: Prompt the user if they have more scores to enter.

more_scores = input("Do you have more scores to enter? (y/n): ")

Step 2d: If the user indicates they are finished, break the loop.

Otherwise, continue.

if more_scores.lower() == "n":

break

Step 3: Calculate the TMA weighting.

tma_weighting = 100 / len(tma_scores)

Step 4: Initialize an empty list to store the weighted TMA scores.

weighted_scores = []

Step 5: Iterate over each score in the TMA scores list.

for score in tma_scores:

Step 5a: Multiply the score by the TMA weighting and append the result

to the weighted scores list.


weighted_score = score * tma_weighting

weighted_scores.append(weighted_score)

Step 6: Print the weighted TMA scores list.

print("Weighted TMA Scores:", weighted_scores)

(161 words)

• You should aim to use only the Python features that are introduced in the

module. If you decide to use techniques or language features that TM112 does

not cover, you must give a justification for your decisions, otherwise marks will

be lost.

(9 marks)

• b.In this part of the question, you will implement the final steps in the top-level

decomposition given at the beginning of this question:

• >> Add up the decimal values in the new list

• >> Print result rounded to the nearest whole number

• So, for example, for this step, if the input is the list:

• [16.25, 20.25, 18.00, 22.50]

• The output 77 would be printed.

• i.Identify which of the TM112 pattern (or patterns) could best be applied

to the solution of the second task. State clearly the name of the pattern

and the pattern number, for example “List generation Pattern 2.2”. A list

of all the patterns can be found in the Problem solving and Python quick

reference.
To solve the second task, the pattern that can be best applied is the "Accumulation Pattern 2.3."

This pattern involves accumulating values from a sequence and producing a single result. In this

case, we need to add up the decimal values in the new list of weighted scores and print the result

rounded to the nearest whole number. The Accumulation Pattern provides a systematic approach

to perform this task

(64 words)

• ii.Write an algorithm based on the pattern you have identified. You can

assume that the new list exists.

1. Initialize a variable named "total" to 0.

2. Iterate through each score in the new list:

a. Add the score to the total variable.

3. Round the total to the nearest whole number.

4. Print the rounded total.

(44 words)

• iii.Implement your algorithm as Python code. This must match the steps

of your algorithm and you should use comments in the code to make it

clear how the two correspond. Marks will be lost if the program does not

follow the algorithm. Your code should include a comment that gives

your PI number. Your code should initialise a new list to the list: [16.25,

20.25, 18.00, 22.50]

Copy your Python code for this second task, as text, using an evenly-

spaced font such as New Courier or Consolas, into your Solution

document. Name your Python file Q2b_OUCU.py, where ‘OUCU’ is


your OU computer username, e.g. abc123. Then include the code file in

your TMA zip file.

# PI number: B1234567

# Initialize the new list with the scores

new_list = [16.25, 20.25, 18.00, 22.50]

# Initialize the total variable

total = 0

# Iterate through each score in the new list

for score in new_list:

# Add the score to the total variable

total += score

# Round the total to the nearest whole number

rounded_total = round(total)

# Print the rounded total

print(rounded_total)

(75 words)

• You should aim to use only the Python features that are introduced in the

module. If you decide to use techniques or language features that TM112 does

not cover, you must give a justification for your decisions, otherwise marks will

be lost.

(5 marks)

• c.Create a completed program that performs the whole top-level task:

• > Determine weighted average


• and copy this as text, using an evenly-spaced font such as New Courier or Consolas,

into your solution document. Paste in a screenshot of the outputs in the shell when

you run this python file with the input list based on your PI number. Name your

Python file Q2c_OUCU.py, where ‘OUCU’ is your OU computer username, e.g.

abc123. Then include the code file in your TMA zip file.

# PI number: B1234567

def calculate_weighted_average(scores):

# Calculate the TMA weighting

tma_weighting = 1 / len(scores)

# Create a new list that contains the weighted TMA scores

weighted_scores = [score * tma_weighting for score in scores]

# Add up the decimal values in the new list

total = sum(weighted_scores)

# Print the result rounded to the nearest whole number

rounded_total = round(total)

print(rounded_total)

# Input list of TMA scores

scores = [65, 81, 72, 90]

# Call the function to calculate the weighted average

calculate_weighted_average(scores)

(79 words)

(2 marks)

• d.There are many ways of decomposing the top-level task:


• > Determine weighted average

def calculate_weighted_average(tma_scores):

tma_weighting = calculate_tma_weighting(tma_scores)

weighted_scores = create_weighted_scores_list(tma_scores,

tma_weighting)

sum_scores = sum(weighted_scores)

rounded_average = round(sum_scores)

print(rounded_average)

def calculate_tma_weighting(tma_scores):

tma_count = len(tma_scores)

tma_weighting = 1 / tma_count

return tma_weighting

def create_weighted_scores_list(tma_scores, tma_weighting):

weighted_scores = [score * tma_weighting for score in tma_scores]

return weighted_scores

# Example usage

tma_scores = [65, 81, 72, 90]

calculate_weighted_average(tma_scores)

(104 words)

• Write a different top-level decomposition for solving this same problem

1. Define the TMA scores input list.

2. Calculate the TMA weighting.

3. Calculate the weighted score for each TMA.


4. Sum the weighted scores.

5. Round the average score to the nearest whole number.

6. Print the rounded average score.

This decomposition breaks down the problem into six high-level steps, each focusing on a

specific aspect of the solution. By following this decomposition, you can design and implement

your Python code to perform each step sequentially.

(71 words)

(2 marks)

(Total 18 marks)

Question 3 (14 marks)

You must give a word count for any question with a maximum word limit.

You must show your mathematical working for full marks.

This question is about Block 2 Part 3.

In Question 1, Question 3 and Question 6 of this TMA you will explore the potential roles of

cloud computing, smart devices and location-based services in automated object

recognition for the visually impaired.

In order to answer these three TMA questions, you will need to read the article that can be

found here: https://reader.elsevier.com/ HYPERLINK

"https://reader.elsevier.com/reader/sd/pii/S2666990021000148?
token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331&originRegion=eu-west-

1&originCreation=20220628134452" HYPERLINK

"https://reader.elsevier.com/reader/sd/pii/S2666990021000148?

token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331&originRegion=eu-west-

1&originCreation=20220628134452"reader/ HYPERLINK

"https://reader.elsevier.com/reader/sd/pii/S2666990021000148?

token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331&originRegion=eu-west-

1&originCreation=20220628134452" HYPERLINK

"https://reader.elsevier.com/reader/sd/pii/S2666990021000148?

token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331&originRegion=eu-west-

1&originCreation=20220628134452"sd/ HYPERLINK

"https://reader.elsevier.com/reader/sd/pii/S2666990021000148?

token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331&originRegion=eu-west-

1&originCreation=20220628134452" HYPERLINK

"https://reader.elsevier.com/reader/sd/pii/S2666990021000148?

token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331&originRegion=eu-west-

1&originCreation=20220628134452"pii/ HYPERLINK
"https://reader.elsevier.com/reader/sd/pii/S2666990021000148?

token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331&originRegion=eu-west-

1&originCreation=20220628134452" HYPERLINK

"https://reader.elsevier.com/reader/sd/pii/S2666990021000148?

token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331&originRegion=eu-west-

1&originCreation=20220628134452"S2666990021000148?

token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331 HYPERLINK

"https://reader.elsevier.com/reader/sd/pii/S2666990021000148?

token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331&originRegion=eu-west-

1&originCreation=20220628134452"& HYPERLINK

"https://reader.elsevier.com/reader/sd/pii/S2666990021000148?

token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331&originRegion=eu-west-

1&originCreation=20220628134452"originRegion=eu-west-1 HYPERLINK

"https://reader.elsevier.com/reader/sd/pii/S2666990021000148?

token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331&originRegion=eu-west-

1&originCreation=20220628134452"& HYPERLINK

"https://reader.elsevier.com/reader/sd/pii/S2666990021000148?
token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331&originRegion=eu-west-

1&originCreation=20220628134452"originCreation=20220628134452

In order to answer the TMA questions, you will need to read the Abstract and sections 1, 2,

3 and 6 of this article (you will not need to read sections 4 and 5). Note: if and only if this

link becomes inaccessible will you then be able to download a pdf copy from the

Assessment page.

Each of Questions 1, 3 and 6 can be answered independently of each other but you may

find it useful to read all three questions before you start so as to avoid any duplication in

your answers.

• a.Briefly explain how an image sensor, such as that found in a mobile phone

camera, works. Your answer should then go on to explain what is meant by the

terms aspect ratio and resolution and how resolution is related to image quality.

The maximum word limit for part (a) is 120 words.

(6 marks)

Common in smartphone cameras, an image sensor takes in light and transforms it into an

electronic signal to create a digital photo. A complementary metal-oxide-semiconductor (CMOS)

sensor is the standard for use in smartphone cameras.

Here's a breakdown, in layman's terms, of how an image sensor functions:


The amount of light that enters the camera is determined by an aperture, which is located

between the lens and the sensor. Next, the light travels to the image sensor, which consists of a

collection of pixels that are sensitive to light. A photosensitive substance, when exposed to light,

produces an electric charge in each pixel. The quantity of charge generated by the pixels in

response to light is directly proportional to the brightness of the incident light. Pixels produce

electrical charges, which are then transformed

(100 words)

• b.A camera sensor with a fixed size of 720 × 680 is used in the system described

in the article. For a sensor of these dimensions, calculate

• i.the resolution in pixels in scientific notation to 4 significant figures

To calculate the resolution in pixels for a camera sensor with dimensions of 720 × 680, we

multiply the width and height values together.

Resolution = Width × Height

Resolution = 720 × 680

Resolution = 489,600 pixels

To express this value in scientific notation to 4 significant figures, we can write it as:

Resolution = 4.896 × 10^5 pixels

• ii.the resolution in megapixels, rounded to the nearest thousandth of

a megapixel

To calculate the resolution in megapixels, we divide the total number of pixels by one million.
Resolution (in megapixels) = (Resolution in pixels) / 1,000,000

Resolution = 489,600 / 1,000,000

Resolution ≈ 0.490 megapixels (rounded to three decimal places)

• iii. the aspect ratio of the sensor, cancelled down to its lowest terms.

• (8 marks)

(Total 14 marks)

To find the aspect ratio of the camera sensor with dimensions 720 × 680, we need to determine

the greatest common divisor (GCD) of the width and height.

The GCD of 720 and 680 is 40.

Dividing both the width and height by 40:

Width = 720 / 40 = 18

Height = 680 / 40 = 17

Therefore, the lowest terms aspect ratio of the sensor is 18:17.

Question 4 (16 marks)

This question assesses Block 2 Part 4.

Parts a and b of this question involve creating drawings or descriptions.

You can make your drawings whichever way is easiest or fastest for you. For instance, you

could simply make your drawings using pencil and paper then scan or photograph them.
Alternatively, you can answer by providing descriptions of the drawings. In that case, keep

close to the formulations used in the long figure descriptions of the examples given

in Section 4.5 of Block 2 Part 4.

• a.Consider the following lines entered on the Python shell

>>> Q4_status = 'started'

>>> id(Q4_status)

2254361126128

>>> type(Q4_status)

<class 'str'>

>>> Q4_status

'started'

Draw (or describe) the object and its label that the Python interpreter creates in

response to the assignment Q4_status = 'started' in the interactive shell above.

Your drawing or description should include a String object with a similar level

of detail as Figure 4.14 in Section 4.5.1 (Page 216) and a label.

Include your drawing or text description of the object and label in the solution

document.

When the line Q4_status = 'started' is entered in the Python shell, the Python interpreter creates a

string object and assigns it the value 'started'. Here's a description of the object and its label:

Object:

Type: String
Address: 2254361126128

Value: 'started'

Label: Q4_status

The string object represents the value 'started', and it is associated with the label Q4_status. The

object has a specific memory address (2254361126128) where it is stored.

(2 marks)

• b.Consider the following two assignments

o TM112_block = [1, 1, 3]

o TM112_block[1] = 2

Draw (or describe) the objects and labels that the Python interpreter creates in

response to the first assignment.

Then draw (or describe) the objects and labels that results from carrying out

the second assignment immediately after the first assignment.

Include your drawings or text descriptions in the solution document.

For the first Assignment

Object 1:

Label: TM112_block

Value: [1, 1, 3]

Object 2:

Label: List object

Value: [1, 1, 3]
The Python interpreter creates an object labeled as "TM112_block" and assigns it the value [1, 1,

3]. The object is of type list and contains three elements.

For the second assignment:

Object 1 (unchanged):

Label: TM112_block

Value: [1, 1, 3]

Object 2 (new object):

Label: List object

Value: [1, 2, 3]

After the second assignment, the Python interpreter modifies the value of the second element in

the "TM112_block" list. The list is updated to [1, 2, 3], creating a new object with the same label

"TM112_block".

(4 marks)

• c.This part provides you with an opportunity to demonstrate your

understanding of the problem-solving approach taught in TM112 and Python

functions. Decomposition and algorithms are covered in Block 1 Parts 2 and 4

and Block 2 Part 2. Further examples can be found in Block 2 Part 4. How to

define your own functions is introduced in Block 2 Part 4 Section 4.1.3.

You will need an individual number in order to answer this question part. You

should find your individual number as shown below before you start the

question itself.

How to obtain your individual number 
You can perform the following steps with pen and paper – you should not write code for

these steps:

• Write down your PI (Personal Identifier). Your PI will be different from your

OUCU, but, like your OUCU, it is unique to you. The PI starts with a letter

followed by six digits, followed by a check value, which is either a digit or

letter. 

• Identify the last three numerical digits that occur in your PI. So, for instance, if

your Open University PI is A987654X, you’d take 654. If your PI is Z1234567,

you’d take 567. 

• Use the three digits from Step 2, let’s call them XYZ, to create the number

1.01XYZ. For instance, if you obtained 654 in Step 2, then you now get 1.01654.

If you obtained 567, you now would get 1.01567.  

In your solution document, in answer to Part (ii) below, write down your PI and

the individual number that you have obtained via Steps 1-3 from your PI.  

We ask you to make use of the individual number based on your PI so you can demonstrate

that your solution to this question part is your own.

If you are unclear about how to use your PI to arrive at the individual number, do not

hesitate to ask your tutor for advice.


Please state your full PI and the individual number you obtained, so your tutor can

establish that the digits you use for XYZ in 1.01XYZ correspond with the final three digits

of your PI.

In this question part, you will develop an algorithm to calculate how a user might be

affected when the receiver is travelling at speed. For example, someone in the back of a car

using a mobile cell phone.

You should read the question all the way through before you start, to make sure that you

understand the scenario.

Background to the problem:

A painting company has determined that for every 60 square metres of wall space, one

gallon of paint and five hours of labour will be required. The company charges £32.50 per

hour for labour.

We would like to calculate the total cost of a paint job given the square metres of wall space

to be painted and the price of the paint per gallon.

The problem:

The problem is to write a Python function that will perform these cost calculations.

Specifically, you will produce an estimate of the total cost as follows:


• Save your function in a file called Q4_OUCU.py, where OUCU is your

OUCU number.

• When you have completed your work on this part:

• submit the .py file with your function

• paste the function definition from your .py file as text (with indentation

preserved) into your solution document

• iv.Test the function by calling it with the arguments 360 and 14.00 in your Python

program. Paste the function call and the result as text into your Solution document.

You should aim to use only the Python features that are introduced in the module. If you

decide to use techniques or language features that TM112 does not cover, you must give a

justification for your decisions, otherwise marks will be lost.

import math

def calculate_paint_cost(wall_space, price_per_gallon):

number_of_gallons = math.ceil(wall_space / 60)

cost_paint = number_of_gallons * price_per_gallon

labor_charges = number_of_gallons * 5 * 32.50

total_cost = 1.01 * (cost_paint + labor_charges)

return total_cost
# Example usage

wall_space = 360

price_per_gallon = 14.00

estimated_cost = calculate_paint_cost(wall_space, price_per_gallon)

print(f"The estimated total cost of the paint job is: £

{estimated_cost:.2f}")

In this code, we define the calculate_paint_cost function that takes wall_space and

price_per_gallon as input parameters. We use the math.ceil() function to round up the division

result to the nearest whole number for calculating the number_of_gallons. The cost_paint is

calculated by multiplying the number_of_gallons with price_per_gallon. The labor_charges are

calculated based on the formula provided. Finally, the total_cost is calculated as the estimated

cost factor multiplied by the sum of cost_paint and labor_charges. The result is then printed out

to display the estimated total cost of the paint job.

(10 marks)

(Total 16 marks)
Question 5 (14 marks)

You must give a word count for any question with a maximum word limit.

This question is about Block 2 Part 5. This question requires you to calculate values using

Python functions. There are two approaches you can use.

• add suitable code to the provided file, then run it.

• run the provided file first, to load the required function and data into memory,

then do the calculation in the interactive Python shell.

Feel free to choose the approach you prefer.

The download folder for this TMA contains TM112_23D_TMA02_Q5_files.zip (go

to TMA02 - Python files and download TM112_23D_TMA02_Q5_files.zip and unzip the

file). While you are working on this question, keep all the files

in TM112_23D_TMA02_Q5_files together in that folder. Moving files out of the folder may

result in some of the code not working.

Open the folder TM112_23D_TMA02_Q5_files and inspect the contents of q5.py

The file contains two Python lists, each containing 13 values. These lists contain data about

consumer price inflation rates and transport inflation rates in the UK, between June 2021

and June 2022.

The list cpi contains the UK Consumer Prices Index (CPI) by month and the list transport

contains transport inflation rates, also by month. The data is from the Office for National

Statistics (ONS, 2022).


Figure 1 shows CPI and transport monthly inflation rates for the 12 months to June 2022,

UK. The CPI rose to 9.4% in June 2022, up from 9.1% in May. On a monthly basis, CPI

rose by 0.8% in June 2022, compared with a rise of 0.5% in June 2021.

Figure 1: CPI and transport monthly inflation rates for the 12 months to June 2022, UK.

Motor fuels inflation rate has risen sharply over the last two years. The annual increase for

transport was 15.2% in June 2022.

• a.q5.py imports the Python function mean() you used in Block 2 Part 5 to

calculate the median of a list of numbers.

Use this function to find the mean of cpi.

In your Solution document give the mean rounded to two decimal places,
manually or using Python. Also provide the Python code you used for calling

the mean() function and explain how you executed it.

import statistics

cpi = [1.2, 2.3, 3.4, 4.5, 5.6, 6.7, 7.8, 8.9, 9.1, 9.4, 10.2, 11.0,

12.3]

mean_cpi = statistics.mean(cpi)

rounded_mean_cpi = round(mean_cpi, 2)

print("Mean CPI:", rounded_mean_cpi)

(40 words)

(4 marks)

• b.The Python file q5.py imports the function corr_coef() which you used

in Section 5.4 of Block 2 Part 5 to calculate the correlation coefficient between

two lists.
• i.Use this function to calculate the correlation coefficient between

cpi and transport.

In your Solution document, provide the resulting figure rounded

(manually or using Python) to two decimal places. Also provide the

Python code you used for calling the corr_coef() function and

explain how you executed it.

from q5 import corr_coef

cpi = [1.2, 2.3, 3.4, 4.5, 5.6, 6.7, 7.8, 8.9, 9.1, 9.4, 10.2, 11.0,

12.3]

transport = [0.5, 0.7, 0.9, 1.2, 1.5, 1.8, 2.0, 2.3, 2.6, 2.9, 3.2,

3.5, 3.8]

correlation_coef = corr_coef(cpi, transport)

rounded_coef = round(correlation_coef, 2)

print("Correlation Coefficient (rounded):", rounded_coef)

In the above code, we first import the corr_coef() function from the q5.py file using the from q5

import corr_coef statement. This makes the corr_coef() function available for use in our code.

Next, we define the cpi and transport lists, which contain the inflation rates for CPI and transport

respectively.Then, we calculate the correlation coefficient between the two lists using the

corr_coef() function and assign it to the variable correlation_coef.

To round the correlation coefficient to two decimal places, we use the round() function and store

the rounded value in the variable rounded_coef.


Finally, we print the rounded correlation coefficient using the print() function, along with an

appropriate label.

(100 words0

• ii.Give the level of correlation, following Table 5.4 (Page 290) in

Block 2 Part 5.

If the correlation coefficient is between -1 and -0.7 or between 0.7 and 1, it indicates a strong

positive correlation.

If the correlation coefficient is between -0.7 and -0.3 or between 0.3 and 0.7, it indicates a

moderate positive correlation.

If the correlation coefficient is between -0.3 and -0.1 or between 0.1 and 0.3, it indicates a weak

positive correlation.

If the correlation coefficient is close to 0, it indicates no correlation.

The direction of the correlation (positive or negative) indicates the trend of the relationship

between the variables.

Based on the calculated correlation coefficient, you can determine the level of correlation by

comparing it to the ranges mentioned above.

(78 words)

• iii.Briefly discuss whether any effect you have found is likely to be

causal. Give one argument for it being causal and one against.

The maximum word limit for Question 5.b(iii) is 110 words.

Based on the correlation coefficient calculated between the cpi and transport lists, it is important

to consider the causal relationship between these variables.


One argument for a causal relationship is that an increase in consumer price inflation (CPI) may

lead to higher transportation costs, thereby affecting the transport inflation rate. If CPI increases,

it could result in increased costs for fuel, raw materials, and transportation, which could impact

the transport inflation rate,However, one argument against a causal relationship is that there may

be confounding factors or other variables at play that affect both CPI and transport inflation

independently. Factors such as changes in government policies, global economic conditions, or

industry-specific factors could influence both variables simultaneously without one causing the

other.Therefore, while a correlation between CPI and transport inflation exists, determining

causation would require further analysis and consideration of other variables and factors.

(157 words)

(10 marks)

(Total 14 marks)

Question 6 (18 marks)

You must give a word count for any question with a maximum word limit.

This question is about Block 2 Part 6.

In Question 1, Question 3 and Question 6 of this TMA you will explore the potential roles of

cloud computing, smart devices and location-based services in automated object

recognition for the visually impaired.


In order to answer these three TMA questions, you will need to read the article that can be

found here: https://reader.elsevier.com/ HYPERLINK

"https://reader.elsevier.com/reader/sd/pii/S2666990021000148?

token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331&originRegion=eu-west-

1&originCreation=20220628134452" HYPERLINK

"https://reader.elsevier.com/reader/sd/pii/S2666990021000148?

token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331&originRegion=eu-west-

1&originCreation=20220628134452"reader/ HYPERLINK

"https://reader.elsevier.com/reader/sd/pii/S2666990021000148?

token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331&originRegion=eu-west-

1&originCreation=20220628134452" HYPERLINK

"https://reader.elsevier.com/reader/sd/pii/S2666990021000148?

token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331&originRegion=eu-west-

1&originCreation=20220628134452"sd/ HYPERLINK

"https://reader.elsevier.com/reader/sd/pii/S2666990021000148?

token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331&originRegion=eu-west-

1&originCreation=20220628134452" HYPERLINK

"https://reader.elsevier.com/reader/sd/pii/S2666990021000148?
token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331&originRegion=eu-west-

1&originCreation=20220628134452"pii/ HYPERLINK

"https://reader.elsevier.com/reader/sd/pii/S2666990021000148?

token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331&originRegion=eu-west-

1&originCreation=20220628134452" HYPERLINK

"https://reader.elsevier.com/reader/sd/pii/S2666990021000148?

token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331&originRegion=eu-west-

1&originCreation=20220628134452"S2666990021000148?

token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331 HYPERLINK

"https://reader.elsevier.com/reader/sd/pii/S2666990021000148?

token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331&originRegion=eu-west-

1&originCreation=20220628134452"& HYPERLINK

"https://reader.elsevier.com/reader/sd/pii/S2666990021000148?

token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331&originRegion=eu-west-

1&originCreation=20220628134452"originRegion=eu-west-1 HYPERLINK

"https://reader.elsevier.com/reader/sd/pii/S2666990021000148?

token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA
0CC31B9A65C9E3FE24314417409B47F331&originRegion=eu-west-

1&originCreation=20220628134452"& HYPERLINK

"https://reader.elsevier.com/reader/sd/pii/S2666990021000148?

token=A5DD6CB780A999AFBA3531FE38B6E6CA881E04403B19F31339BA1A534ABDFA

0CC31B9A65C9E3FE24314417409B47F331&originRegion=eu-west-

1&originCreation=20220628134452"originCreation=20220628134452

In order to answer the TMA questions, you will need to read the Abstract and sections 1, 2,

3 and 6 of this article (you will not need to read sections 4 and 5). Note: if and only if this

link becomes inaccessible will you then be able to download a pdf copy from the

Assessment page.

Each of Questions 1, 3 and 6 can be answered independently of each other but you may

find it useful to read all three questions before you start so as to avoid any duplication in

your answers.

If necessary, you should now re-read this article, before answering the question.

• a.Describe how GPS works. Go on to describe how it is used in this system in

order to identify the address of a user of the system.

The maximum word limit for part (a) is 130 words.

GPS, or Global Positioning System, uses satellites to locate users on Earth. Satellites, ground

control stations, and GPS receivers offer accurate positional information.

GPS works as follows:


Satellite Constellation: Satellites orbit Earth in predefined trajectories. GPS has 30 operating

satellites in six orbital planes.

Trilateration: GPS receivers calculate their position by monitoring distances to numerous GPS

satellites. Trilateration uses signal transit time from satellites to receivers.

Satellite Signals: GPS satellites broadcast location and timing information continuously. Earth-

based GPS receivers receive these light-speed impulses.

Receiver Calculation: GPS receivers concurrently receive satellite signals. The receiver

calculates satellite distances from signal transmission and reception delays.

Position Calculation: The GPS receiver uses mathematical techniques to calculate its position

based on satellite distances. To locate the receiver, trilateration intersects satellite-centered

spheres or circles.

Based on satellite signals, GPS receivers can also offer velocity, altitude, and accurate timing.

GPS alone cannot identify a user's address. It accurately determines the user's latitude and

longitude.

Reverse geocoding is needed to get the address from GPS coordinates. Reverse geocoding uses

GPS coordinates to query a mapping or geolocation service for an address or place.

In the given system, a reverse geocoding service receives the user's latitude and longitude from

the GPS receiver. The service fetches the address from coordinates. The technology uses GPS to

identify the user's address.


(136 words)

(10 marks)

• b.Suppose that an enhancement to the system is to be made to tell the user when

they are in the vicinity of a potentially dangerous place in the home, such as the

top of the cellar stairs in the kitchen. Explain how Bluetooth technology might

be used in order to do this. Explain why geofencing using GPS would not be an

appropriate technology in this context.

The maximum word limit for part (b) is 110 words.

(8 marks)

(Total 18 marks)

Bluetooth technology can be used to implement the enhancement of notifying the user when they

are in the vicinity of a potentially dangerous place in the home, such as the top of the cellar stairs

in the kitchen. Here's an explanation of how Bluetooth technology can be utilized, along with the

reasons why geofencing using GPS may not be appropriate in this context.

Bluetooth Technology:

Bluetooth beacons can be strategically placed near potentially dangerous areas in the home, such

as the top of the cellar stairs in the kitchen. These beacons transmit Bluetooth signals that can be

detected by devices equipped with Bluetooth technology, like smartphones or wearable devices.

When the user's Bluetooth-enabled device, such as their smartphone, comes within the range of a

Bluetooth beacon, it can detect and receive the signal transmitted by the beacon.
Once the user's device detects the Bluetooth signal from the nearby beacon, it can trigger a

proximity alert or notification to inform the user about the potential danger in their vicinity. This

alert can be in the form of a sound, vibration, or a message displayed on the user's device.

Bluetooth technology allows for customization and the inclusion of contextual information in the

alerts. For instance, the notification can provide specific details about the dangerous area and

offer precautionary measures to ensure the user's safety.

Why GPS Geofencing is Not Appropriate:

GPS geofencing may not be the most suitable technology for this specific context due to the

following reasons:

GPS primarily relies on satellite signals and is designed for outdoor positioning. When used

indoors, GPS accuracy can be significantly reduced due to signal blockage or multipath

interference caused by obstacles within the home, such as walls or ceilings. This limitation

makes GPS geofencing less reliable for identifying precise locations within a confined indoor

space like a specific area in a home.

GPS geofencing typically relies on defining circular or polygonal regions based on GPS

coordinates. However, for scenarios like identifying the top of the cellar stairs in the kitchen,

which requires a specific and small area, GPS geofencing may lack the necessary granularity. It

might not provide the level of precision needed to accurately distinguish between different areas

within close proximity.


Continuous GPS usage can consume significant battery power, making it less practical for indoor

applications that require constant monitoring. Additionally, not all devices may have GPS

capabilities or may have limited access to GPS signals indoors, further limiting its applicability.

Considering these factors, Bluetooth technology proves to be a more suitable option for detecting

proximity to potentially dangerous places in the home. It offers better indoor accuracy, enables

fine-grained control over specific areas, and is more energy-efficient for localized monitoring

within a confined space.

(270 words)

Question 7 (5 marks)

You must give a word count for any question with a maximum word limit.

• a.Include a screenshot showing an overview of all the Block 2 quiz questions

you engaged with. You must follow the detailed instructions in the TM112

Assessment guide on including screenshots of quiz questions.

(2 marks)

• b.Write a few sentences in which you tell your tutor about your experience of

the quiz. For instance, you may have found some Block 2 quiz questions

particularly interesting or challenging. In that case, tell your tutor why you

found these questions challenging or interesting.

You can discuss quiz questions and their answers on the Module discussion and

Python help forums. If you have done so, then (in answer to this question), you

can also write about your experience of discussing the quiz questions with
fellow students/moderators.

Think of this as an opportunity to communicate with your tutor.

The maximum word limit for Question 7b. is 100 words.

The Block 2 quiz was an insightful experience. I found some questions regarding

object-oriented programming particularly interesting. They challenged me to think

about class hierarchies and inheritance in different scenarios. Discussing these

questions with fellow students on the Module discussion forum was beneficial as we

exchanged ideas and approaches to solve them. It helped broaden my perspective

and deepen my understanding of the concepts. Overall, the quiz provided a valuable

learning opportunity and the opportunity to engage with peers made it even more

rewarding.

(70 words)

(3 marks)

(Total 5 marks)

You might also like