top of page

Search CSNewbs

286 items found for ""

  • CTech 2.4 - Information Management | CSNewbs

    2.4 - Information Management Exam Board: OCR Specification: 2016 - Unit 2 Management Information System (MIS) An MIS is used to collect, store, analyse and present data for an organisation. The system processes a large amount of data and organises it (such as in databases) so that it can be used for decision making and general data analysis . An efficient MIS can be used to display the financial status of an organisation, highlight areas of improvement and generate sales forecasts based on current data. Specifically, a bank could use an MIS for: Looking at the number of customers that visit each branch. Forecasting takings based on historical data. Profiling customers. Identifying customers who haven’t saved recently to target them for email. Benefits of an MIS: ​ Integrated system: ​ A Management Information System shares a large amount of data from multiple departments within an organisation to produce accurate reports. For example, financial data can be used to generate accurate pay slips. Decision Making: An MIS can be used to inform an organisation's decision making by highlighting areas that need improvement within the company. Powerful analysis: ​An MIS will use large data sets to provide accurate data analysis that can be used in many different ways by an organisation. Trends and patterns can be identified easily. Backup capabilities: ​ Data can be stored centrally and backed up easily if a disaster occurs. Limitations of an MIS: ​ Cost and installation: ​ An MIS is an expensive tool that needs to be professionally set up and requires technical knowledge to maintain. Requires accurate data: ​ If any data is incorrect or out of date then the analysis will consequently be inaccurate . Potentially disastrous decisions could be made as a result of incorrect data. Training: Employees will need to be trained to use the software accurately for maximum efficiency. Managing Information Data Collection Information can be collected in different ways e.g. paper forms, surveys, stock taking and data capture forms in databases. Example: A tennis club can create a form on their website that allows users to apply for membership and fill in key data such as their name, address and telephone number. Storage Collected data must be stored in a secure and easily-retrievable medium . This could be paper, magnetic, optical and cloud storage. Data is most conveniently stored in a database so that information can be added, removed or updated when necessary. Data must be stored securely to ensure it is protected against loss, accidental or via hacking / corruption. Sensitive data should be encrypted so that others cannot view / alter it without authorised access. Information should also be backed up in case the data is lost. ​ Example: The tennis club can store data in a database using cloud storage as soon as a new member enters their information. Using cloud storage allows the tennis club to access that information from multiple access points and they will only pay for the amount of storage that they need and use. Retrieval Using a database to store information allows users to easily access data so that it can be updated or removed. Searches and queries can be easily performed on all tables in a database to show specific values using certain criteria. ​ Example: The tennis club can submit a query in their member database to display all members whose membership will expire in the next month. They can then use that information to email a reminder to those members. Manipulating & Processing After collection and storage, data must be processed so that it is ready for the final stage: analysis. Data can be exported to other software , such as from a database and into a spreadsheet so that it can be manipulated , sorted and visualised . Graphs and charts can be created on data in a spreadsheet so that patterns and trends are easier to identify . ​ Example: Member information in the tennis club can be exported to spreadsheet software that then allows for graph / chart creation using specific values, such as membership expiry date or membership type. Analysis To analyse the data is to see what can be learned from it, so important decisions can be made. Example: Analysing the charts made in the processing stage will allow the tennis club to identify key patterns. For example, they could see when most members sign up during the year and where the members travel in from. Using these patterns the club can then inform future practice. For example, if not many members sign up in August, a sale on membership can be created at this time to entice new members. Or if most members travel in from a certain area of town a bus system might be set up to help those members travel in more often. Q uesto's Q uestions 2.4 - Information Management: ​ 1a. What is the purpose of an MIS ? [2 ] 1b. Describe 3 ways a bank could use an MIS . [3 ] 1c. Describe the benefits and limitations of an MIS . [10 ] ​ 2. A charity for endangered birds (Bird Rescue UK) is creating a survey to send to scientists to find out which birds need protection status and are endangered in the UK. Describe how Bird Rescue UK can use each stage of data management : ​ Data Collection​ Storage Retrieval Manipulation & Processing Analysis [3 each ] 2.3 - Quality of Information 3.1 - Data vs. Information Topic List

  • Python | Extended Task 5 | CSNewbs

    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) ➡

  • The CPU | Key Stage 3 | CSNewbs

    The CPU Key Facts! CPU stands for C entral P rocessing U nit . ​ The CPU is known as the brain because it is used to process data and instructions . What is clock speed? The clock speed is the measure of how fast the CPU runs . ​ Clock speed is measured in Gigahertz (GHz) . 1 GHz is 1 billion cycles a second! What does the CPU do? The CPU’s job is to perform the FDE ( Fetch-Decode-Execute ) cycle very, very quickly. ​ The FDE cycle allows a computer to run programs by processing instructions. ​ The faster the clock speed of a computer, the more FDE cycles can be processed. What are the components of the CPU? 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 Logic Unit . It performs simple calculations and compares data. The registers are temporary storage spaces for instructions inside the CPU. What is overclocking and underclocking? Clock speed: 3.7 GHz 3.9 GHz 3.5 GHz Overclocking is when the computer's clock speed is increased higher than the recommended speed. This will make the computer perform faster but it can lead to overheating and could damage the computer . Underclocking is when the computer's clock speed is decreased lower than the recommended speed. This will make the computer perform slower but will increase the lifespan of the computer . KS3 Home

  • HTML Guide 8 - Videos | CSNewbs

    8. Videos HTML Guide Watch on YouTube: Embedding a video from YouTube into your web page is very easy. YouTube Videos Find an appropriate video on YouTube and click the Share button underneath the video. Next, click the Embed option. Embed a video onto your web page. Copy the HTML code that is displayed on your screen and paste it directly into your HTML document. Next you can customise your web page with a background colour and different font styles. 7. Head Tags HTML Guide 9. Colours & Fonts

  • Privacy Policy | CSNewbs

    Computer Science Newbies Privacy Policy What type of information do you collect? We receive, collect and store any information you enter on our website or provide us in any other way. In addition, we collect the Internet protocol (IP) address used to connect your computer to the Internet. For users with registered accounts, we collect your login; e-mail address; password; computer and connection information and purchase history. We may use software tools to measure and collect session information, including page response times, length of visits to certain pages, page interaction information, and methods used to browse away from the page. For customers of the site we also collect personally identifiable information (including name, email, password, communications); payment details (including credit card information), comments, feedback, product reviews, recommendations, and personal profile How do you collect information? When you conduct a transaction on our website, as part of the process, we collect personal information you give us such as your name, address and email address. Your personal information will be used for the specific reasons stated above only. Why do you collect such personal information? We collect such Non-personal and Personal Information for the following purposes: To provide and operate the CSN+ service; To provide our Users with ongoing customer assistance and technical support; To be able to contact our Visitors and Users with general or personalized service-related notices and promotional messages; To create aggregated statistical data and other aggregated and/or inferred Non-personal Information, which we or our business partners may use to provide and improve our respective services; To comply with any applicable laws and regulations. How do you store, use, share and disclose your site visitors' personal information? Our company is hosted on the Wix.com platform. Wix.com provides us with the online platform that allows us to sell our products and services to you. Your data may be stored through Wix.com’s data storage, databases and the general Wix.com applications. They store your data on secure servers behind a firewall. All direct payment gateways offered by Wix.com and used by our company adhere to the standards set by PCI-DSS as managed by the PCI Security Standards Council, which is a joint effort of brands like Visa, MasterCard, American Express and Discover. PCI-DSS requirements help ensure the secure handling of credit card information by our store and its service providers ​ How do you communicate with your site visitors? We may contact you to notify you regarding your account, to troubleshoot problems with your account, to resolve a dispute, to send updates about our company, or as otherwise necessary to contact you to enforce our User Agreement, applicable national laws, and any agreement we may have with you. For these purposes, we may contact you via email. How do you use cookies and other tracking tools? The following essential cookies are used on this site: ​ RF-TOKEN (Used for security reasons during your session on the site.) hs (Used for security reasons during your session on the site.) svSession (Used in connection with user login.) SSR-caching (Used to indicate the system from which the site was rendered. Duration of 1 minute.) _wixCIDX (Used for system monitoring/debugging. Duration of 3 months.) _wix_browser_sess (Used for system monitoring/debugging during your session on the site.) consent-policy (Used for cookie banner parameters. Duration of 12 months.) smSession (Used to identify logged in site members during your session on the site.) TS* (Used for security and anti-fraud reasons during your session on the site.) Session (Used for system effectiveness measurement. Duration of 30 minutes.) fedops.logger.sessionId (Used for stability/effectiveness measurement. Duration of 12 months.) ​ To learn more about cookies please visit https://www.allaboutcookies.org/ ​ How can your site visitors withdraw their consent? If you have a registered account and don’t want us to process your data anymore, please contact us at the site email address listed at the bottom of this page. ​ Privacy policy updates We reserve the right to modify this privacy policy at any time, so please review it frequently. Changes and clarifications will take effect immediately upon their posting on the website. If we make material changes to this policy, we will notify you here that it has been updated, so that you are aware of what information we collect, how we use it, and under what circumstances, if any, we use and/or disclose it. ​ Questions and contact information If you would like to: access, correct, amend or delete any personal information we have about you, you are invited to contact us at:

  • Assembly Language | CSNewbs

    Assembly Language Assembly language is a low-level programming language - it is closer to machine code (binary) than high-level programming languages like Python. ​ Assembly language uses mnemonics (abbreviations of commands) to signify instructions; for example, input is written as INP and output is written as OUT . ​ Little Man Computer is a representation of assembly language . This simulator will help you understand assembly language and allow you to check if your instructions are correct. Assembly Language Mnemonics INP (Input) INP is used to input a number . The number is temporarily stored in the accumulator . OUT (Output) OUT is used to output the number currently stored in the accumulator . STA (Store) STA stores the value that is currently in the accumulator . It can be used to assign a value to a variable. ADD (Addition) ADD is used to add a number to the value currently stored in the accumulator. SUB (Subtraction) SUB takes away a number from the value currently stored in the accumulator. LDA (Load) LDA is used to load the value of a stored variable back into the accumulator . BRZ (Branch if Zero) BRZ is used to loop only if the value in the accumulator is currently 0 . BRP (Branch if Positive) BRP is used to loop only if the value in the accumulator is currently positive (including 0). BRA (Branch Always) BRA is used to loop continuously . HLT (Halt) HLT will stop running the program . Every program MUST have a HLT command. DAT (Data Definition) DAT must be used to define a variable name (and / or set it with a starting value). Data definitions must be written at the end of the instructions . Peter Higginson's Little Man Computer simulation Examples of Simple Assembly Language Programs #1 - Input & Output Program Purpose: Input a number, store the number as a variable called Number1 and output the number. ​ 1. Lets the user input a number 3. Outputs the value in the accumulator - which will be the number that was just inputted. 5. Defines a variable called 'Number1'. This has to be at the end of the program and you must write the variable name first, not the command first. INP STA Number1 OUT HLT Number1 DAT 2. Stores the number in a variable named 'Number1' - there must be no spaces in a variable name. 4. Halts (stops) the program. Type these instructions line by line into the Little Man Computer simulator to see how it works. #2 - Addition Program Purpose: Input and store two numbers. Add them together. Output the total. 1. Lets the user input a number 3. Lets the user input another number 5. Adds number1 to the value in the accumulator (which is currently number2 as you just inputted it). 7. Halts the program. Type these instructions line by line into the Little Man Computer simulator to see how it works. Then change the program to subtract the number instead. INP STA Number1 INP STA Number2 ADD Number1 OUT HLT Number1 DAT Number2 DAT 2. Stores the inputted number in a variable named 'Number1'. 4. Stores the inputted number in a variable named 'Number2'. 6. Outputs the value in the accumulator (which is now number1 added to number2. 8. & 9. The two variables Number1 and Number2 are defined on separate lines. #3 - Load in Order Program Purpose: Input and store three numbers. Load and output them in the order that they were entered. 1. - 6. Lets the user input three numbers and immediately stores each one as they are entered. 8. Now that Number1 has been loaded into the accumulator, this value is outputted. 13. Halts the program. Type these instructions line by line into the Little Man Computer simulator to see how it works. Let the user input a fourth number and output this fourth number last . INP STA Number1 INP STA Number2 INP STA Number3 LDA Number1 OUT LDA Number2 OUT LDA Number3 OUT HLT Number1 DAT Number2 DAT Number3 DAT 14. - 16. The three variables Number1, Number2 & Number3 are defined on separate lines. 9. - 12. Number2 is loaded and output then Number3 is loaded and output 7. Once all three numbers have been inputted and stored, the first number is loaded back into the accumulator. #4 - Branching Program Purpose: Input and store two numbers. Output the largest number. (Branching required). 1. - 4. Lets the user input two numbers and immediately stores each one as they are entered. 7. BRP is 'Branch is Positive'. If the result of Number1 - Number2 is positive then the program will jump to line 11. You can write any value instead of 'loop', such as 'jump' or 'break'. If the result is not positive it will continue to the next line. 11. - 13. The program will jump to line 11 if the result of Number1 - Number2 is positive. This means that Number1 is larger than Number2 so Number1 is loaded and output then the program is halted. INP STA Number1 INP STA Number2 LDA Number1 SUB Number2 BRP loop LDA Number2 OUT HLT loop LDA Number1 OUT HLT Number1 DAT Number2 DAT 5. & 6. Loads Number1 and subtracts Number2 from it. 8. - 10. The program will continue to line 8 if the result of Number1 - Number2 is not positive. Because the result is a negative number, this tells us that Number2 is larger than Number1. So we load Number2, output it because it is bigger, then halt the program. 14. - 15. The variables Number1 & Number2 are defined on separate lines. Type these instructions line by line into the Little Man Computer simulator to see how it works. Change the program so that the smallest number is output .

  • 2.2.2a - Computational Methods | OCR A-Level | CSNewbs

    Exam Board: OCR 2.2a - Computational Methods 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 2.2a - Computational Thinking: ​ 1. What is cache memory ? [ 2 ] ​ 2.1b - Modularity & IDE Theory Topics 2.2b - Object Oriented Programming

  • OCR A-Level Component 1 | CSNewbs

    OCR Computer Science A-Level Component 1: Computer Systems These pages are based on content from the OCR Computer Science 2015 specification . This website is in no way affiliated with OCR . 1. Hardware 1.1a - The CPU & FDE Cycle 1.1b - Performance 1.2 - Processors 1.3a - Input & Output Devices 1.3b - Memory & Storage 2. Software 2.1 - Operating Systems 2.2a - Applications & Utilities 2.2b - Translators & Compilation 2.3 - Software Development Methodologies 2.4a - Programming & Pseudocode 2.4b - Assembly Language 2.4c - Object-Oriented Language 3. Networks & Databases 3.1a - Compression 3.1b - Encryption & Hashing 3.2a - Databases & Normalisation 3.2b - SQL 3.3a - Network Characteristics 3.3b- Protocols & TCP-IP Stack 3.3c - Network Hardware & DNS 3.3d - Network Security & Threats 3.4a - Web Technologies 3.4b - HTML, CSS & JavaScript 4. Data & Logic 4.1a - Data Types & Character Sets 4.1b - Denary, Binary & Hexadecimal 4.1c - Signed Binary & Floating Point 4.1d - Binary Calculations 4.1e - Shifts & Masks 4.2 - Data Structures 4.3a - Logical Operators & Truth Tables 4.3b - Flip Flops, Adders, Laws & Maps 5. Laws 5.1 - Computer Legislation 5.2 - Moral & Ethical Issues

  • 8.4 - Searching & Sorting Algorithms - Eduqas GCSE (2020 Spec) | CSNewbs

    8.4: Sorting & Searching Algorithms Exam Board: Eduqas / WJEC Specification: 2020 + Merge Sort Merge sort is a sorting algorithm based on the idea of ‘divide and conquer ’. A merge sort divides a list into half , again and again until each data item is separate . Then the items are combined in the same way as they were divided , but now in the correct order . When the individual lists are all merged together as one list again, then the data is in order and the algorithm will end . Bubble Sort This algorithm is based on the comparison of adjacent data elements . ​ Data elements are swapped if they are not in the correct order . A bubble sort is not suitable for large sets of data. Linear Search A linear search is the most simple search algorithm. ​ Each data item is searched in order from the first value to the last as if they were all laid out in a line . The list does not have to be in any order before it is searched . This search is also known as a sequential search because the list is searched in a sequence from start to end. For large lists , this search is not very efficient . Binary Search A binary search is a much more efficient searching algorithm as it generally searches through fewer data and is often much quicker - especially for large data sets. In a binary search, the middle point of the data is selected with each iteration and many data items can be ignored. However, the list of data must already be sorted in order before a binary search can take place. Q uesto's Q uestions 8.3 - Searching & Sorting Algorithms: ​ Linear Search Explain step-by-step how the number 8 would be found in the following list using a linear search : 12, 5, 3, 2, 8, 19, 14, 6 [4 ] ​ Binary Search Explain step-by-step how the number 2 would be found in the following list using a binary search : 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 [6 ] ​ Merge Sort Explain step-by-step how a merge sort would sort the following list of numbers: 4, 8, 5, 1, 3, 6, 7, 2 [6 ] ​ Bubble Sort Explain step-by-step how a bubble sort would sort the following list of numbers: 3, 2, 6, 4, 1, 4 [6 ] Watch on YouTube Watch on YouTube Watch on YouTube Watch on YouTube 8.3 - Writing Algorithms Theory Topics 8.5 - Validation & Verification

  • 4.1e - Shifts & Masks | OCR A-Level | CSNewbs

    Exam Board: OCR 4.1e - Shifts & Masks 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 4.1e - Shifts & Masks: ​ 1. What is cache memory ? [ 2 ] ​ 4.1d - Binary Calculations Theory Topics 4.2 - Data Structures

  • Python | 4b - Mathematical Operators | CSNewbs

    top Python 4b - Mathematical Operators Modulo Division The modulo operator - the percentage symbol % - will work out the remainder left over when one value is divided by another. print (30 % 6) = 0 30 ÷ 6 = 5, which is a whole number, so there is no remainder and 0 is output . print (30 % 7) = 2 30 ÷ 7 = 4 remainder 2 ; so the remainder is output . You can use modulo with variables too: num1 = 33 num2 = 4 print ( "The remainder is" , num1 % num2) The remainder is 1 = A common use of modulo is to check if a number is odd or even . If a number has no remainder when divided by 2 then it is even . = num = int ( input ( "Enter a number: " )) if num % 2 == 0: print (num, "is even." ) else : print (num , "is odd." ) Enter a number: 400 400 is even. Enter a number: 191 191 is odd. = Modulo Div i sion Task 1 ( Remainder) Ask the user to input a whole number . ​ Use the modulo operator ( % ) to check if there is a remainder when the user's number is divided by 5 . Print the re mainder. Example solution: Enter a number: 123 The remainder when divided by 5 is 3 Modulo Div i sion Task 2 ( Rollercoaster) Use the odd/even program above to help solve this problem: ​ A rollercoaster only lets people on in groups of 4 . ​ Ask the user to input a number for how many people are in their group. Check if that number is directly divisible by 4 using modulo division ( % ). If it is then print “Perfect groups of four!” Else print “You will be split up” . Example solutions: Welcome to the Hyper Coaster! How many in your group? 6 You will be split up! Welcome to the Hyper Coaster! How many in your group? 12 Perfect groups of four! Integer Division Integer division removes any decimal numbers when performing division , leaving just the integer (whole number ). ​ In Python integer division is performed using // . print (20 / 3) print (20 // 3) = 6.666666666666667 6 Integer Div i sion Task 1 ( Integer Division by 5 ) Use an input line with int to ask the user to enter a number . ​ Use integer division ( // ) to divide the number by 5 without keeping any decimal values . ​ Challenge: Improve your solution by altering the print line to be more user friendly . Example solutions: Enter a number: 27 5 Enter a number: 27 5 goes into 27 5 times. Integer Div i sion Task 2 ( Plane Rows) A large plane has 6 seats in row. ​ Input the number of passengers on the plane and use integer division to work out how many full rows will be filled. Example solution: How many passengers are there in total? 174 There will be 29 full rows on the plane. Exponent (Powers) An exponent is the number of times a value is multiplied by itself , for example 2 = 2 x 2 x 2 = 8 . The symbol to represent an exponent in Python is ** . For example: 4**2 represents 4 which is also 4 x 4 . 3 2 print (4**4) = 256 base = 5 exponent = 4 print (base**exponent) 625 = Exponent Task 1 ( Square Number) Use an input line with int to ask the user to enter a number . ​ Output the square of this number. Example solution: Enter a number: 12 12 squared is 144 Exponent Task 2 ( Custom Exponent) Use an input line with int to ask the user to enter a number, this will be the base . Make another input line with int to ask for the exponent . ​ Use ** between the base and the exponent and print it. ​ Challenge: Make your solution better by including the base and exponent in the print line. Example solutions: Enter the base: 7 Enter the exponent: 3 343 Enter the base: 7 Enter the exponent: 3 7 to the power of 3 is 343 ⬅ 4a - If Statements 4 c - Log ical Operators ➡

  • Python | 7b - Functions | CSNewbs

    top Python 7b - Functions What is a Function? A function is a subroutine that takes one or more values from the main program and returns a value back. For example, transferring over a sphere’s radius from the main program for the function to calculate a surface area and then return that value to the main program. The two key differences between procedures and functions are: A function uses parameters to transfer data from the main program into the function. A function returns a value to the main program. Writing Functions A function is written the same way as a procedure but it uses parameters . In the example below the parameters are num1 and num2 which are sent from the main program to be used in the function . The return command is used to send a value back to the main program . Below is another example of a function that takes the radius of a sphere and works out the area in a separate function . ​ The area is returned to the main program and printed. Subroutines can be reused and called with different parameters . ​ The program below repeatedly takes an integer input and adds it to a total in a function that is then returned and printed. Practice Task Create a program similar to the sphere example above, this time to work out the volume of a cylinder. ​ In the main program ask the user to enter the cylinder's radius and then its height. ​ The actual calculation should be done in a function and returned to the main program. ​ The calculation for a cylinder's volume is: ​ pi x (radius x radius) x height ​ Extension: Use the round command from section 9b to round the number to 2 decimal places. Example solution: Using Subroutines as a Menu Subroutines are often used to split programs up and give users a selection of options . ​ Subroutines are used for this purpose because they are separate , making it easier to code and manage a program . ​ The example below for a simplified online banking system uses separate subroutines accessible within a while true loop . ​ Depending on the option chosen by the user, the appropriate subroutine will be called . Instead of a further practice task here, Task 4 of the Section 7 Practice tasks page challenges you to make a similar program using multiple subroutines. ⬅ 7a - Proced ures Section 7 Practice Tasks ➡

bottom of page