Search CSNewbs
304 results found with an empty search
- 4.3 - Binary Calculations - Eduqas GCSE (2020 Spec) | CSNewbs
Learn about how to perform binary addition and binary subtraction. Based on the 2020 Eduqas (WJEC) GCSE specification. 4.3: Binary Calculations Exam Board: Eduqas / WJEC Specification: 2020 + What are binary calculations? Binary addition and binary subtraction are methods of adding or subtracting binary values without having to convert them into denary. How to add binary numbers: How to subtract binary numbers: Overflow & Underflow Errors Overflow and underflow errors occur when there is not enough space to accurately represent a binary number in the bits available . What is an overflow error? An overflow error occurs when a binary value is too large to be stored in the bits available . In technical terms, an overflow error occurs if a carry (remainder) is present on the most significant bit (MSB ). The CPU then sets the overflow flag to true . The most significant bit (MSB ) is the largest bit (always the one furthest to the left ) of a binary value (e.g. 128 for an 8 bit value). A flag is an alert signal . It is either on or off. The overflow flag is turned on by the CPU when an overflow occurs. What is an underflow error? An underflow error occurs when a number is too small to be stored in the bits available . The value is too close to 0 to be accurately represented in binary. Q uesto's Q uestions 4.3 - Binary Calculations: 1a. Describe the terms ' most significant bit ' and ' flag '. [ 2 ] 1b. Using the terms from 1a , explain what an overflow error is. [ 2 ] 1c. Describe what is meant by an underflow error . [ 2 ] 2. Add together the following binary values. If an overflow error occurs you must state one has occurred. a. 010110012 and 010001012 [2 ] b. 110110112 and 010111012 [2 ] c. 001101102 and 011010112 [2 ] d. 110110112 and 010101112 [2 ] e. 011011012 and 110101102 [2 ] 3. Subtract the following binary values; put the first value on top of the second value: a. 100110102 and 000110002 [2 ] b. 110110112 and 010111012 [2 ] c. 011101102 and 011010112 [2 ] d. 110110112 and 010101112 [2 ] e. 111011012 and 110101102 [2 ] Watch on YouTube Watch on YouTube 4.2 Signed Binary Theory Topics 4.4 - Arithmetic Shift
- 2.3 - Units - OCR GCSE (J277 Spec) | CSNewbs
Learn about different data units of storage from bit up to petabyte, as well as data capacity calculations. Based on the J277 OCR GCSE Computer Science specification (first taught from 2020 onwards). 2.3: Data Units Exam Board: OCR Specification: J277 Watch on YouTube : Units of Data Storage Capacity Requirements All computer systems communicate , process and store data using binary . Binary is a number system consisting entirely of 0s and 1s . Why do computers use binary? Computer systems consist of billions of tiny transistors which are switches that only have two values - on (1 ) or off (0 ). Therefore all data must be represented and processed in this way. Everything that a computer needs to process must be converted into a binary format including text , images , videos and audio . 0010 1011 0101 0101 0110 0111 0101 0001 0101 0101 0101 0100 1010 1010 1010 1010 1111 1110 0010 1001 0100 1001 0010 0111 0111 0101 0011 1010 1000 0101 0110 0111 0000 1010 1010 0011 1101 1001 0010 1101 0010 0100 1001 0011 1010 1001 0101 0101 0010 0101 0111 0101 0101 1000 1011 0111 Units of Data Storage 0 / 1 All data in a computer system is made up of bits . A single bit is a 0 or a 1 . 4 bits (such as 0101 or 1101) is called a nibble . 1,000 bytes is called a kilobyte . A kilobyte can store a short email . A 8 bits is called a byte . A byte can store a single character . 1,000 kilobytes is called a megabyte . A megabyte can store about a minute of music . 1,000 megabytes is called a gigabyte . A gigabyte can store about 500 photos . 1,000 terabytes is called a petabyte . A petabyte can store about 1.5 million CDs . 1,000 gigabytes is called a terabyte . A terabyte can store about 500 hours of films . Calculating Data Capacity Requirements It is important to be able to calculate the required storage capacity for a given set of data . Example: A local DJ has a USB memory stick with a capacity of 32GB . There is currently only 9GB of space remaining . Each song is 6MB . How many songs can be stored on the remaining space of the USB stick? Solution: Because each song is recorded in megabytes but the USB stick capacity is measured in gigabytes , the values must be converted into the same storage unit . 9GB x 1000 = 9000MB 9000MB ÷ 6MB = 1,500 songs Q uesto's Q uestions 2.3 - Data Units: 1. Explain why computer systems use binary to represent data. [ 2 ] 2. Put the following data storage units in order from smallest to largest : a . kilobyte - gigabyte - byte - megabyte - nibble - bit [3 ] b. gigabyte - petabyte - kilobyte - byte - terabyte - megabyte [ 3 ] 3. A hard drive contains 25GB of remaining available storage space. Tim is an animator backing up video files. Each file is 200MB . How many files can he fit on the hard drive? [ 2 ] 4. Samantha is a musician. She has compressed each song to 900KB . Her USB memory stick contains 1.2GB of free storage. How many songs can she fit on the USB stick? [ 2 ] 5. A CD has a capacity of 650MB . How many 0.2GB audio files can be stored on the CD? [ 2 ] 0101 2.2 - Secondary Storage Theory Topics 2.4a - Number Systems
- Python | 10c - Remove & Edit Lines | CSNewbs
Learn how to split, edit and removes lines using files in Python. Try practice tasks and learn through text and images. Perfect for students learning GCSE Computer Science in UK schools. Python 10c - REMOVE & Edit LINES Splitting a File The split command is used to split up a line of a file into different parts . The character or string in brackets after the split command is the value that will denote each split . In the example below I have split the file at each comma . Remember that Python numbering starts at 0 so the first section is 0, not 1. 0 1 2 3 The program below splits each line of the file at each forward-slash ( / ). The printed statement is the employee's first name, surname and job position. 0 1 2 3 4 Practice Task 1 Create a file (new txt document in Notepad) called movies. Type in the movie name, main actor, genre (e.g. horror), year it was released and your rating out of 10. Print just the movie name and year it released. Example solution: Deleting Lines in a File Exact Line Name The code below shows how to remove a line from a file using the exact name of the line , which will only work for short or simple files . First open the file in read move to save each line in a variable I've named lines. Then ask the user to input the exact line they want to remove (e.g. 'plum' in my example). Then open the file in write mode and use a for loop to read each line and only write it back into the file if it isn't equal to the line the user entered - such as 'plum'. The line.rstrip() command is important as it removes any spaces or empty lines that may interfere with matching the line to the input. Deleting Lines in a File Word in the Line The code below shows how to remove a line from a file if a certain word appears in that line , although this could be dangerous with large files. In my example I have written apple which has also removed pineapple! The difference from the previous program is to change the for loop so that it checks if the inputted word appears in the line . If it does appear then nothing happens (except a print statement to acknowledge it's been found). If the word doesn't appear then that line can be safely rewritten to the file . Practice Task 2 Download the trees text file. Give the user a choice of removing a specific tree or a type of tree. If they choose a specific tree then remove the line if it is an exact match (e.g. Field Maple). If they choose to remove a type of tree remove all lines that contain the name of that tree (e.g. willow) Make sure you actually check the file to see if the lines have been removed correctly! Example solution: Download the trees file: Sorting a File Sorting a file into alphabetical (or numerical ) order is a simple process. Open the file in read mode and save the lines into a list . The sort c ommand will automatically order the list of lines. If necessary, in the brackets type reverse = True to sort the list in reverse. Practice Task 3 Expand on your tree program from the previous practice task. As well as SPECIFIC or TYPE, allow the user to enter SORT to sort the tree file either in alphabetical order or reverse alphabetical order. Check the text file to see if it has been sorted correctly. You may make this a separate program from task 2 if you wish. Example solution: Editing Lines in a File Overwriting data in a file is a tricky process. The program below uses the same Employees.txt file as above but allows the user to change the address of an employee . A temporary file is created to store the lines of the employee file, but the line with the changes is replaced specifically with the new address. I have explained each line of the program to the right: When I executed the program below I entered Thomas Wynne's details and changed his address. When I opened the employees file the address had been updated : 1: Importing os allows me to rename and remove files later in the program. 3: Opens the employee file in read mode . 5 - 8: Input lines allow the user to enter the first name, surname and the person's new address. 10: A found flag is set up and set to False . 12: The for loop cycles through each line in the file. 13: Each line is split into separate parts from each / . 15: An if statement checks if the first name and surname match an employee in the file. 16: A replacement line is created by putting the original line together but with the new address. 18: The found flag is changed to True because the employee first name and surname matched . 19: A temporary file is created and opened in write mode . 20: The seek command restarts the file at line 0 . 22: The for loop cycles through each line of the employee file from the beginning. If the first name and surname match it will write the new line to the file, otherwise it will rewrite the original line . 28 & 29: Both files are closed . 31 & 32: If the names didn't match , an appropriate message is printed. 34 - 37: If the address was changed, the original file is renamed and deleted and the temp file is renamed as the original file. Practice Task 4 Use the movie file you created for practice task 1. Ask the user to enter the name of a movie. Ask them to enter an updated rating out of 10. Update the file to change the rating to the new value. Example solution: ⬅ 10b - Read & Search Files Section 10 Practice Tasks ➡
- 4.2 - Global Legislation | Unit 2 | OCR Cambridge Technicals | CSNewbs
Learn about legislation that covers a wider geographic area including the UNCRPD. Based on the 2016 OCR Cambridge Technicals Level 3 IT specification for Unit 2 (Global Information). 4.2 - Global Legislation Exam Board: OCR Specification: 2016 - Unit 2 Data Protection Outside of the UK Personal data should not be transferred outside of the UK unless the country receiving the data has adequate data protection laws that match the Data Protection Act (2018) / GDPR (General Data Protection Regulation ). GDPR was introduced in all European Union (EU ) countries in 2018. This set of regulations ensure that personal data is protected and can be sent between EU countries. However, many other countries only have partially adequate data protection laws (such as the USA and Canada) whilst many nations have inadequate or no laws regarding data protection. Click the map button to visit CNIL's website and see exactly which countries have adequate, inadequate and no data protection laws. UNCRPD UNCRPD stands for United Nations Convention on the Rights of Persons with Disabilities . This is a United Nations human right that states disabled people should be able to 'access information systems' (article 9) and 'use digital means to express their opinion' (article 21). Methods of complying with this convention include: Personal data can be sent between European countries (such as the UK) and the United States because of a protection scheme which was known as the 'Safe Harbour ' scheme (between 2000 and 2015) and the 'EU-US Privacy Shield ' (between 2015 and 2020). This provided protection to European data in the US and required both companies engaged in data transaction to sign up to the scheme before personal data could be transferred. The companies must have been assessed as responsible for the security of the data. The scheme was stopped in July 2020 because the European Court of Justice argued it did not adequately protect the personal data of Europeans from government access. Using < alt> text on images so that text-to-speech software can describe the image aloud, for the visually impaired . The tag can be added to the HTML code of an image on a website and will be audibly spoken by specialist reading software. This image contains alt text that can't be seen by a typical viewer but will be read aloud by screen reading software. Accessibility settings . Websites could allow users to change the font size and style or change the background colour to make text easier to read . Wikipedia presents some articles to be listened to if the user is unable to read them. Example Text Example Text Example Text Example Text Q uesto's Q uestions 4.2 - Global Legislation: 1a. What is the problem with transferring data outside of the UK ? [2 ] 1b. Why can personal data be transferred between European countries ? [2 ] 2. Open the CNIL map (use the link on this page and click on a specific country to see its name) and state: Four countries in the EU Two countries with partially adequate protection Two countries with an authority and law (dark purple) Two countries with laws only (light purple) Four countries with no data protection laws [7 ] 3a. What is UNCRPD and why is it important ? [3 ] 3b. Describe what alt text is used for. [2 ] 3c. State three accessibility settings that could affect how easy text is to read . [3 ] EU-US Privacy Shield 4.1 - UK Legislation Topic List 4.3 - Green IT
- Download Greenfoot | CSNewbs
A tutorial to understand how to create a game in Greenfoot. A simple step-by-step guide and walkthrough featuring all code needed for the Eduqas GCSE 2016 specification. Installing Greenfoot Greenfoot Home According to the Eduqas 2016 specification exam students will use version 2.4.2 of Greenfoot in the Component 2 exam . Eduqas GCSE students should practice using version 2.4.2 - despite the most up-to-date version currently being 3.6.1. If you are not learning Greenfoot for the Eduqas GCSE then you may wish to download and use the most current version. Eduqas 2016 Specification Students Other Students The version used in the Component 2 exam is 'Greenfoot version 2.4.2 '. Scroll down to 2.4.2 on the old download page and select the correct version for your computer. Windows systems should use the 'For Windows ' option. If you are not following the Eduqas 2016 specification then you should download the most up-to-date version of Greenfoot. Select the correct version for your computer at the top of the download page .
- 8.3 - Writing Algorithms - Eduqas GCSE (2020 Spec) | CSNewbs
Learn about how to write algorithms, including pseudocode and the different flowchart symbols. Based on the 2020 Eduqas (WJEC) GCSE specification. 8.3: Writing Algorithms Exam Board: Eduqas / WJEC Specification: 2020 + Pseudocode Reminder Generally, pseudocode can be written in any way that is readable and clearly shows its purpose. However, the Eduqas exam board advises that pseudocode for the programming exam should follow the conventions below : Annotation { Write your comment in curly brackets} Define data type price is integer firstname is string Declare a variable's value set price = 100 set firstname = "Marcella" Input / output output "Please enter your first name" input firstname Selection (must have indentation) if firstname = "Steven" then output "Hello" + firstname elif firstname = "Steve" then output "Please use full name" else output "Who are you?" end if Iteration (while loop) while firstname ! = "Steven" output "Guess my name." input firstname repeat Iteration (for loop) for i in range 10 input item next i Define a subroutine Declare Sub1 [Subroutine content indented] End Sub1 Call a subroutine call Sub1 Writing Algorithms In an exam you may be asked to write an algorithm using pseudocode . Previous exams have offered up to 10 marks for a single algorithm . While this may seem daunting, it means you can still gain marks for an incomplete program , so don't leave it blank no matter what! You must decompose the problem and break it down into more manageable chunks . Here's an example question : “A teacher is marking tests. Write an algorithm that allows the teacher to input the number of tests to mark and then the mark of each test. Output the average mark, highest mark and lowest mark. The tests are marked out of 100.” This specific algorithm can be broken down into pre-code and three main parts : Part 0: Declare and assign variables. Part 1: Input the number of tests to mark. Part 2: Input the mark of each test. Part 3: Output the average, lowest and highest marks. Part 0: Variables Read the question carefully and work out the variables you will need in your algorithm. I have highlighted them in blue below: “A teacher is marking tests. Write an algorithm that allows the teacher to input the number of tests to mark and then the mark of each test . Output the average mark , highest mark and lowest mark . The tests are marked out of 100.” There is an additional variable to track as the average mark can only be worked out if we also know the total marks . number_of_tests is integer test_mark is integer average_mark is real highest_mark is integer lowest_mark is integer total is integer number_of_tests = 0 test_mark = 0 average_mark = 0 highest_mark = -1 lowest_mark = 101 total = 0 Before you write the actual program, you must declare the variables you will need and assign values to them. Firstly, declare the data type of each variable . A whole number is an integer and a decimal number is a real . The average must be a real data type because it is the result of division (total ÷ number_of_tests) and could be a decimal number . When assigning values, most numerical variables will be 0 . Most string values would be " " . However this question is a bit more complicated - the highest mark must start as a really low value and the lowest mark must start as a really high value . This is ensure the first mark entered becomes the highest and lowest mark - this will make sense later. Part 1: Input Number of Tests output “Enter the number of tests to mark: ” input number_of_tests After declaring and assigning your variables the next parts will depend on the algorithm you need to write. This example requires the user to input the number of tests . Part 2: Input Each Mark (Loop) for i = 1 to number_of_tests output “Enter the test mark: ” input test_ mark For part 2 we need the teacher to enter each test’s mark . This is best done as a loop as we do not know how many tests the teacher has to mark until they have typed it in (part 1). All code within the loop must be indented . if test_mark > highest_mark then highest_mark = test_mark endif if test_mark < lowest_mark then lowest_mark = test_mark endif We also need to work out what the highest and lowest marks are. This must be done within the loop as the test marks are entered. The test mark is compared to the current highest and lowest marks . If it is higher than the current highest mark it becomes the new highest mark . If it is lower than the current lowest mark it becomes the new lowest mark . This is why we set the highest_mark and lowest_mark to extreme values at the start - so the first mark entered becomes the new highest and lowest . total = total + test_mark next i The final steps of part 2 are to update the total marks and to close the loop . The total is increased by the test mark that has been entered. The ‘next i ’ command states that the current iteration has ended . The indentation has now stopped. Part 3: Outputs average_mark = total / number_of_tests output “The average mark is:” , average_mark output “The highest mark is:” , highest_mark output “The lowest mark is:” , lowest_mark Before the average can be output, it must be calculated by dividing the total by the number of tests . Then the average , highest and lowest marks can be output . Full Answer number_of_tests is integer test_mark is integer average_mark is real highest_mark is integer lowest_mark is integer total is integer number_of_tests = 0 test_mark = 0 average_mark = 0 highest_mark = -1 lowest_mark = 101 total = 0 output “Enter the number of tests to mark: ” input number_of_tests for i = 1 to number_of_tests output “Enter the test mark: ” input test_ mark if test_mark > highest_mark then highest_mark = test_mark endif if test_mark < lowest_mark then lowest_mark = test_mark endif total = total + test_mark next i average_mark = total / number_of_tests output “The average mark is:” , average_mark output “The highest mark is:” , highest_mark output “The lowest mark is:” , lowest_mark This example is slightly more complicated than some of the recent previous exam questions for writing algorithms. Remember to decompose the problem by identifying the variables you need first. Q uesto's Q uestions 8.3 - Writing Algorithms: 1. A violin player performs a piece of music 8 times . They record a score out of 5 how well they think they performed after each attempt. Write an algorithm using pseudocode that allows the violinist to enter the 8 scores and displays the highest score , lowest score and average score . An example score is 3.7. [10 ] 2. A cyclist wants a program to be made that allows them to enter how many laps of a circuit they have made and the time in seconds for each lap . For example they may enter 3 laps, with times of 20.3 , 23.4 and 19.8 seconds . The program should output the quickest lap time , slowest lap time , total amount of time spent cycling and the average lap time . Create an algorithm using pseudocode for this scenario. [10 ] 8.2 - Understanding Algorithms Theory Topics 8.4 - Sorting & Searching
- 3.4 - Web Technologies | OCR A-Level | CSNewbs
Learn about HTML, CSS, JavaScript, search engine indexing, the PageRank algorithm and client-side and server-side processing. Based on the OCR H446 Computer Science A-Level specification. Exam Board: OCR A-Level 3.4 - Web Technologies Specification: Computer Science H446 Watch on YouTube : HTML CSS JavaScript Search Engines & PageRank Server-Side & Client-Side Processing This topic looks at the languages that web pages are comprised of (HTML , CSS and JavaScript ) as well as search engines and network processing (client-side and server-side ). HTML HTML ( HyperText Markup Language ) is the standard language used to create and structure web pages . It uses tags enclosed in angle brackets to define elements on a page . A web page begins with , which contains a section for metadata , links and the
- Python | 1c - Creating Variables | CSNewbs
Learn how to create variables in Python. Try practice tasks and learn through text and images. Perfect for students learning GCSE Computer Science in UK schools. top Python 1c - Creating Variables What is a Variable? A variable represents a value that can change as a program is running . The two parts of a variable are the name (e.g. sweets) and the value (e.g. 8). sweets = 8 print (sweets) = 8 amount of sweets = 8 8sweets = 8 sweets A variable can't contain spaces , it must start with a letter , and you must declare its value before you can use or print it. You always need to print the variable name (e.g. biscuits), not the value (20) as the value can change. Important – When writing variable names, we do not need speech marks. (e.g. type biscuits , not “biscuits”) We use variables because the value of something might change as the program is executed. For example, if someone eats a sweet then the value of our variable changes: sweets = 8 print (sweets) sweets = 7 print (sweets) = 8 7 sweets = 8 print ( Sweets) You must be consistent with capital letters when writing variable names. sweets and Sweets are treated as two different variables. Creating Variables Task 1 ( Age & Pets) Make a variable named age and set it to your current age. On the next line print age . Make another variable named pets and set it to how many pets you have. On the next line print pets . Example solution: 14 2 Variables with Strings (Text) In programming, a collection of alphanumeric characters (letters, numbers and punctuation) is called a string . "Pikachu" is a string. In the example below, pokemon is the variable name that represents the variable value "Pikachu" . pokemon = "Pikachu" print (pokemon) = Pikachu To create a string, we use "speech marks" . Numbers by themselves and variable names do not use speech marks. Each variable can only have one value at a time, but it can change throughout the program. pokemon = "Pikachu" print (pokemon) pokemon = "Squirtle" print (pokemon) = Pikachu Squirtle Creating Variables Task 2 ( Superhero & Colour ) Make a variable named superhero and set it to any of your choice, such as "Spider-Man" . Print the superhero variable on the next line. Make another variable named colour and set it to the colour related to your chosen superhero. Print the colour variable on the next line. Example solutions: Spider-Man Red The Hulk Green ⬅ 1b - Co mmenting 1d - Using Variables ➡
- Python | 10a - Open & Write to Files | CSNewbs
Learn how to create, open and write to files in Python. Try practice tasks and learn through text and images. Perfect for students learning GCSE Computer Science in UK schools. Python 10a - Open & Write To Files Creating and Opening Files The "a" opens the file in append mode which will add new data to the end of the file. The open command is used to open files but it is also used to create new files . 'file' is just a variable and can be more relevant such as customer_file or whatever your file will be storing. Python looks in the same folder as your .py file and checks to see if Customers.txt already exists. If it doesn't exist, it will create the file . The .txt extension will create a Notepad file. You can use alternatives such as .text or .docs. Writing to a File In the example below I ask the user to input a name which is written to the Names.txt file. The .write command writes the contents of the brackets to the file . You must close the file with the .close() command or the contents will not be saved . The .write command can be adapted depending on how you want the file to appear: Your text file won't update while it is open . Close it and open it again to see any changes . If you make any mistakes, just edit the file by hand and save it again. Practice Task 1 Create a new file called MyFriends.txt Ask the user to enter 5 names. Write the 5 names into a file. Place each name on a separate line. Check the file to see if the names have been entered. Example solution: Writing Multiple Lines to a File Files are often used to store data about multiple people . The program below asks for a customer's name, appointment date and VIP status then saves this information into a file. The plus symbol is used to write information for a single customer on the same line . This is beneficial if you want to search for a customer later. Practice Task 2 Create a new file called ALevels.txt Ask the user to enter a student's name and their three A-Level subjects. Write each student's information on the same line. Enter at least three different students and check your file to see it has worked. Example solution: ⬅ Section 9 Practice Tasks 10b - Read & Search Files ➡
- Python | Section 3 Practice Tasks | CSNewbs
Test your understanding of data types, calculations and modulo. Try practice tasks and learn through text and images. Perfect for students learning GCSE Computer Science in UK schools. top Python - Section 3 Practice Tasks Task One: Square Number Create a program that asks the user to input a number and then prints the square of that number - to do this, multiply the number by itself . Remember: Break up variables and parts of a sentence in a print line by using commas. Example solutions: Enter a number: 12 The square of 12 is 144 Enter a number: 7 The square of 7 is 49 Task Two: Multiplying Numbers X Example solutions: Create a program that asks the user to input two numbers (num1 and num2 ). Multiply the two numbers together and print the total . Remember: Break up integer variables in a print line by using commas between each part of the sentence. Enter number one: 7 Enter number two: 9 7 x 9 = 63 Enter number one: 8 Enter number two: 12 8 x 12 = 96 Task Three: Turning 65 Example solutions: Create a program to input how old the user will turn this year and then print the year they will turn 65 . You could do this in just two lines but before trying that work out on paper the steps to calculating your own age you will turn 65. What steps did you take? Try to recreate those steps in Python. You might need to create another variable to make it easier. How old will you turn this year? 15 You will turn 65 in 2073 How old will you turn this year? 42 You will turn 65 in 2046 Task Four: Multiplication Table Let the user enter a number then print the first five multiplications in its times table. This can be done more simply when you learn about for loops but for now you will need to multiply the number by 1 , then multiply it by 2 etc. Try to make this program better by displaying the number and the value it is multiplied by in your print statements. Simple example solution: Enter a number: 8 8 16 24 32 40 Better example solution: Enter a number: 7 7 x 1 = 7 7 x 2 = 14 7 x 3 = 21 7 x 4 = 28 7 x 5 = 35 ⬅ 3b - Simple Calculations 4a - If Statements ➡
- 1.1 - The CPU - Eduqas GCSE (2020 spec) | CSNewbs
Learn about the Central Processing Unit (CPU), the four components within and Von Neumann architecture. Based on the 2020 Eduqas GCSE (WJEC) specification. Exam Board: Eduqas / WJEC 1.1 The Central Processing Unit (CPU) Specification: 2020 + The Central Processing Unit ( CPU ) is the most important component in any computer system. The purpose of the CPU is to process data and instructions by constantly repeating the fetch - decode - execute cycle . CPU Components The control unit directs the flow of data and information into the CPU. It also controls the other parts of the CPU . ALU stands for ‘ Arithmetic and Logic Unit ’. It performs simple calculations and logical operations . The registers are temporary storage spaces for data and instructions inside the CPU. The registers are used during the FDE cycle . Five essential registers are explained in 1.2 . Cache memory is used to temporarily store data that is frequently accessed . Cache memory is split into different levels . Level 1 and level 2 (L1 & L2) are usually within the CPU and level 3 (L3) is just outside it. See 1.3 and 1.5 for more information about cache. You should know: The control unit is also known as the controller and cache memory is sometimes called internal memory . Computer Architecture The way a computer is designed and laid out is known as its architecture . The most common type of computer architecture is Von Neumann . Von Neumann Architecture The CPU is the most important component in Von Neumann architecture as it is constantly fetching and decoding instructions from RAM and controlling the other parts of the system . Von Neumann architecture also stores both instructions and data in memory . Being able to store programs in memory allows computers to be re-programmed for other tasks - this enables it to multitask and run several applications at the same time. Data input and output is another key feature of this architecture. An alternative architecture is Harvard , which features the control unit as the most essential component. Q uesto's Q uestions 1.1 - The Central Processing Unit (CPU): 1a. What does 'CPU ' stand for ? [1 ] 1b. What is the purpose of the CPU ? [ 2 ] 2a. Draw a diagram of the CPU , use the same symbols as shown on this page. [ 4 ] 2b. Label the four main components of the CPU. [ 4 ] 3. Describe the purpose of: a. The Control Unit [ 2 ] b. The ALU [ 2 ] c. The registers [ 2 ] d. Cache memory [ 2 ] 4a. Describe the key features of Von Neumann architecture . [ 3 ] 4b. Explain why storing data in memory is important. [ 1 ] 4c . State an alternative architecture . [ 1 ] Theory Topics 1.2 - The FDE Cycle
- Python | 5e - More Libraries | CSNewbs
Learn how to use the math library and to refresh the screen (on some editors only). Try practice tasks and learn through text and images. Perfect for students learning GCSE Computer Science in UK schools. top Python 5e - More Libraries Clear Screen Importing the os library and using the .system() command with the "clear" parameter will clear the screen . The console won't clear on offline editors like IDLE but will work with many online editors like Replit. import os print ( "Hello" ) os. system ( "clear" ) print ( "Bye" ) Bye Clear Screen Task ( Trivia Questions ) Ask three trivia questions of your choice to the user and clear the screen between each one. You should display the total they got correct after the third question - to do this you need to set a variable called correct to equal 0 at the start and then add 1 to correct each time a correct answer is given . Example solution: The Math Library The math libraries contains several commands used for numbers: sqrt to find the square root of a number. ceil to round a decimal up to the nearest whole number and floor to round down to the nearest whole number. pi to generate the value of pi (π ). The sqrt command will find the square root of a number or variable placed in the brackets and return it as a decimal number . from math import sqrt answer = sqrt(64) print (answer) 8.0 The ceil command rounds a decimal up to the nearest integer and the floor command rounds a decimal down to the nearest integer . from math import ceil, floor answer = 65 / 8 print ( "True answer:" , answer) print ( "Rounded up:" , ceil(answer)) print ( "Rounded down:" , floor(answer)) True answer: 8.125 Rounded up: 9 Rounded down: 8 The pi command generates a pi value accurate to 15 decimal places . Pi is used for many mathematical calculations involving circles . The area of a circle is pi x radius² . The first example below uses 5.6 as the radius . from math import pi radius = 5.6 area = pi * (radius * radius) print ( "The area of the circle is" , area) The area of the circle is 98.5203456165759 The example below uses an input to allow the user to enter a decimal (float ) number for the radius. It also uses the ceil command to round the area up . from math import pi, ceil radius = float(input( " Enter the radius: " )) area = pi * (radius * radius) print ( "The area of the circle is" , ceil(area)) Enter the radius: 2.3 The area is 17 Clear Screen Task ( Area of a Sph ere ) The formula of a sphere is 4 x π x r² where π represents pi and r is the radius . Use an input line to enter the radius and then calculate the area of the sphere . Round the answer down to the nearest integer using floor and print it. Example solution: Enter the radius: 7.1 The area of the sphere is 633 ⬅ 5d - Coloram a Section 5 Practice Tasks ➡









