Search CSNewbs
295 results found with an empty search
- OCR CTech IT | Unit 1 | 2.7 - Protocols | CSNewbs
Learn about the different protocols used to transfer data across a network, including TCP/IP, FTP, SMTP and Ethernet. Based on the 2016 OCR Cambridge Technicals Level 3 IT specification. 2.7 - Protocols Exam Board: OCR Specification: 2016 - Unit 1 What is a protocol? A protocol is a set of rules that allow devices on a network to communicate with each other . Protocols to Transfer Data: TCP / IP / UDP TCP ( Transmission Control Protocol ) breaks data down into small packets to be transferred across a network and reorders them back into the original data at the destination . TCP checks for errors when sending data packets, which makes it slower than UDP for data transfer, but it guarantees that no packets have been lost on the way. IP ( Internet Protocol ) is in charge of routing and addressing data packets to ensure data is transferred across networks to the correct destination . It is also an addressing system - every device on a network is given a unique IP address . TCP and IP are often used together to transfer data across the internet. UDP ( User Data Protocol ) is a faster alternative to TCP for transferring data. It is used where low latency ('low lag') is important, such as online gaming and video chat . However, UDP does not automatically check for errors so packets are more likely to be lost or received out of order . HTTP is a protocol that can be used to transfer web pages on the world wide web so that users can view them in a web browser . All URLs start with either HTTP or HTTPS (e.g. https://www.csnewbs.com ). HTTPS is a more secure version of HTTP that works with another protocol called SSL (Secure Sockets Layer ) to transfer encrypted data . You should see a padlock symbol in the URL bar if your connection to that website is secure. HTTP/HTTPS (Hyper Text Transfer Protocol) FTP (File Transfer Protocol) FTP ( File Transfer Protocol ) is used to transfer files across a network. It is used most often to upload or download files to/from a file server . ICMP ( Internet Control Message Protocol ) collects network status information (such as router errors) and is used for troubleshooting . SNMP ( Simple Network Management Protocol ) is a protocol that records network statistics , such as router usage . Network Management Protocols Email Protocols SMTP ( Simple Mail Transfer Protocol ) is a protocol used to send emails to a mail server and between mail servers . POP ( Post Office Protocol ) is for downloading and storing emails from a mail server. TCP/IP Protocol Stack The TCP/IP protocol stack is a model split into 4 layers . The model is used to visualise the different parts of a network as each of the four layers has a specific role . Splitting a network design into layers is beneficial to programmers as it simplifies design , making it easier to modify and use . Each layer has a certain purpose and is associated with different protocols . 4 Allows humans and software applications to use the network e.g. browsers (HTTP /HTTPS ), email (SMTP / POP ), file transfer (FTP ) and network management (SNMP ) applications. 3 TCP breaks the data down into data packets . This layer makes sure the data is sent and received in the correct order and reordered at the destination without errors. UDP can also be used for faster , but less reliable , data transfer . 2 The network layer is also known as the ' Internet Layer '. IP is responsible for addressing and routing data packets . The optimal route for the data to take is calculated in this layer. ICMP may be used here for network monitoring . 1 This layer handles transmission errors and passes data to the physical hardware such as routers . It also sets out the final format of data packets . Q uesto's Q uestions 2.7 - Protocols: 1. Describe each of the following protocols . Also, state the protocol's full name and draw an icon or diagram for each: a. TCP b. IP c. UDP d. HTTP & HTTPS e. FTP f. ICMP g. SNMP h. SMTP i. POP [1 each ] 2. State which protocol would be used in the following scenarios: a. Transferring a music file to a friend over the internet. b. Sending an email to a friend in Japan. c. Checking for errors on a network. d. Having a video call with a colleague in London. e. Receiving an email from the bank. f. Watching a video on YouTube. g. Checking the statistics of usage on a network [1 each ] 3. Summarise each layer of the TCP/IP stack and identify the protocols used in each layer . [ 8 ] 2.6 - Software Troubleshooting Topic List 3.1 - Server Types
- 2.3.1b - Big O Notation | OCR A-Level | CSNewbs
Based on the OCR Computer Science A-Level 2015 specification. Exam Board: OCR 3.1b - Big O Notation Specification: A-Level 2015 An instruction set is a list of all the instructions that a CPU can process as part of the FDE cycle . CPUs can have different sets of instructions that they can perform based on their function. The two most common instruction sets are the simpler RISC (Reduced Instruction Set Computer ) and more complicated CISC (Complex Instruction Set Computer ). Instruction Sets This page is still being updated. Graphical Processing Unit What is cache memory? Cache memory is temporary storage for frequently accessed data . Cache memory is very quick to access because it is closer to the CPU than other types of memory like RAM . Multicore & Parallel Systems What is cache memory? Cache memory is temporary storage for frequently accessed data . Cache memory is very quick to access because it is closer to the CPU than other types of memory like RAM . Multicore & Parallel Systems What is cache memory? Cache memory is temporary storage for frequently accessed data . Cache memory is very quick to access because it is closer to the CPU than other types of memory like RAM . Q uesto's Q uestions 3.1b - Big O Notation: 1. What is cache memory ? [ 2 ] 3.1a - Algorithm Design Theory Topics 3.1c - Stacks, Queues & Lists
- 2.2 - Boolean Algebra - Eduqas GCSE (2020 spec) | CSNewbs
Learn about the eight rules of Boolean algebra expressions. Based on the 2020 Eduqas (WJEC) GCSE specification. 2.2: Boolean Algebra Exam Board: Eduqas / WJEC Specification: 2020 + Boolean algebra is used to simplify Boolean expressions so that they are easier to understand. Because calculations can use dozens of logical operators, they are simplified in Boolean Algebra using symbols rather than words. Take your time and don't panic. In an exam, you might get a list of identities (rules) to use. One tip to solving boolean algebra is to imagine that A and B are real expressions . In the examples on this page, imagine: A represents the true statement 'the sky is blue' B represents the true statement 'grass is green' 0 always means FALSE 1 always means TRUE Boolean Symbols A = NOT A A . B = A AND B A + B = A OR B Boolean Identities are the rules that are used to simplify Boolean expressions. Each identity (law) has an AND form and an OR form , depending on whether AND or OR is being used . Commutative Law AND form: OR form: This law just switches the order of the expressions . For example, 'sky is blue' AND 'grass is green' makes logical sense in either order. Idempotent Law = AND form: OR form: This law removes repetition . Complement Law NOT AND form: The sky cannot be blue and not blue at the same time, so it must be 0 (FALSE). OR form: The sky is blue or not blue must be 1 (TRUE) as it has to be one of these options. Identity Law AND form: 1 represents TRUE . Both statements are true so it can be simplified as just A . OR form: 0 represents FALSE . Because A is true, you can ignore the false statement and it can be simplified as just A . Annulment Law AND form: 0 represents FALSE . Even though A is true, a statement cannot be true and false at the same time, so it must be 0 (FALSE). OR form: 1 represents TRUE . Both statements are true so this can be simplified as just 1 (TRUE). Absorption Law AND form: OR form: Absorption law reduces a bracket into one value. If the first A is true then both values in the brackets are true but if the first A is false then both values are false. Therefore this equation relies entirely on A and can be simplified as just A . Association Law ( ) AND form: OR form: This law separates a bracketed expression that uses the same operator inside and outside the brackets by removing the brackets . Distribution Law ( ) = ( ) ( ) AND form: OR form: The value outside of the bracket (e.g. A) is multiplied by both values inside the brackets , forming two new brackets which are linked by the logical operator formerly within the bracket . Notice that the logical operator role is switched , e.g. AND switches from within the brackets, to between the new brackets. A note about distribution law - The three values may not necessarily be three separate letters (e.g. A, B and C) as B or C could be NOT A for example. A NOT value is considered a new value , e.g. A and Ā are separate values. Another note about distribution law - Exam questions may ask you to perform the distribution law (or any law) in reverse . For example, converting (A+B) . (A+C) into A + (B.C) Boolean Algebra Exam Question Some previous exam questions have listed helpful laws for you but others haven't, so you should know each individual law . In a previous exam, the candidates were given three general laws to help them . P, Q and R just represent three different values. P . 1 = P (Identity Law) P . Q + P . R = P. (Q + R) (Distribution Law) P + P = 1 (Complement Law) Using the rules above , candidates were asked to simplify the following expression : X = A . B + A . B The general laws have been give n to you for a reason. You need to look at the laws provided and see which one currently matches the expression in front of you . If you look closely in this example, the second law is very similar to the expression you are asked to simplify so you can use it to make the first simplification, just swap P for A, Q for B and R for NOT B: Using this law P . Q + P . R = P. (Q + R) X = A . B + A . B simplifies as: X = A . (B + B) Now you need to see which of the three provided laws can be used with the current expression . The third law is very similar to the expression you now need to simplify further , just swap P for B and NOT P for NOT B: Using this law P + P = 1 X = A . (B + B) simplifies as: X = A . (1) And finally, there is one law left to use. The first law is very similar to the expression you now need to simplify further , just swap P for A. Using this law P . 1 = P X = A . (1) simplifies as: X = A You have now used all three laws and the expression is fully simplified . Remember - Look at the laws that you have been given and see which law matches your expression . Q uesto's Q uestions 2.2 - Boolean Algebra: 1. Draw the example equations and write a brief description of each of the eight Boolean laws : Commutative Law Idempotent Law Complement Law Identity Law Annulment Law Absorption Law Associate Law Distributive Law 2. Below are three Boolean identities: P . P = 0 (P + Q) . R = (P . R) + (Q . R) P + 0 = P Using the three rules above , simplify the following expression: X = (A + B) . Ā This law is called ' Inverse Law ' in the Eduqas 2016 teacher guidance but ' Complement Law ' in the 2020 specification. This law is called ' Zero and One Law ' in the Eduqas 2016 teacher guidance but ' Annulment Law ' in the 2020 specification. This law is called ' Associate Law ' in the Eduqas 2016 teacher guidance but ' Association Law ' in the 2020 specification. This law is called ' Distributive Law ' in the Eduqas 2016 teacher guidance but ' Distribution Law ' in the 2020 specification. 2.1 - Logical Operators Theory Topics 3.1 - Network Characteristics
- 3.2a - Databases & Normalisation | OCR A-Level | CSNewbs
Based on the OCR Computer Science A-Level 2015 specification. Exam Board: OCR 3.2a - Databases & Normalisation Specification: A-Level 2015 An instruction set is a list of all the instructions that a CPU can process as part of the FDE cycle . CPUs can have different sets of instructions that they can perform based on their function. The two most common instruction sets are the simpler RISC (Reduced Instruction Set Computer ) and more complicated CISC (Complex Instruction Set Computer ). Instruction Sets This page is still being updated. Graphical Processing Unit What is cache memory? Cache memory is temporary storage for frequently accessed data . Cache memory is very quick to access because it is closer to the CPU than other types of memory like RAM . Multicore & Parallel Systems What is cache memory? Cache memory is temporary storage for frequently accessed data . Cache memory is very quick to access because it is closer to the CPU than other types of memory like RAM . Multicore & Parallel Systems What is cache memory? Cache memory is temporary storage for frequently accessed data . Cache memory is very quick to access because it is closer to the CPU than other types of memory like RAM . Q uesto's Q uestions 3.2a - Databases & Normalisation: 1. What is cache memory ? [ 2 ] 3.1b - Encryption & Hashing Theory Topics 3.2b - SQL
- Greenfoot Guide #1 | World Setup | CSNewbs
Learn how to start a new Greenfoot program and set up the world and actors ready for the next steps in creating a game. Part 1 of the Greenfoot Tutorial for the Eduqas/WJEC GCSE 2016 specification. 1. Setup & Populating the World Greenfoot Tutorial 1. Open Greenfoot This tutorial uses Version 2.4.2 which is the version students are given to use in the WJEC/Eduqas Component 2 exam . Click here for more information and how to download 2.4.2 . If you are using a more recent version the code should still work but the look of the program in the screenshots may be different. In the Component 2 exam of the 2016 WJEC/Eduqas specification you would skip ahead to the New Object Placements stage further down this page as the classes should be set up for you. Watch on YouTube: 2. New Scenario For a new project, click ' Scenario ' and then ' New '. If you are using a more recent version of Greenfoot select ' New Java Scenario '. Save this new project in a suitable location such as a folder named 'Greenfoot' . You may wish to save this project as ' SimpleGame ' or ' ExampleGame '. 3. Setup the MyWorld class The first thing to do is to create a subclass of World called MyWorld which becomes our background object. Right-click on the World class and select 'New subclass... ' Set the New class name to MyWorld . Choose any image from the 'backgrounds ' image category. I have chosen the 'cell.jpg ' image. Click the Compile button in the bottom right of the Greenfoot window to save the program . 4. Create the Main Character class Now to create a new class for the main character. Right-click on the Actor class and select 'New subclass... ' Give the new object an appropriate name and choose a relevant image . I have named my class 'Sheep ' and selected the sheep.png image. 5. Right-click on Actor and create two more classes: Collectable objects to pick up (e.g. my orange) An enemy character to avoid (e.g. my elephant) Don't forget to compile the program. Watch on YouTube: After creating your classes you must move them over to the game world. This is known as populating the world . 1. New Object Placements Right-click on your main character object and select the top option e.g. 'new Sheep()'. Drag your mouse to the world and click to drop it. Complete the following actions: Place 1 main character object. Place 5 collectible objects. Place 2 enemy objects. 2. Save the World Once you have populated your world with objects then right-click anywhere on the background and select 'Save the World '. This saves the positions of each object so that it won't reset every time you start a new game. You can close the MyWorld code that automatically opens when you save the world, we never add any code to this window. Part 2 - Movement (Arrow Keys) >
- Greenfoot Guide #4 | Remove Objects | CSNewbs
Learn how to easily remove objects in Greenfoot in only two lines of code. Part 4 of the Greenfoot Tutorial for the Eduqas / WJEC GCSE 2016 specification. 4. Remove Objects Greenfoot Tutorial 1. Removing Objects Watch on YouTube: Open the editor for your main character . Underneath the if statements for using the arrow keys is where we type the removal code . If you have chosen a different collectible object, type the exact name of that class instead of Orange (e.g. Apples or Ants). 2. Add Danger to your Game Use the same code as you did earlier but change the class (instead of Orange. class I have chosen Sheep. class ). Time to code your main character to be removed if they are touched by the enemy objects ! Open the editor for your enemy class . The removal code is placed beneath the code you have already written. Check out the extension page if you want the game to stop when the main character is removed. < Part 3 - Random Movement Part 5 - Play Sounds >
- 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
- Python | 2b - Inputting Numbers | CSNewbs
Learn how to input numbers in Python. Try practice tasks and learn through text and images. Perfect for students learning GCSE Computer Science in UK schools. top Python 2B - Inputting Numbers Inputting Whole Numbers in Python To enter whole numbers then you must use the int command. int stands for integer (a whole number ) and is typed before input – don’t forget the double brackets at the end . age = int ( input ( "How old are you? " )) print ( "Have you really lived for " , age , "years?" ) = How old are you? 99 Have you really lived for 99 years? Inputting Numbers Task 1 ( Zoo) Type an input line (with int ) to ask the user how many times they’ve been to the zoo . Print a reply that uses the zoo variable (their answer). Example solution: How many times have you been to the zoo? 3 You've been to the zoo 3 times? I love animals! Inputting Decimal Numbers in Python Using float instead of int allows a decimal number to be entered instead. Again, don’t forget the double brackets at the end . miles = float ( input ( "How far have you walked today? " )) print ( "You really walked for " , miles , "miles? Wow!" ) = How far have you walked today? 5.6 You really walked for 5.6 miles? Wow! Inputting Numbers Task 2 ( Height ) Type an input line (with float ) to ask the user their height in metres. Print a reply that uses the height variable (their answer). Example solution: What is your height in metres? 1.82 You are 1.82 metres tall? Wow! ⬅ 2a - Inputting Text Sect ion 2 Practice Tasks ➡
- 1.4 - Secondary Storage - Eduqas GCSE (2020 spec) | CSNewbs
Learn about the four types of secondary storage - magnetic, optical, solid-state and cloud. Also, learn about the data storage units from bit to yottabyte. Based on the 2020 Eduqas (WJEC) GCSE specification. 1.4: Secondary Storage & Data Units Exam Board: Eduqas / WJEC Specification: 2020 + Secondary storage (also known as backing storage ) is non-volatile storage used to save and store data that can be accessed repeatedly. Secondary storage is not directly embedded on the motherboard (and possibly even external ) and therefore further away from the CPU so it is slower to access then primary storage . Storage Characteristics: CAPACITY : The maximum amount of data that can be stored. DURABILITY : The physical strength of the device, to withstand damage. PORTABILITY : How easy it is to carry the device around. ACCESS SPEED : How quickly data on the device can be read or edited . COST : The average price it costs to purchase a storage device. Magnetic Storage Optical Storage A magnetic hard disk drive (HDD ) is the most common form of secondary storage within desktop computers. A read/write head moves nanometres above the disk platter and uses the magnetic field of the platter to read or edit data. An obsolete (no longer used) type of magnetic storage is a floppy disk but these have been replaced by solid state devices such as USB sticks which are much faster and have a much higher capacity. Another type of magnetic storage that is still used is magnetic tape . Magnetic tape has a high storage capacity but data has to be accessed in order (serial access ) so it is generally only used by companies to back up or archive large amounts of data . Optical storage uses a laser to project beams of light onto a spinning disc, allowing it to read data from a CD , DVD or Blu-Ray . This makes optical storage the slowest of the four types of secondary storage. Disc drives are traditionally internal but external disc drives can be bought for devices like laptops. Magnetic Storage Characteristics: ✓ - Large CAPACITY and cheaper COST per gigabyte than solid state . X - Not DURABLE and not very PORTABLE when powered on because moving it can damage the device. X - Slow ACCESS SPEED but faster than optical storage . Optical Storage Characteristics: X - Low CAPACITY : 700 MB (CD ), 4.7 GB (DVD ), 25 GB (Blu-ray ). X - Not DURABLE because discs are very fragile and can break or scratch easily. ✓ - Discs are thin and very PORTABLE . Also very cheap to buy in bulk. X - Optical discs have the Slowest ACCESS SPEED . Magnetic Disks are spelled with a k and Optical Discs have a c. Solid State Storage Cloud Storage There are no moving parts in solid state storage. SSD s (Solid State Drives ) are replacing magnetic HDDs (Hard DIsk Drives) in modern computers and video game consoles because they are generally quieter , faster and use less power . A USB flash drive ( USB stick ) is another type of solid state storage that is used to transport files easily because of its small size. Memory cards , like the SD card in a digital camera or a Micro SD card in a smartphone , are another example of solid state storage. When you store data in 'the cloud', using services such as Google Drive or Dropbox, your data is stored on large servers owned by the hosting company . The hosting company (such as Google) is responsible for keeping the servers running and making your data accessible on the internet . Cloud storage is very convenient as it allows people to work on a file at the same time and it can be accessed from different devices. However, if the internet connection fails , or the servers are attacked then the data could become inaccessible . Solid State Characteristics: X - High CAPACITY but more expensive COST per gigabyte than magnetic . ✓ - Usually DURABLE but cheap USB sticks can snap or break . ✓ - The small size of USB sticks and memory cards mean they are very PORTABLE and can fit easily in a bag or pocket. ✓ - Solid State storage has the fastest ACCESS SPEED because they contain no moving parts . Cloud Storage Characteristics: ✓ - Huge CAPACITY and you can upgrade your subscription if you need more storage. ✓ / X - Cloud storage is difficult to rank in terms of PORTABILITY , DURABILITY and ACCESS SPEED because it depends on your internet connection. A fast connection would mean that cloud storage is very portable (can be accessed on a smartphone or tablet) but a poor connection would make access difficult . ✓ - Cloud storage is typically free for a certain amount of storage. Users can then buy a subscription to cover their needs - Dropbox allows 2 GB for free or 2 TB for £9.99 a month. Data Storage Units 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,024 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,024 kilobytes is called a megabyte . A megabyte can store about a minute of music . 1,024 megabytes is called a gigabyte . A gigabyte can store about 500 photos . 1,024 terabytes is called a petabyte . A petabyte can store about 1.5 million CDs . 1,024 gigabytes is called a terabyte . A terabyte can store about 500 hours of films . More data storage units: 1,024 petabytes is called a exabyte . 1,024 exabytes is called a zettabyte . 1,024 zettabytes is called a yottabyte . Q uesto's Q uestions 1.4 - Secondary Storage: 1. Rank magnetic , optical and solid-state storage in terms of capacity , durability , portability , speed and cost . For example, magnetic has the highest capacity , then solid-state, then optical. This could be completed in a table . [15 ] 2. Justify which secondary storage should be used in each scenario and why it is the most appropriate: a. Sending videos and pictures to family in Australia through the post . [ 2 ] b. Storing a presentation to take into school . [ 2 ] c. Storing project files with other members of a group to work on together . [ 2 ] d. Backing up an old computer with thousands of files to a storage device. [ 2 ] 3. Put the following data storage units in order from smallest to largest : a . kilobyte - gigabyte - byte - megabyte - nibble - bit [3 ] b. gigabyte - petabyte - kilobyte - exabyte - terabyte - megabyte [ 3 ] 1.3 - Primary Storage 1.5 - Performance Theory Topics
- Python | Extended Task 5 | CSNewbs
Test your ability to create a more complex program in Python based on a given scenario. Perfect for students learning GCSE Computer Science in UK schools. Extended Task 5 Collection of Colours A new paint company , 'Sparkle and Shine Paint Schemes ' needs a program that can manage the different colours they sell to customers. They currently have a file with many different colours and want a program made with features to add, remove and list the different colours . For this task, you will need to create a document and include the following sections (with screenshots where appropriate): An introduction to explain the Purpose of your program . A List of Requirements for a successful program. Screenshots of your code (with comments in your code to show understanding). Testing – Create a plan to show how you will test your program and then explanations of any errors that you found and how they were fixed . An Evaluation of what worked, what didn’t, and how you met each of your requirements from your original list. Also, discuss further improvements that you could have made to improve your program. Reminders for this task: You will need to create a selection of options for the user to choose from. Subroutines and a while true loop may help. Section 10 will help you to open, write and read from files . Section 10c shows how to remove lines from a file. There are multiple ways to approach this program, and your solution might look different from the example. Break the problem down and focus on one part at a time. Example solution: Use a menu to select the different options using a command word. Download the colours file: Selecting Total will list the number of colours in the file. This should change whenever a new colour is added or one is removed . Selecting Add will allow the user to enter the name of a new colour to be added to the file . Selecting Letter will allow the user to enter a letter . All colours beginning with that letter should be displayed . Selecting Remove will allow the user to enter a colour to be removed from the file . Selecting Random will display a random colour from the file. Selecting End will stop the program. ⬅ Extended Task 4 (Vet Surgery) Extended Task 6 (Word Game) ➡
- 1.2 - Designing Algorithms - OCR GCSE (J277 Spec) | CSNewbs
Learn about designing algorithms including constructing pseudocode and flowcharts. Based on the J277 OCR GCSE Computer Science specification (first taught from 2020 onwards). Exam Board: OCR 1.2: Designing Algorithms Specification: J277 Watch on YouTube : Inputs, Processes & Outputs Structure Diagrams Pseudocode Flowcharts Writing Code in Exams Trace Tables What is an algorithm? An algorithm is a set of instructions , presented in a logical sequence . In an exam you may be asked to read and understand an algorithm that has been written. To prove your understanding you may be asked to respond by actions such as listing the outputs of the algorithm, correcting errors or identifying an error within it. Programmers create algorithm designs as a method of planning a program before writing any code. This helps them to consider the potential problems of the program and makes it easier to start creating source code. There are two main methods of defining algorithms are pseudocode and flowcharts . In exams , OCR will display algorithms in their own 'OCR Exam Reference Language '. Visit the Python section of CSNewbs ---> OCR Exam Reference Language Below is a list of all of the code concepts from the OCR J277 GCSE specification that you need to know , presented in OCR Exam Reference Language (OCR ERL ), which is how code will be presented in the paper two exam . The code below is NOT Python . There are several differences between OCR ERL and real high-level languages like Python or Java , especially in the 'String Handling ' section and with for loops . In an exam, you can write in OCR ERL or a programming language you have learnt. All code-related videos in the CSNewbs YouTube series for Paper 2 show both OCR ERL and Python side-by-side . Basic Commands Annotation // Comments are written using two slashes Assignment name = "Harold" age = 49 Constants and Global Variables constant tax = 15 global name = "Admin" Input / Output name = input ( "Enter your name") print ("Transaction Complete") Casting str (29) int ("102") float (30) bool ("False") Random Number number = random (1,100) Selection Selection (if - then - else) if firstname == "Steven" then print("Hello" + firstname) elif firstname == "Steve" then print("Please use full name") else print("Who are you?") end if Selection (case select) switch day: case “Sat”: print(“It is Saturday”) case “Sun”: print(“It is Sunday”) default : print(“It is a Weekday”) endswitch Iteration Iteration (for loop) for i = 1 to 10 step 1 input item next i Iteration (while loop) while firstname ! = "Steven" firstname = input("Try again:") endwhile Iteration (do while loop) do firstname = input("Guess name:") until firstname == "Steven" String Handling Length of a String word = "dictionary" print(word.length ) outputs 10 Substrings word = "dinosaurs" print(word.substring (2,3)) outputs nos print(word.left (3)) outputs din print(word.right (4)) outputs aurs Concatenation name = "Penelope" surname = "Sunflower" print(name + surname) String Cases phrase = "The Cat Sat On The Mat" print(phrase .lower ) print(phrase .upper ) ASCII Conversion ASC ("C") returns 67 CHR (100) r eturns "d" File Handling File Handling - Reading Lines file1 = open ("Customers.txt") while NOT file1.endOfFile() print(file1.readLine() ) endwhile file1.close() File Handling - Writing to a (New) File newFile ("paint.txt") file2 = open ("paint.txt") paint = input("Enter a paint colour:") file.writeLine (paint) file2.close() Arrays Declare Array array names[3] array names = "Ella", "Sam", "Ali" Declare 2D Array array grid[4,5] Assign Values names[2] = "Samantha" grid[1,3] = "X" More Programming Keywords Connecting strings together using the + symbol is called concatenation . Extracting certain parts of a string (e.g. using .substring() ) is called slicing . An if statement within an if statement or a loop within a loop is called nesting . Flowcharts A flowchart can be used to visually represent an algorithm. It is more likely you will need to be able to interpret a flowchart rather than draw one. The flowchart symbols are: The terminator symbol is also known as a terminal . Algorithm Examples Below are two different methods for representing the same algorithm - a program to encourage people to buy items cheaply at a supermarket. The program allows the price of items in a supermarket to be entered until the total reaches 100. The total price and the number of items entered are tracked as the program loops. Once the total reaches 100 or more, an if statement checks how many items have been entered and a different message is printed if there are 20 or more items, 30 or more items or less than 20 items. Pseudocode // This is a program to see how many items you can buy in a supermarket before you spend over £100} total = 0 itemsentered = 0 while total < 100 itemprice = input ("enter the price of the next item") total = total + itemprice itemsentered = itemsentered + 1 endwhile if itemsentered >= 20 then print ("You are on your way to saving money.") elif itemsentered => 30 then print ("You're a real money saver.") else print ("Look for better deals next time.") endif Flowchart Reading Algorithms In an exam you may be asked to read an algorithm and prove your understanding , most commonly by listing the outputs . Start from the first line and follow the program line by line , recording the value of variables as you go . When you encounter a for loop , repeat the indented code as many times as stated in the range . Example Algorithm: procedure NewProgram() maxvalue = input() for i = 1 to maxvalue output (i * i) ??????? print("program finished") endprocedure Example Questions: 1. List the outputs produced by the algorithm if the 'maxvalue' input is 5 . 2. State the code that has been replaced by '???????' and what the code's purpose is. Example Answers: 1. Outputs: 1 4 9 16 25 program finished 2. Missing Code: next i Purpose: Moves the loop to the next iteration. Watch on YouTube Structure Diagrams Structure diagrams display the organisation (structure ) of a problem in a visual format , showing the subsections to a problem and how they link to other subsections . The noughts and crosses structure diagram below has subsections in light yellow. Each subsection could be coded by a different person . Structure diagrams are different to flowcharts (those show how data is input, processed and output within a program or system). You may be asked in an exam to draw or fill in a simple structure diagram . Trace Tables Trace tables are used to track the value of variables as a program is run . They can be used to manually track the values in order to investigate why the program isn't working as intended . Each row in the trace table represents another iteration . Each column stores the value of a variable as it changes. See below how the trace table is updated for the simple algorithm on the left. num1 = 2 num2 = 5 for i = 1 to 3 output (num1 + num2) num2 = num2 - 1 next i print("complete") For most algorithms, not every variable will be updated in each iteration . Values may not be entered in the order of the trace table either. For example, each iteration outputs num1 + num2 and then decreases the value of num2 by 1. Q uesto's Q uestions 1.2 - Designing Algorithms: 1. What is the definition of an algorithm ? Name two ways an algorithm can be designed . [ 3 ] 2. Using a high-level programming language such as Python , or the OCR Exam Reference Language , write an algorithm that inputs 6 decimal numbers and outputs the total , largest , smallest and average values. [ 8 ] For example, entering 3.1 , 5.3 , 2.3 , 5.4 , 2.9 and 4.4 would output 23.3 (total), 5.4 (largest), 2.3 (smallest) and 3.9 (average). 3. Draw and label the flowchart symbols . [ 6 ] 4. What is the purpose of a structure diagram ? [ 2 ] 5. Create a trace table for the NewProgram() algorithm in the Reading Algorithms section on this page. [ 7 ] 1.1 - Computational Thinking Theory Topics 1.3 - Searching & Sorting
- Expansion Cards | Key Stage 3 | CSNewbs
Learn about two important expansion cards that can be connected to the motherboard - graphics cards and sound cards - and how they work. Expansion Cards What is an expansion card? An expansion card is a circuit board that can be inserted into a computer and attached to the motherboard . Two important expansion cards are the graphics card and the sound card . Expansion cards are attached to the PCI slots on the motherboard. PCI stands for Peripheral Component Interconnect. Graphics Card Fan Port (HDMI / VGA) Memory PCI Connector What is a Graphics Card? A graphics card processes video calculations so that it can display images and videos on a monitor . Graphics cards are used by professional video gamers and animators . Any job that focuses on graphics must have a powerful graphics card. A computer without a graphics card relies on the CPU to do the graphical processing instead . Sound Card PCI Connector Sound Chip Transistor Line In Microphone Line Out 1 Line Out 2 Line Out 3 Jacks: What is a Sound Card? Most computers don’t need a dedicated sound card, only musicians and producers who require high-quality sound . When you use a microphone , a sound card converts analogue waves (a voice) into digital data (binary). When you use headphones or speakers , a sound card converts digital data (binary) into analogue waves (sounds). What is the difference between an integrated and dedicated card? An integrated card is directly wired into the motherboard. They are cheaper and generate less power because they use the RAM of the computer. Integrated GPUs are used for laptops as they generate less heat and are used for general computing uses (e.g. web browsing or watching movies). A dedicated card is separate from the motherboard and has to be attached through a PCI slot. They are more expensive and generate more heat , often requiring a fan, because it contains its own processor and memory . Dedicated cards are used by professionals who need higher quality features like better sound or graphics. KS3 Home