top of page

Search CSNewbs

286 items found for ""

  • 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

  • 10.2 - Stages of Compilation - Eduqas (2020 Spec) | CSNewbs

    10.2: Stages of Compilation Exam Board: Eduqas / WJEC Specification: 2020 + A compiler translates source code (high-level language written by a programmer) into machine code in five separate stages : 1. Lexical Analysis The term 'lexical' refers to words and phrases . Source code needs to be broken down into tokens that can later be analysed. ​ In lexical analysis: ​ Spaces and comments are removed from the code. Identifiers , keywords and operators are replaced by tokens . A token is similar to a variable with a name and a value . A symbol table is created. T his table stores the addresses of all variables , labels and subroutines used in the program. ​ 2. Syntax Analysis The term 'syntax' refers to sentence structure . ​ In syntax analysis: The tokens created in the first stage are checked to see if they follow the syntax (spelling and grammar ) rules of the programming language. This process is called ' parsing ' . During parsing, if a syntax error is found then an error message is displayed and compilation stops . 3. Semantic Analysis The term 'semantic' refers to logic . Variables are checked in this stage to ensure they are used correctly: ​ Variable checks ensure they are correctly declared and use a valid data type (for example integers are not assigned to decimal values). Operation checks ensure they are correct for the data type used ( for example dividing a number must result in an real value ). 4. Code Generation The machine code (data in a binary format ) is generated . 0010 1011 0101 0101 0110 0111 0101 0001 0101 0101 0101 0110 5. Code Optimisation The code is optimised so it is fast , efficient and uses as little of the computer's resources as possible. Q uesto's Q uestions 10.2 - Stages of Compilation: ​ 1 a. List the 6 stages of compilation in order . [6 ] 1b. Create a poster or flowchart describing each of the 6 stages of compilation : 1. Lexical Analysis 2. Symbol Table Creation 3. Syntax Analysis 4. Semantic Analysis 5. Code Generation 6. Code Optimisation [ 10 total ] 10.1 - Translators Theory Topics 10.3 - Programming Errors

  • 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

  • 2.3.1f - Searching Algorithms | OCR A-Level | CSNewbs

    Exam Board: OCR 3.1f - Searching Algorithms 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.1f - Searching Algorithms: ​ 1. What is cache memory ? [ 2 ] ​ 3.1e - Sorting Algorithms Theory Topics 3.1g - Pathfinding

  • Key Stage 3 Python | Turtle | CSNewbs

    Python - Iteration For Loops Editor Execute A for loop is a count controlled loop. ​ It repeats for a certain number of times as stated in the range brackets. ​ The first number (1) states the number to start on . ​ The second number is an exclusive end . This means it actually finishes on the number before . (11 will end on 10). You need a colon at the end of the loop line . ​ Each line to be repeated must be indented (press the tab key). ​ You can use the loop number within the loop itself. 1. Write a for loop to print your name 8 times . (Count it to double-check it prints eight times.) ​ 2. Use a for loop to print each number between 10 and 50 . ​ 3. Use a for loop from 1 to 10 . Print the 3 times table by multiplying number by 3 underneath the loop. ​ 4. Ask the user to input a whole number (call it num1 ). Write num1 in your range brackets to repeat any message that many times. 5. Ask the user to input a whole number (call it num1 ) and then input a word . Print the word by the number they entered . (Hint: Use num1 in the range.) ​ 6. Delete your code and copy these 3 lines: ​ #Delete the space after the colon for number in range(0,21,2):​ print(number) ​ What happens when you run this code? ​ 7. Use Q6 to help you print 0 to 100 , going up in 5s . Think about the 3 values you need in the range brackets. ​ 8. Use Q6 to help you print 100 down to 0 , backwards by 1 . Think about the 3 values you need in the range brackets. Tasks While Loops Editor Execute A while loop is a condition controlled loop . ​ While loops repeat as long as the condition is true . As soon as the condition becomes false , the loop will end . 1. Change the program in the editor to repeat the loop while a number is not equal to 33 . ​ 2. Make a new while loop that asks the user to enter a whole number . While the number is less than or equal to 1000 , keep repeating. ​ 3. Make a new while loop for while a colour is not equal to purple (or any colour you want). Ask the user to enter a colour inside of the loop . Don't forget to set colour to "" before you start. ​ 4. Edit your colour program to count how many guesses were made. Make a new variable called count and set it to 0 at the start of the program. Increase it by 1 in the loop, using count = count + 1 . 5. While a total is less than 100 , ask the user to input a decimal number . When it is over 100 , print ‘COMPUTER OVERLOAD’ . You need a variable called total . Increase the total each time with total = total + number . Don't forget to start it at 0 . Tasks != means ‘not equal to ’. The loop below will repeat as long as the password is not equal to “abc123” . Any variable you use in your condition must have a value first . You can’t check for your password if it doesn’t exist. That’s why I have written password = “” , to give password a value before we check it .

  • 2.1 - Primary Storage - OCR GCSE (2020 Spec) | CSNewbs

    2.1: Primary Storage (Memory) Exam Board: OCR Specification: 2020 Primary vs Secondary Storage Storage in a computer system is split into two categories: Primary Storage: Very quick because it is directly accesse d by the CPU . Typically smaller in storage size . Sometimes called ‘main memory’ . Includes RAM and ROM . Volatile vs Non-Volatile Storage Storage is also split into two types - volatile and non-volatile . ​ Volatile storage is temporary - data is lost whenever the power is turned off .​ Example: RAM Non-volatile storage saves the data even when not being powered . Data can be stored long-term and accessed when the computer is switched on . Example: ROM Why do Computers need Primary Storage? Primary storage is low-capacity , internal storage that can be directly accessed by the CPU . Program instructions and data must be copied from the hard drive into RAM to be processed by the CPU because primary storage access speeds are much faster than secondary storage devices like the hard drive. Types of Primary Storage (Memory) Random Access Memory (RAM) Read-Only Memory (ROM) RAM is volatile (temporary) storage that stores all programs that are currently running . RAM also stores parts of the operating system to be accessed by the CPU. ​ RAM is made up of a large number of storage locations, each can be identified by a unique address . ROM is non-volatile storage that cannot be changed . ​ ROM stores the boot program / BIOS for when the computer is switched on. The BIOS then loads up the operating system to take over managing the computer. RAM ( R andom A ccess M emory) ROM ( R ead O nly M emory) Virtual Memory Programs must be stored in RAM to be processed by the CPU . Even if there is insufficient space in RAM for all programs the computer can use the hard disk drive (HDD ) as an extension of RAM - this is called virtual memory . ​ If new data is needed to be stored in RAM then unused data in RAM is moved to the hard drive so the new data can be transferred into RAM . When required, the data can be moved back from virtual memory into RAM . Using virtual memory allows users to run more programs simultaneously with less system slow down . Q uesto's Q uestions 2.1 - Primary Storage (Memory): ​ 1. Describe the differences between primary and secondary storage . [ 6 ] ​ 2. Explain the difference between volatile and non-volatile storage . State an example of both types. [ 4 ] ​ 3. Explain why the computer requires primary storage . [ 2 ] ​ 4. For each type of memory below, describe it and state what information is stored within it: a . Random Access Memory (RAM) [3 ] b. Read-Only Memory (ROM) [ 3 ] c. Virtual memory [ 3 ] Secondary Storage: ( Section 2.2 ) Slower because it is not directly accessed by the CPU . Typically larger in storage size . Used for the long-term storage of data and files because it is non-volatile . Includes magnetic , optical and solid state storage. 1.3 - Embedded Systems Theory Topics 2.2 - Secondary Storage

  • About | CSNewbs

    Frequently Asked Questions about Computer Science Newbies Who made CSNewbs? My name is Mr Pulsford . I am from London and I am currently the Head of C omputer Science at a secondary school in South Yorkshire , England . When and why did you make this? I wanted to make a resource that my students could access outside of the classroom . I was working on a paid summer project at G o o g l e in London in 2016 when I was inspired to start the site. I've been updating it ever since as much as I can, outside of lessons and life. I made CSNewbs to support students in lessons and at home because Computer Science can be a tricky subject and many websites are too technical or peripheral . Which courses does CSNewbs cover? The ' GCSE ' section follows the OCR specification ( 2020 ) and Eduqas / WJEC specification ( 2020 ). The ' CTech ' section follows the OCR Cambridge Technicals Level 3 IT 2016 specification for Unit 1 (Fundamentals of IT) and Unit 2 (Global Information). The ' Programming ' section contains material for Python , HTML , Greenfoot and others. The ' KS3 ' section covers basic Computer Science topics aimed at Year 7 - 9 students . ​ Do the exam boards pay you money for this? CSNewbs is not affiliated with any exam board , financially or otherwise . The content on this site has been independently created by closely following the publicly released specifications by Eduqas and OCR. ​ Can I get a level 9 / distinction just from CSNewbs? The content on this website is of high-quality and should be used to guide students towards a better understanding of the course's content. Like all resources however , it should be supported with a range of appropriate material and sound classroom teaching . CSNewbs makes no miraculous claims linking content use and final exam results.​ How did you make this website? was created and is maintained using Wix . What's the deal with copyright? CSNewbs is protected by copyright , and copy / paste features have been disabled on the site. All images have either been created by myself or used from Wix's copyright-free vector gallery / their stock image library . Embedded videos are linked to content from the CSNewbs YouTube page. If you think any content on this site infringes a copyright-protected work , please email me, and I will make immediate changes . I don't see any adverts, how are you making money? You're right, there are no adverts and I intend to keep it that way. I don't make and never have made any money from this website. Can you add Unit 3 / OCR A-Level / something else? The site continues to expand over time with new content . The eventual aim is to cover every exam board for GCSE Computer Science but that will take a lot of time! How come something on the site isn't working at my school? Your school's IT administrators may have blocked some elements such as JavaScript or embedded YouTube videos . The videos can be watched directly on YouTube (if not blocked on your school network). Who is the robot? The robot is called Questo . It's the site mascot and it appears on most pages to ask you questions about the content (' Questo's Questions '). It used to have a body but since 2020 it's just a head. I can't believe one person made this whole site while teaching and the rest, what are your long-term plans? If you work for an exam board or educational resource organisation , and your organisation has opportunities available , please send me an email. How can I contact the creator of CSNewbs? The contact email is: Privacy Policy There are social media pages for CSNewbs but with busy times recently they are rarely updated :

  • 3.3a - Network Characteristics | OCR A-Level | CSNewbs

    Exam Board: OCR 3.3a - Network Characteristics Specification: A-Level 2015 What is a network? A network is more than one computer system connected together allowing for communication and sharing of resources . Networks can be split into different types , usually categorised by their geographical distance apart and the area that they serve. Local Area Network A local area network (LAN ) has computer systems situated geographically close together , usually within the same building or small site , like a school or office . ​ The network infrastructure of a LAN (such as servers and routers) is usually owned and managed by the network owner . Wide Area Network A wide area network (WAN ) has computer systems situated geographically distant to each other, possibly across a country or even across the world . WANs often use third party communication channels , such as connections by internet services providers like BT or Virgin Media. Other network types do exist, such as a Metropolitan Area Network (MAN ) for computer systems connected across a town or city or a Personal Area Network (PAN ) for devices connected and used by an individual . Advantages and Disadvantages of using a Network There are many benefits but also some drawbacks to using a network compared to having an unconnected ('standalone' ) computer: Advantages of Networks Easily share files , software and hardware between computers. Disadvantages of Networks There is an initial cost because network devices like routers are required . Larger companies will need to buy and maintain a server . Log in from any connected computer and access your data and files. A network manager / administrator might need to be employed to maintain the network . An administrator can monitor network activity and control security settings. Data from computers on the network can be automatically backed up on central storage. Security breaches are more likely and malware , such as worms, can spread quickly across the network. If the web server fails , all connected computers won't be able to access files or log on . Client-Server and Peer-to-Peer Networks Client-Server Network Clients make requests to a server , the server manages that request and responds. For example, if the user (client) makes a request to access to a web server. ​ Large services like Amazon and Google will need very powerful servers to handle millions of requests a second. ​ The client is completely dependent on the server to provide and manage the information. The server controls network security , backups and can be upgraded to manage higher demand. Advantages: The network can be controlled centrally from the server to easily backup data and update software . Hardware, software and resources can be shared across the network, such as printers, applications and data files . The network allows for improved scalability , meaning more clients can be easily added to the central server . Disadvantages: Large amounts of traffic congestion will cause the network to slow down . If a fault occurs with the server then the whole network will fail . IT technicians may be required to manage and maintain the network . Malware , such as viruses, can spread quickly across the network. Client-Side & Server-Side Processing Processing data when using a web application can be performed by the client ( client-side ) or by sending/receiving data with the server ( server-side ). ​ Client-Side Server-Side Client-side processing is more secure as no data is being sent along the network to the server, and thus can’t be intercepted . Web pages use JavaScript to quickly validate data and provide interactivity without having to prompt unnecessary interaction with the server . Server-side processing is reserved for more important tasks such as processing user input , interacting with databases and structuring web applications . It is also used to further validate data as client-side processing can be modified or even disabled on the browser so further checks are used to prevent malicious code , such as an SQL injection from being used. Peer-to-Peer Network For peer-to-peer networks , data is shared directly between systems without requiring a central server . Each computer is equally responsible for providing data. Peer to peer is optimal for sharing files that can then be downloaded. Disadvantages: Without a dedicated server there is no central device to manage security or backups . Backups must be performed on each individual system. Computer performance will decrease with more devices connected to the network, especially if other machines are slow. Advantages: This is a simpler network than client-server to set up as no server is required . Clients are not dependent on a server . Perfect for quickly sharing files between systems , such as downloading media files. Data Packets When sending data across a network, files are broken down into smaller parts called data packets . ​ Whole files are too large to transfer as one unit so data packets allow data to be transferred across a network quickly . ​ Each packet of data is redirected by routers across networks until it arrives at its destination. Data packets may split up and use alternative routes to reach the destination address. ​ When all the packets have arrived at the destination address the data is reassembled back into the original file. Contents of a Data Packet: Header Payload Trailer Source address Destination address Packet number Protocol The data itself A checksum - this is a calculation on the data to see if any errors or corruption have occurred during transmission . Packet Switching vs Circuit Switching The key difference is that a circuit-switched network sends data along the same route . A packet-switched network sends data packets along different routes . Packet Switching With a packet-switched network the data is split into packets . The data packets are transmitted over a network and may take different routes to its destination. When all the packets have arrived the data is reassembled . The Internet is an example of a packet-switching network. Advantages of Packet Switching: Transmission is more secure as it is harder for a hacker to intercept complete data because it can take different routes . If a network device fails the data packets can take an alternative route . Data packets can be sent efficiently and individually across less busy routes . Disadvantages of Packet Switching: ​ Reassembling the data takes longer because packets may arrive out of order . It is less reliable than circuit switching as some data packets may not reach the destination (this is called packet loss ). Circuit Switching When data is transmitted over a circuit-switched network all of the data takes the same route to the destination address in one continuous stream . The data is quickly reassembled at the destination because it is already in the correct order . The old telephone system is an example of a circuit-switched network. Advantages of Circuit Switching: ​ Reassembling the data is quick because the packets arrive in the order that they were sent. It is more reliable than packet-switching because data is sent in one continuous stream . The transmission is fast and should encounter fewer errors - once the connection has been securely established . Disadvantages of Circuit Switching: Less secure as hackers could intercept the data and more easily access the data as it all takes the same route. Establishing a connection takes time to set up. If any device fails on the route then the whole connection breaks and data transfer will be incomplete. Q uesto's Q uestions 3.3a - Network Characteristics: ​ 1a. Describe two differences between a LAN and WAN . [4 ] 1b. Give an example of how a LAN and a WAN could each be used . [2 ] ​ 2 a. Describe how peer-to-peer networks and client-server networks function. 2b. Give one use for both types of network. 2c. Describe the difference between client-side and server-side processing and give an example of when each would be used. [4 ] ​ 3a. Describe how packet switching works . [3 ] 3b. Describe the advantages of packet switching . [3 ] 3c. Describe the disadvantages of packet switching . [2 ] ​ 4a. Describe how circuit switching works . [3 ] 4b. Describe the advantages of circuit switching . [3 ] 4c. Describe the disadvantages of circuit switching . [3 ] ​ 5a. Draw and label diagrams of client-server and peer-to-peer networks. [4 ] 5b. Draw diagrams of packet switching and circuit switching . [2 ] 3.2b - SQL Theory Topics 3.3b - Protocols & TCP-IP Stack

  • 3.4a - Web Technologies | OCR A-Level | CSNewbs

    Exam Board: OCR 3.4a - Web Technologies 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.4a - Web Technologies: ​ 1. What is cache memory ? [ 2 ] ​ 3.3d - Network Security & Threats Theory Topics 3.4b - HTML, CSS & JavaScript

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

    1.3: Searching & Sorting Algorithms Exam Board: OCR Specification: 2020 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. 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. Insertion Sort The list is logically split into sorted values (on the left) and unsorted values (on the right). ​ Starting from the left, values from the unsorted part are checked and inserted at the correct position in the sorted part. ​ This continues through all elements of the list until the last item is reached, and sorted. Insertion sorts are efficient for small data sets but would be slow to sort large sets , compared to alternatives such as a merge sort. Q uesto's Q uestions 2.1 - Programming Fundamentals 1.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, 1, 6, 5, 2, 4 [6 ] ​ Insertion Sort Explain step-by-step how an insertion sort would sort the following list of numbers: 5, 2, 6, 3, 1, 4 [6 ] Watch on YouTube Watch on YouTube Watch on YouTube Watch on YouTube 1.2 - Designing Algorithms Theory Topics

  • Python | 4a - If Statements | CSNewbs

    top Python 4a - If Statements If Statements Selection is one of three constructs of programming , along with Sequence (logical order) and Iteration (loops). ​ An if statement is a conditional statement that performs a specific action based on conditional values. Essentially, if thing A is true , then thing B will happen . If the user answers yes to the window question, then an appropriate statement is printed. ​ Double equals stands for ‘is equal to ‘. ​ The colon stands for THEN and the line after an if statement must be indented (press tab key once). answer = input ( "Is the window open? " ) if answer == "yes" : print ( "It's chilly in here!" ) Is the window open? yes It's chilly in here! But what if the window is not open? At the moment nothing will happen if you type no: Is the window open? no The elif command stands for else if . Essentially: If thing A is true then do thing B, else if thing C is true then do thing D: But what about any other answer than yes or no? The else command will submit a response if the value is anything else. The if and elif commands have a colon at the end, but else has it at the start. Also, else does not need to be on a new line. answer = input ( "Is the window open? " ) if answer == "yes" : print ( "It's chilly in here!" ) elif answer == "no" : print ( "It's quite hot in here!" ) answer = input ( "Is the window open? " ) if answer == "yes" : print ( "It's chilly in here!" ) elif answer == "no" : print ( "It's quite hot in here!" ) else : print ( "I'm not sure what you mean." ) Is the window open? no It's quite hot in here! Is the window open? banana I'm not sure what you mean. If Statements Task 1 ( Left or Right?) Use an input line to ask the user whether they want to turn left or right . ​ Print a sentence of your choice if they chose left and a different sentence if they chose right . ​ Include an else statement in case the user doesn't input left or right. Example solutions: There is a path ahead. Do you turn left or right? left The path turns and twists until it reaches a cliff. Dead end! There is a path ahead. Do you turn left or right? right A snake slithers across the path and bites your leg. Oh no! There is a path ahead. Do you turn left or right? backwards That's not an option! Nested If Statements Complex programs may require you to have if statements within if statements - when programming, one thing inside another is known as nesting . You must make sure that the related if , elif and else statements line up with each other . Use the tab key to indent a line. outer if inner if weather = input ( "What is the weather like today? " ) if weather == "sunny" : sunny = input ( "How hot is it? " ) if sunny == "very hot" : print ( "Take some sunglasses with you!" ) elif sunny == "cool" : print ( "Maybe take a jacket just in case?" ) else : print ( "Enjoy the sunshine!" ) ​ elif weather == "rainy" : print ( "Take an umbrella!" ) ​ else : print ( "Have a good day!" ) = What is the weather like today? rainy Take an umbrella! = What is the weather like today? sunny How hot is it? cool Maybe take a jacket just in case? = What is the weather like today? snowy Have a good day! = What is the weather like today? sunny How hot is it? very hot Take some sunglasses with you! If Statements Task 2 ( Nested Ifs) Use the weather program above as an example to help you write your own program with a nested if for at least one option. ​ Be careful to have your nested if's if, elif and else statements in line with each other. ​ Your program doesn't have to be about juice. Example solutions: Would you like orange, apple or tomato juice? orange Would you like your orange juice smooth or with bits? smooth One smooth orange juice coming up! Would you like orange, apple or tomato juice? orange Would you like your orange juice smooth or with bits? bits A pulpy orange juice is on its way! Would you like orange, apple or tomato juice? tomato Yuck, you can't be serious? Using Selection with Numbers Comparison operators such as > (greater than ) > = (greater than or equal to ) < (less than ) and < = (less than or equal to ) can be used with if statements. Logical operators such as and and or can also be used - more about them in section 4c . ​ When comparing a variable's value to a specific number, such as 50, don't forget to use double equals ( == ) . Python Comparison Operators score = int ( input ( "Enter the maths test score: " )) if score == 50: print ( "You scored top marks!" ) elif score >= 40 and score < 50: print ( "You scored a great grade!" ) elif score >= 20 and score < 40: print ( "You did okay in the test." ) else : print ( "You have to try harder next time!" ) = Enter the maths test score: 50 You scored top marks! = Enter the maths test score: 43 You scored a great grade! = Enter the maths test score: 20 You did okay in the test. = Enter the maths test score: 13 You have to try harder next time! If Statements Task 3 ( Fastest lap) A racing video game has a challenging track that players try to get a quick lap on. The current fastest lap time is 37 seconds . ​ Ask the player to enter their lap time and print a response based on their input . ​ You need individual responses for the following inputs: ​ Faster than 37 seconds. Between 37 seconds and 59 seconds. Between 60 seconds and 90 seconds. Slower than 90 seconds. Example solutions: Enter your lap time: 35 You have set a new record!!! Enter your lap time: 59 You did well this time! Enter your lap time: 83 A little bit slow this time! Enter your lap time: 110 Were you even trying!?! Hurry up! Not Equal To The opposite of equal to ( == ) is not equal to ( != ). != is often used with while loops to repeat code while an input is not what is expected , for example repeatedly asking for a password while the input is not equal to "fluffythecat123". ​ The code below uses != for an incorrect answer (although it could easily be re-written to use == for a correct answer). answer = input ( "What is the capital of Eritrea? " ) if answer != "Asmara" : print ( "That is incorrect! It is Asmara." ) else : print ( "You got it right!" ) = What is the capital of Eritrea? Asmara You got it right! = What is the capital of Eritrea? Windhoek That is incorrect! It is Asmara. If Statements Task 4 ( True or False? ) Come up with your own true or false question that the user has to respond to. Depending on their answer , print whether they got it right or wrong . ​ You may want to use an if statement with == for a correct answer or != for an incorrect answer , there's multiple ways to write this program. Example solutions: There are 140 million miles between Earth and Mars. TRUE or FALSE? TRUE That is correct! It is really that far! There are 140 million miles between Earth and Mars. TRUE or FALSE? FALSE You got it wrong, there really are 140 million miles between us! ⬅ Section 3 Practice Tasks 4b - Mathematical Operators ➡

  • OCR CTech IT | Unit 1 | 1.5 - Communication Hardware | CSNewbs

    1.5: Communication Hardware Exam Board: OCR Specification: 2016 - Unit 1 The devices on this page are used to create or link together networks , allowing data to be sent between computer systems . Hub A hub receives data packets from a connected device and transfers a copy to all connected nodes . Switch A switch receives data packets , processes them and transfers them on to the device s pecifically listed in the destination address of the packet. Modem Modems are used to send data across the telephone network . The telephone lines can only transfer analog signals so a modem is used to convert a computer's digital data into an analog signal . Another modem converts the signal back to a digital format at the receiving end. Router Routers are used to transfer data packets between networks . Data is sent from network to network on the internet towards the destination address listed in the data packet. A router stores the address of each computer on the network and uses routing tables to calculate the quickest and shortest path . Wireless Access Point (WAP) Provides a link between wireless and wired networks . It creates a wireless local area network that allows WiFi enabled devices to connect to a wired network. Combined Device Also known as a hybrid device , this provides the functionality of multiple communication devices (e.g modem, router, switch and/or wireless access point) in a single device . They can be more expensive than a single device but are more adaptable - if the routing part of the device fails it might still be able to function as a switch / wireless access point etc. ​ However, you will see an increased performance from a standalone device rather than a combined one as standalone devices have more complex features (e.g. VPN support). Network Interface Card (Network Adapter) A Network Interface Card (often shorted to NIC ) is an internal piece of hardware that is required for the computer to connect to a network . It used to be a separate expansion card but now it is commonly built directly into the motherboard (and known as a network adapter ). Wireless network interface cards allow wireless network connection. Q uesto's Q uestions 1.5 - Communication Hardware: 1. What is the difference between a hub and a switch ? [2 ] 2. Explain how a modem works. [3 ] 3. Explain the purpose of a router . [2 ] 4. What is a Wireless Access Point (WAP )? [2 ] 5. Describe what is meant by a 'combined device '. Give one advantage and one disadvantage of using a combined device. [3 ] 1.4 - Connectivity 1.6 - Hardware Troubleshooting Topic List

bottom of page