# data[].attributes.body
Decomposition is breaking down a complex problem or system into smaller parts that are more manageable and easier to understand.

for example decomposition can be used for daily activities to make our lives simple and easy like organising DVDs:

1. Take all the DVDs off your shelf.

2. Sort the DVDs into piles based on the first letter of the title.

3. Start with the 'A' pile. Organise this group into alphabetical order by second and third letters.

4. Place them on the shelf.

5. Repeat for the rest of the alphabet.

# data[].attributes.body
How does pipelining improve performance of a pc?
Pipelining makes CPU access more efficient by ensuring that most of the CPU's components are being used simultaneously which improves the performance by decomposing the long latency stages (such as memory access stages) of a pipeline into several shorter stages, thereby possibly increasing the number of instructions running in parallel at each cycle.

1. Explain how a GPU works and differs from a CPU. Identify different applications of a GPU other than rendering.

A graphics processing unit (GPU) is a specialized electronic circuit designed to rapidly manipulate and alter memory to accelerate the creation of images in a frame buffer intended for output to a display device.However in a personal computer, a GPU can be present on video card or embedded on the motherboard.However a CPU is designed to handle a wide-range of tasks quickly and essentially the brain of a CAD system. It consists of an arithmetic and logic unit (ALU), a control unit, and various registers.Futermore GPU  can be used for video editing,fill rate,TMU

3. Explain the Fetch decode execute cycle and provide definitions for PC, MAR, MDR, CIR, ALU, ACC, CU, data bus, address bus and control bus.

Fetch phase: - Address from the PC is copied to the MAR
- Instruction held at that address is copied to MDR by the data bus -
Simultaneously, the contents of the PC are increased by 1
- The value held in the MDR is copied to the CIR

Decode phase: - The contents of CIR are split into operand and opcode

Execute phase: - The decoded instruction is executed

# data[].attributes.body
target work:
task 1
1.    Complete the trace table to determine the purpose of the following algorithm. Test it with input 14 and 5.

x = input ("Enter the first integer: ")

y = input ("Enter the second integer: ")

z = 0

while x > 0

if x mod 2 == 1 then

z = z + y

endif

x = x div 2

y = y * 2

endwhile

print ("Answer =", z)

| x | y | x mod 2 | z | x > 0 | output
| 14 | 5 | 0 | 0 | True |
| 7 | 10 | 1 | 10 | true |
| 3 | 20 | 1 | 30 |   |
| 1 | 40 | 0 | 70 | true |
| 0 | 80 |   |   |   |
|   |   |   |   | false | Answer =70

2.    A doctor records a patient’s temperature once an hour for six hours. Any time the temperature is > 37C, an incidence of fever is recorded.

The average temperature is calculated at the end.

(a)   Calculate the expected result using test data 36, 36, 38.5, 37, 38, 36.

Add all of them together=221.5/9=36.9

(b)   Complete the trace table using the pseudocode below for this data.

temp = 0

fever = 0

total = 0

hour = 1

while hour < 7

temp = input(“Enter temperature: ”)

if temp > 37 then

fever = fever + 1

endif

total = total + temp

hour = hour + 1

endwhile

average = round(total/hour,1) #round to 1 decimal place

print(“Average temperature:”, average)

print(“Incidents of fever:”, fever)

| temp | fever | total | hour | average | Output
| 0 | 1 | 0 | 0 | 0 |
| 36 |   | 36 | 2 |   |
| 36 |   | 72 | 3 |   |
| 38.5 | 1 | 110.5 | 4 |   |
| 37 |   | 147.5 | 5 |   |
| 38 | 2 |   | 6 |   | Average is 31.6
| 36 |   |   | 7 |   |

Worksheet 4 Subroutines

Task 1

1.    A primary school teacher requires a program that will allow pupils to practise their multiplication tables (times tables).  The program must allow them to choose the table they want displayed and the start and end numbers to multiply by.

For example, if the pupil enters 5, 4, 12 the program will display

5 x 4 = 20

5 x 5 = 25

…

…

5 x 12 = 60

The program will then print a message followed by the table selected.

Create a pseudocode solution for this using a subroutine called multiples() which takes table, startnum, endnum and pupilName as parameters.  The subroutine will output the message and multiplication table.  The main program will prompt the user to enter the values and will then pass them to the routine.

Def multiples(table, startnum, endnum, name):

Print(Hi, “ , name, “… here is your time table”)

for i in range(startnum, (endum+1),  1):

print(str(table), “ * ”,str(i),” = “,str((table*i)))

namein = input(“What is your name: “)

print(“Enter times table, start number and end number”)

timesn = int(input(“”))

startn = int(input(“”))

endn = int(input(“”))

multiples(timesn, starn, endn, nameinc)

# data[].attributes.body
https://forms.office.com/Pages/ResponsePage.aspx?id=wc5M7Equn020TQwRs_67dyl6Q1wzYAxAhABn4e1SYAdUOENQMks0N0Q5TjVMUEIxSElYTTVWQ1JKVy4u

# data[].attributes.body
well i got one question wrong which i should have gotten correct but i will get it next time.

# data[].attributes.body
improvement- (1)Basically the user takes the quiz and there is 4 outcomes which is morning,afternoon,evening and night.In addition the user would have to put their timetable in the website/app so that the website can suggest more than one time to study. For example if a user takes the quiz and the outcome is that they study best in the morning and that 9 am is the best time for them to study/work but in their timetable 9am on a monday they have maths then the website/app can tell the user other peak study times in the morning.However the user has free of choice so they can wish to not study at 9am since it is "too early " for them so the the website can find other best study times in different time areas for them so 7pm(evening) as it is later than 9am so something along the line of this reasioning.Futhermore the complexity of the quiz will have a more specfic result for the user but I will keep it simple due to time

# data[].attributes.body
2) originally I wanted the user to take a quiz so that they would know what music genre would be good for them to study.Then I would use Spotify API's to create a playlist based on the quiz outcome so that the user can study at their best time and listen to their best music genre whilst studying so a 2 in 1.

However, now I'm kind of leaning towards an approach where the user telling the app/website keywords such as Jazz or Pop and like the name of an artist then using Spotify API create a playlist based on what they typed then they can acces and listen tothe playlist.

# data[].attributes.body
mediaWiki for wikipedia api
....