More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
post
page
Python IDE Dashboard

GCSE Computer Science Revision

Getting ready for your GCSE Computer Science exams? Test our knowledge by answering all the following questions:
GCSE Computer Science RevisionOpen in New Window

Daily Protocolometer

In this post, we are investigating our daily use of the main protocols used when accessing the Internet while using our smartphone, laptop or desktop computer, tablet, smartTV or game console.

Protocols are an essential concept to enable network communications and data transfer between different devices. A protocol defines the rules to be followed by both devices to be able to communicate with one another.

On the Internet, most communications use the TCP/IP range of protocols which relies on packet switching and the use of IP addresses to uniquely identify devices on the network.

Protocols can also be grouped into layers: The TCP Stack consists of 4 key layers:

  • The application layer which regroups the following protocols: HTTP, HTTPS, FTP, SMTP, POP3, IMAP, etc.
  • The transport layer which consists mainly of the TCP and UDP protocols
  • The internet layer which consists mainly of the IP Protocols (e.g. IPv4, IPv6)
  • The link layer (a.k.a. physical layer) which regroups various protocols used to transfer data over a cable (e.g. Ethernet protocol) or wirelessly (e.g. WiFi, 3G/4G/5G) protocols.

Your Task

Answer the following 10 questions to evaluate your daily use of networking protocols:

Daily ProtocolometerOpen in New Window

Hair & Beauty Salon – Entity Relationship Diagram (ERD)

“Stylish” is a Hair & Beauty Salon offering a wide range of hair & beauty treatments to customers. They currently employ five hair stylists and three beauticians. They currently use a notebook to record all their information such as customer contact details, appointments, treatments to be performed and payments.

They would like a new IT system to optimise their booking systems and keep track of payments so that they can renumerate their employees accordingly based on the treatments they completed.

They would like the new system to allow staff to:

  • Record customers’ contact details, so that existing customers do not have to provide their details every time they book an appointment.
  • Record dates and times of appointments and for each appointment, record the list of services/treatments being booked and for each treatment record the name of the employee who will be performing the treatment.
  • Calculate and store the total cost of the treatments booked and store this information with the appointment details alongside a status field to indicate whether the appointment has been paid or not.

Your task is to review the requirements of this Hair & Beauty Salon in order to design the Entity Relationship Diagram (ERD) for this system.

For more information about relational databases and Entity Relationship Diagrams, visit the following pages:

Use our online ERD tool to design the Entity Relationship Diagram for this salon. Note that you have not been given all pieces of information to store about the employees, customers, appointments, bookings, treatments and payments so you will have to decide of the most relevant fields to include on your ERD.

Design Your ERD Online
unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Creating Logic Gates using Transistors

As you know, computers can only process binary data which consists of 0’s and 1’s. This is due to the fact that the main processing components (e.g. the CPU) are made of transistors: tiny electronic switches that can be turned on (1) and off (0).

A transistor is an electronic component with three pins. Basically, a transistor is a switch (between two of the pins: the collector and the emitter) that is operated by having a small current in the third pin called the base.

Use the checkboxes below this transistor to understand how applying a voltage to the base of a transistor is equivalent to turning on a switch.

transistor-00

Apply voltage to: Base   –    Collector

A transistor acts as a switch, operated by applying a current to the base.

A transistor acts like a switch, operated by applying a small current to the base.

Transistors come in many shapes and sizes

Transistors come in many shapes and sizes. Inside the CPU fully integrated nano-transistors are just a few atoms wide!

Using a small breadboard circuit, we can test the behaviour of a transistor. You can reproduce the following circuit see how the transistor operates.

Logic Gates

A logic gate is a small electronic circuit made of one or two transistors and used to process binary data. Logic gates such as the AND gate, OR Gate, NOT Gate, XOR gate and NAND gates are the key building blocks of any computer system.

In this challenge, you will recreate some of theses logic gates by combining several transistors together. You will then test your logic gates to record their behaviour using a truth table, that will show all the outputs of your logic gates for all possible input combinations.

Use the tabs below to see how some of the key logic gates are built using transistors:

AND GateOR GATENOT GATENAND GATE
transistor-AND-Gate
Now let’s recreate this circuit a breadboard and a few electronic components:

Truth Table:

Input A Input B Output X
0 0
0 1
1 0
1 1
transistor-OR-Gate
Now let’s recreate this circuit a breadboard and a few electronic components:

Truth Table:

Input A Input B Output X
0 0
0 1
1 0
1 1
transistor-NOT-Gate
Now let’s recreate this circuit a breadboard and a few electronic components:

Truth Table:

Input A Output X
0
1
transistor-NAND-Gate
Now let’s recreate this circuit a breadboard and a few electronic components:

Truth Table:

Input A Input B Output X
0 0
0 1
1 0
1 1

Integrated Circuits?


An integrated circuit (also referred to as a chip, or a microchip) is a set of electronic circuits on one small flat piece (or “chip”) of semiconductor material, normally silicon. The integration of large numbers of tiny transistors into a small chip results in circuits that are smaller, cheaper, and faster than those constructed of discrete electronic components.

Integrated Circuit 7408: Quad 2-input AND gate

Integrated Circuit 7408: Quad 2-input AND gate

More complex integrated circuits include binary adders (half-adder, full adder used to perform binary additions) and flip-flop circuits used to implement volatile memory.

List of 7400 series integrated circuits:
https://en.wikipedia.org/wiki/List_of_7400_series_integrated_circuits

Mirco-Processors?


A microprocessor is a computer processor which incorporates the functions of a computer’s central processing unit (CPU) on a single integrated circuit (or at most a few integrated circuits). The microprocessor is a multipurpose, clock driven, register based, digital-integrated circuit which accepts binary data as input, processes it according to instructions stored in its memory, and provides results as output.
A microprocessor is a computer processor which incorporates the functions of a computer's central processing unit (CPU) on a single integrated circuit

A microprocessor is a computer processor which incorporates the functions of a computer’s central processing unit (CPU) on a single integrated circuit

The Lost Roman Sundial

Roman Britain was a period of nearly 400 years between AD 43 to AD 410 when large parts of Great Britain were under occupation by the Roman Empire. During this period, the Romans built roads and architectural structures that can still be seen today. These include military structures such as forts and walls (including Hadrian’s Wall), Roman baths and aqueducts.

The Romans also introduced a number system based on roman numerals. These roman numerals are still used today, for instance on most analogue clocks, even though mechanical clocks did not exist at the time. Three main types of timepieces were used in ancient Roman times: The sundial, the klepsydra, and the obelisk.

A team of archaeologists has recently discovered some old parchments that include a map of the old roman city of Bath, Somerset, UK (Aquae Sulis) covered with Roman numerals from I to L (1 to 50). They also found 12 encoded messages and a piece of a golden sundial that they believed belonged to emperor Claudius. The legend tells that the sundial was broken in 13 pieces which were spread out and buried all over the city of Bath. The archaeologists would need your help to decode these messages, which they believe will help them locate the 12 remaining pieces of the lost golden sundial!
The Lost Roman Sundial – Code Breaking ChallengeOpen in New Window

Art Expo – Code Breaking Challenge

The most prestigious art exhibition is about to start at Tate Modern, London, UK. For the purpose of this exhibition, paintings from all over the world have been securely transported to London using a state of the art protection system called the multi-safe.

The multi-safe contains 12 individual locked compartments which are large enough to store one painting each. Each compartment is locked using a rotating combination locking system. Each combination consists of 3 numbers.

For security purposes, the actual combinations are kept secret and the Gallery manager has only been given access to 12 coding puzzles that will be necessary to retrieve the combinations and unlock the multi-safe 12 compartments. The gallery manager needs you to help him access to the world’s 12 most famous paintings before the gran opening of the Expo Art exhibition.

Before attempting this task, you should practice unlocking this padlock, by spinning the padlock wheel and using the combination provided below:

You now have under 1 hour to unlock the 12 compartments of the secure artwork storing safe. Good luck!

Art-Expo – Code Breaking ChallengeOpen in New Window

Understanding Binary Data

01101001
0 and 255
65,535
binary data
8 bits
bits
odd
least significant
text files
transistor
511
even
Byte
most significant
The key electronic component that you will find in any computer system is called a . The CPU of a computer contains billions of transistors. A transistor is an electronic switch that can be turned on (1) or off (0). This is the reason why computers can only process also called digital data.

Binary data is made of (short for binary digits) of data: 0s and 1s. Everything that is stored on a computer must be in binary form. This includes, numbers, , images, sound files and video clips.

So let’s start with numbers: Using of data you can form a : For instance is a Byte of data. A Byte of data can be used to represent any denary number between . You can easily convert a denary number into binary and vice versa using the following conversion table:

Using this conversion table, you can see that the bit on the left is the bit and is worth 128, whereas the bit on the right is the bit as it is only worth 1.

You will hence notice that in Binary an number will always have 1 as its least significant bit, whereas an number will always have 0 as its least significant bit.

To make a number higher than 255, you will need to use extra bits, added to the left of this conversion table. e.g. Using 9 bits instead of 8 would allow you to store numbers up to , and using 2 Bytes (16 bits) would allow you to store numbers from 0 to

Now that you understand how numbers can be stored into binary, you can investigate further how text files, images and sound files can also be stored in binary:

Work Life Balance (HTML, CSS & JS Challenge)

When your browser displays a webpage on screen it uses 3 different programming languages called HTML, CSS and JavaScript. We call the combination of these three languages “client-side web technologies”.

Each of the three language has its own syntax and purpose:

  • HTML uses <tags> and its purpose is to add content on the page such as text, pictures, and video clips.
  • CSS is used to customise the look and feel of the page by defining the position of each element on the page, defining the layout of the page as well as formatting text, pictures and other components on the page.
  • JavaScript is used to add user interaction to the page. JavaScript can be linked to HTML tags through various events such as the onClick event of a button.

Each of these languages are based on web standards defined by the World Wide Web Consortium W3C. As a consequence these languages are recognised by all the main web-browsers including Google Chrome, Microsoft Edge, Modzilla Firefox, Safari, etc. on various platforms (Windows, MacOs, Linux, Android etc.)

The Following codepen provides a clear demonstration of the syntax and purpose of HTML, CSS and JavaScript and shows how JavaScript can interact with various HTML tags.

See the Pen
Untitled
by 101 Computing (@101Computing)
on CodePen.

Your Challenge:


Add three more slider controls, each with a ranging from 0 to 255, to pick an RGB colour code and apply this colour code to the colour of the font used to display the text “Work Life Balance”. You will have to click in the top right corner (“Edit on CodePen”) to be able to tweak this code.


unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

The Birthday Paradox

The birthday paradox is based on a counter-intuitive fact that in any class of 23 students or more, there is a higher probability of having at least two students sharing the same bithday.

Considering that there are 366 different possible dates in a year (leap year), you may first predict that it would take a group of 183 students (50% of 366) to reach a 50% probability of at least two students sharing the same birthday. However this prediction would be wrong as this is not how the probabilities work in this case. You can use this page to find out more how to work out that with a class size of only 23 students, there is a probability of 50% that at least two students share the same birthday.

Python Challenge

For this Python challenge we will create a statistical simulation program to test the Birthday Paradox. Our aim is to determine whether the actual probabilities match the predicted probabilities by showing that, with a group of 23 students or more, the probability of having at least two students sharing the same birthday will be at least 50%.

We have started a program to help you with this challenge (See trinket window below). So far our program will:

  1. Generate a class list of students (e.g. 23 students or more)
  2. Use a randomDate() function to generate random birthdays for each of our students
  3. Store the lists of birthdays in a list
  4. Output the list of students with their randomly generated birthdays

Your task is to complete this code to:

  • Work out if, in this list of students, at least two students share the same birthday, and if so output their names and birthdays.

You will then be able to run this code several time to check whether, with a group of 23 students or more, you obtain a 50% or above chance of having at least two students sharing the same birthday. Note that you could also get the program to automatically repeat the experiment several times and calculate the resulting statistic (e.g. out of 10 experiments).

Below is the code to complete…

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Elastic Collision in a Pool Game

A range of video games use elastic collision formulas to predict the change of velocity of two objects when a collision occurs.

Elastic collision occurs when two objects are colliding and the total kinetic energy of the two objects remains the same. In reality, most collisions between two objects would result in some loss of energy (inelastic collision). However in some contexts, such as when two rigid billiard balls are colliding, this loss of energy is negligeable. In a video game of pool we would therefore implement an algorithm based on an elastic collision.

Let’s investigate how we can implement an elastic collision in a computer animation or a video game.

Velocity Vector

In a frame based game, most moving sprites would have a set of coordinates (x,y) to inidicate their position on the screen as well as a vaolcity vector (vx,vy) to indicate used to increment the (x,y) coordinates between two frames of the game and hence implement the movement of the sprite.

1 Dimensional Elastic Collision

Let’s consider two perfectly elastic balls of masses m1 and m2 moving along the same straight line with velocities u1 and u2.

Our aim is to calculate the velocity v1 and v2 of these two balls after the collision.

Conisidering that both momentum and kinetic energy are conserved quantities in an elastic collision, we can deduct the following two formulas:

Conservation of momentum

Conservation of kinetic energy

We can use both these formulas to calculate the velocity vectors v1 and v2 of the two colliding objects after the collision:

Note that these equations can be simplified when both colliding objects have the same mass: m1=m2. In this case we can use the following simplified formulas:

2 Dimensional Elastic Collision

In a 2-dimension environment, the velocity vectors may not be aligned on the same straight line.

We can however decompose the velocity vectors to identify the component of the velocity that is going along the straight line joining the centre of both moving balls (Purple vectors on the above diagram) and the component that is perpendicular to this straight line (Grey vectors on the above diagram). The first component will be affected by the elastic collision using the 1-Dimensional model/formulas whereas the second component will not be affected by the collision.

In order to calculate the 2 components of our velocity vectors (purple and grey vectors) we will first need to perform a rotation by θ, the angle that can be calculated using the (x,y) cartesian coordinates of the centre of both moving objects as follows:

We will then rotate our velocity vectors by θ as shown on the diagram below. Note however, that we would apply the same rotation for both velocity vectors (red and blue balls).

The formulas to perform a 2D rotation are as follows: (You can find out more about these formulas on this page)
where (Vx,Vy) represents the velocity vector (vx,vy) after the rotation.

We can now apply the 1-dimensional elastic collision formulas to the Vx (purple component) of the velocity for each moving object, whereas the Vy components will not be affected by the elastic collision.

And then we will need to rotate our new velocity vectors by to cancel out the previous rotation.

2-Dimensional Elastic Collision Demonstration

To see how the above formulas can be implemented, we have created a demo using JavaScript. You can investigate this code further to identify how the steps described above have been implemented.

In our demo, all the moving objects have a different mass, pro-rata of their size (radius).

Note that this code could be simplified further using objects of the same mass as this would be the case in a game of pool!

Finally, you will notice that this code also applies some formulas to the velocity vectors of each ball to let the balls bounce against the edge of the canvas. These formulas are explained on this page.

Your Task

Your task consists of tweaking the above code (Click on “Edit On Codepen” button in the top right corner of the above codepen frame) in order to create a pool table with:

  • 7 yellow balls
  • 7 red balls
  • 1 black ball
  • 1 white ball

Note that, in a game of pool, all balls have the same mass and size. You can hence simplify the code to use the simplified 1-dimensional elastic collision formulas.

About this task: The aim of this challenge is not to create a full game of pool but just to tweak the above code to make sure that the canvas contains 16 balls of the right colour and of the same weight/size. In a full game of pool, other features would need to be considered such as, implementing the correct size of the pool table, adding pockets and detecting when balls fall into these pockets, adding friction to slow down the rolling balls and adding a mechanism for the player to aim/shoot. All of these features are not part of this task.

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area