top of page

Search CSNewbs

304 results found with an empty search

  • Key Stage 3 | CSNewbs

    The homepage for all content aimed at Key Stage 3 students studying Computer Science / IT including computer hardware, Python, App Inventor 2 and Cyber Security. Key Stage 3 Topics These topics are aimed at Year 7 - 9 students (11 - 14 year olds) studying computing. Hardware The Motherboard The CPU Memory Expansion Cards Python Basics 1. The Basics 2. Variables 3. Inputs 4. Calculations 5. Selection 6. Turtle 7. Link to GCSE Python Cyber Security Malware Phishing & Staying Safe Other Topics Desktop Publishing

  • OCR CTech IT | Unit 1 | 5.1 - Ethical Issues | CSNewbs

    Learn about ethical issues of IT including whistleblowing, discrimination, online safety and bias. Based on the 2016 OCR Cambridge Technicals Level 3 IT specification. 5.1 - Ethical Issues Exam Board: OCR Specification: 2016 - Unit 1 What are ethics? Ethics refers to what is right and wrong . The following issues are often linked to or backed up by legislation. Whistle Blowing Definition: When a member of staff reveals that the organisation they work for are engaging in unlawful practices . This could include breaking privacy laws , threatening staff or environmental damage . In the UK , whistleblowers are protected by the Public Interest Disclosures Act (1988) . Under this law, whistleblowers are protected from being fired or being victimised (e.g. ignored for promotion ) as a result of their whistleblowing. Large organisations should consider establishing a whistleblowing policy that would outline how employees can raise concerns , who they should speak to and the support available to concerned staff. A famous whistleblower is Edward Snowden , who revealed in 2013 that many governments, including the USA and the UK, were spying on their civilians with widespread undocumented surveillance. Should Martin reveal that his company is dumping old computers into a lake or just stay quiet? Graham feels that, because of his disability, he is being ignored for a promotion that he deserves. Discrimination Definition: When an employee is treated unfairly because of a personal or physical characteristic over which they have no control . The Equality Act (2010) ensures equal treatment for all people irrespective of: race sexuality gender disability marital status (and many more) Examples of discrimination include offensive talk, harassment, unequal pay and being ignored for promotion. Use of Information Definition: Laws such as GDPR (General Data Protection Regulation ) and specifically the Data Protection Act (2018) ensure that organisations must responsibly process personal data. Organisations have a legal obligation to keep their employee and customer personal data secure and out of reach from unauthorised viewers. Considerations should be made about how the information is ethically collected , stored and processed . DataDyne backs up customer information on cloud storage - what if this data is compromised ? As part of quality assurance, Selside Bank double check performance reviews before submission. Codes of Practice Definition: A set of rules which explains how people working in certain professions are required to behave . Organisations may have a code of practice for: Confidentiality (rules on what data can and cannot be shared with others), Quality assurance (ensuring high quality is maintained for all products/services), Behaviour (setting out how employees are expected to behave at work and in communication with each other and customers), Equality and discrimination (being understanding and providing fair access to all employees). Employees must agree to the codes of practice so they are clear on their expectations of what is and isn't acceptable at work. The organisation can then discipline employees that broke the codes of practice they formerly agreed to. Online Safety Definition: Often companies will provide an induction (training ) to new employees about the organisation’s code of practice for using the internet whilst at work . If an individual does not behave safely online or breaks the organisation's codes of practice (by gambling at work for example) then they may be punished (e.g. fined or fired). Employees can ensure that they are safe online by using secure passwords that are regularly updated and preventing web browsers from remembering login details . Miriam changes her password each month to minimise the chance of hackers accessing her account. The CEO of Honey Media apologies in public after biased information led to a lawsuit and loss of reputation. Bias Definition: This is technically correct, but slanted , information that presents a one-sided view . For example, end-of year financial data that focuses on profits and ignores significant losses. Poor quality information may lead to an organisation being misinformed and not sufficiently responding to their customers' needs - for example if a survey was only completed by a small number of people it could generate biased results. As a result of poor quality information, organisations may suffer from damage to their reputation due to negative feedback and reviews from customers, possibly posted online. A lack of trust can occur if customers feel neglected because of decisions made using biased information of a poor quality, therefore reputational damage may lead to loss of customers . Q uesto's Q uestions 5.1 - Ethical Issues: 1. Describe what whistleblowing is and give 3 examples . [4 ] 2. Describe what discrimination is and give 4 examples . [5 ] 3. Which law relates to the use of information ? [1 ] 4a. Describe 2 things that may be included in an organisation's codes of practice . [4 ] 4b. Explain why employees must agree to their company's codes of practice [4 ]. 5. Describe 2 things an employee should do to stay safe online . [2 ] 6a. What is biased information ? [2 ] 6b. Describe 3 possible effects to a company if they use biased information . [6 ] 4.6 & 4.7 - Bodies & Certification Topic List 5.2 - Operational Issues

  • 3.6 - Information Systems | Unit 2 | OCR Cambridge Technicals | CSNewbs

    Learn about the differences between open and closed information systems. Based on the 2016 OCR Cambridge Technicals Level 3 IT specification for Unit 2 (Global Information). 3.6 - Information Systems Exam Board: OCR Specification: 2016 - Unit 2 Information systems, such as structured databases , can be defined primarily as either 'open ' or 'closed '. Open Information Systems Closed Information Systems This type of system can interact with other information systems (e.g. another database) to exchange data , even from different platforms (types of computers). Because it is open it is more at risk of data loss and/or hacking. This type of system is private and cannot exchange data with other systems. Access is limited but it is much more secure than an open system. Q uesto's Q uestions 3.6 - Information Systems: 1. Compare and contrast open and closed information systems . [4 ] 3.5 - Data Analysis Tools Topic List 4.1 - UK Legislation

  • 4.2 - Preventing Vulnerabilities - OCR GCSE (J277 Spec) | CSNewbs

    Learn about common prevention methods of minimising cyber security risks including anti0malware, firewalls and penetration testing. Based on the J277 OCR GCSE Computer Science specification (first taught from 2020 onwards). 4.2: Preventing Vulnerabilities Exam Board: OCR Specification: J277 Watch on YouTube : Preventing Vulnerabilities Penetration Tests Penetration tests are carried out as part of ethical hacking. The purpose of a penetration test is to review the system's security to find any risks or weaknesses and to fix them . Internal tests are to see how much damage could be done by somebody within the company with a registered account. External tests are for white hat hackers to try and infiltrate a system from outside the company . Anti-Malware Software Anti-malware software is used to locate and delete malware, like viruses, on a computer system. The software scans each file on the computer and compares it against a database of known malware . Files with similar features to malware in the database are identified and deleted . There are thousands of known malware, but new forms are created each day by attackers, so anti-malware software must be regularly updated to keep systems secure. Other roles of anti-malware software: Checking all incoming and outgoing emails and their attachments . Checking files as they are downloaded . Scanning the hard drive for viruses and deleting them . Firewall A firewall manages incoming and outgoing network traffic . Each data packet is processed to check whether it should be given access to the network by examining the source and destination address . Unexpected data packets will be filtered out and not accepted to the network. Other roles of a firewall include: Blocking access to insecure / malicious web sites . Blocking certain programs from accessing the internet . Blocking unexpected / unauthorised downloads . Preventing specific users on a network accessing certain files . Secure Passwords ******** Usernames must be matched with a secure password to minimise the chances of unauthorised users accessing a system. Passwords should contain a mix of uppercase and lowercase letters , punctuation and numbers . Passwords should be of a substantial length (at least 8 characters) and should be regularly changed . User Access Levels Access levels are used to only allow certain users to access and edit particular files. ' Read-Only ' access is when a user can only view a file and is not allowed to change any data . For example, a teacher might set homework instructions as read-only for students to view. ' Read and Write ' access allows a user to read and edit the data in a file. For example, a teacher might set an online workbook as read and write access for students to fill in. It is important to set access levels so that only authorised users can view and change data. The more users who have access to a file, the more likely it is to be compromised. Certain users may also have no access to a file - when they can't view or edit it. Encryption Encryption is the process of scrambling data into an unreadable format so that attackers cannot understand it if intercepted during transmission. The original data (known as plaintext ) is converted to scrambled ciphertext using an encryption key . Only at the correct destination will the encryption key be used to convert the ciphertext back into plaintext to be understood by the receiving computer. Physical Security A lock can be used to prevent access to server rooms or locations that store confidential data . Only authorised personnel with a matching key will have access. Biometric devices require the input of a human characteristic (such a fingerprint , iris or voice ). The biometric data is checked against previously inputted data in a database. Only a match will allow access to the user. Other forms of physical security include keycards , security staff , CCTV cameras and alarms . Q uesto's Q uestions 4.2 - Preventing Vulnerabilities: 1. Describe the purpose of penetration tests . [2 ] 2. Describe the purpose of anti-malware software and its different roles . [ 4 ] 3. Describe the purpose of a firewall and its different roles . [ 4 ] 4. State three rules for choosing a strong password . [ 3 ] 5. Describe the three types of access level . [6 ] 6a. Describe the purpose of encryption . [ 2 ] 6b. Explain how encryption works, using the terms plaintext , key and ciphertext . [ 4 ] 4.1 - Security Threats Theory Topics 5.1 - Operating Systems

  • 6.6 - Logical Protection | Unit 2 | OCR Cambridge Technicals | CSNewbs

    Learn about the methods of digital protection including antimalware, firewalls and obfuscation. Based on the 2016 OCR Cambridge Technicals Level 3 IT specification for Unit 2 (Global Information). 6.6 - Logical Protection Exam Board: OCR Specification: 2016 - Unit 2 Logical protection refers to using digital methods of security to protect computer systems and data. Usernames & Passwords ****** Anti-Malware Usernames must be matched with a secure password to minimise the chances of unauthorised users accessing a system. Passwords should contain a mix of uppercase and lowercase letters , punctuation and numbers . Passwords should be of a substantial length (at least 8 characters) and should be regularly changed . Anti-virus software scans a system and removes viruses . If left to infect a system a virus could delete data or permit access to unauthorised users . Anti-spyware software removes spyware on an infected system so hackers cannot view personal data or monitor users. Organisations should install and regularly update anti-virus and anti-spyware programs. Firewall Encryption Firewalls prevent unauthorised access to or from a network . Firewalls filter data packets and block anything that is identified as harmful to the computer system or network. Firewalls can also be used to block access to specific websites and programs. A firewall can be in the form of a physical device which is connected to the network, or software installed on a computer system. Encryption is the conversion of data ( plaintext ) into an unreadable format ( ciphertext ) so it cannot be understood if intercepted . Encrypted data can only be understood by an authorised system with a decryption key . There are two types of encryption . Encryption at rest is when data is encrypted while it is being stored on a system or storage drive. Encryption in transit is to secure the data as it being transferred between systems on a network. Tiered Levels of Access Obfuscation ?????? The purpose of tiered levels of access is to grant different types of permission to certain users. Managing levels of file access ensures that only authorised people can access and change certain files . There are different levels of file access : No access Read-only - Allows a user to view but not edit. Read/write - Allows a user to view and edit. Obfuscation is when data is deliberately changed to be unreadable to humans but still understandable by computers . Program code might be obfuscated to stop rival programmers from viewing and stealing it if they were able to access it. Specialist software can be used to obfuscate data and convert it back into a human-readable format. Q uesto's Q uestions 6.6 - Logical Protection: 1a. Describe why usernames and strong passwords are necessary. [2 ] 1b. State 3 rules for choosing a strong password . [3 ] 2. Describe the purpose of anti-virus and anti-spyware software. [4 ] 3. Describe the roles of a firewall . [4 ] 4. Explain what encryption is. What are the two types? [4 ] 5. Why would an organisation use tiered levels of access ? What are the 3 levels of file access ? [5 ] 6. What is obfuscation ? State a scenario in which it would be used. [3 ] 6.5 - Physical Protection Topic List

  • 5.1 - Data Structures - Eduqas GCSE (2020 Spec) | CSNewbs

    Learn about different data structures such as arrays, lists and records. Also, the difference between static and dynamic data structures and how to design files. Based on the 2020 Eduqas (WJEC) GCSE specification. 5.1: Data Structures & File Design Exam Board: Eduqas / WJEC Specification: 2020 + What is a Data Structure? A data structure is a way of efficiently organising data . There are two general forms of data structures: Static Data Structures The size of a static data structure cannot change e.g. if a data structure has 20 elements, no additional elements can be added or removed. The values of the data elements can be changed, but memory size is fixed when allocated at compile time. Because a static data structure holds a certain number of data elements they are easier to program because the size of the structure and the number of elements never change. An array is an example of a static data structure. Examples: A static data structure could be an array of teams in the Premier League. The data elements will change each year when teams are relegated and promoted but there will always be 20 teams. Dynamic Data Structures The size of a dynamic data structure can change as the program is being run , it is possible to add or remove data elements. Dynamic data structures make the most efficient use of memory but are more difficult to program , as you have to check the size of the data structure and the location of the data items each time you use the data. A list is an example of a dynamic data structure. A dynamic data structure could be a list of all teams in the Premier League that won their last match. Data elements (teams) will be added or removed across the season. Types of Data Structures List A list is a dynamic data structure that has the data elements stored in the order they were originally added to memory . Every data structure starts at 0, not 1 . Lists store data elements in the order they were added, so the first doctor is 0 and the most recent doctor is 12. An example list of the main Doctor Who actors Array An array is a static data structure that can hold a fixed number of data elements . Each data element must be of the same data type i.e. real, integer, string. The elements in an array are identified by a number that indicates their position in the array. This number is known as the index. The first element in an array always has an index of 0 . You should know how to write pseudo code that manipulates arrays to traverse, add, remove and search data. The following steps uses Python as an example. Traversing an Array To traverse (' move through ') an array a for loop can be used to display each data element in order. 'Inserting' a value In an array the size is fixed so you cannot insert new values, but you can change the value of elements that already exist. Overwriting the fourth element (Daphne) with a new value (Laura) will change it from Daphne to Laura. Example code for traversing: Example code for inserting: Output: Output: 'Deleting' a value In an array the size is fixed so you cannot delete values, but you can overwrite them as blank . Overwriting the second element (Shaggy) with a blank space makes it appear deleted. Example code for deleting: Output: Searching an Array For large arrays a for loop is needed to search through each element for a specific value . This example checks each name to see if it is equal to Velma. Example code for searching: Output: Two-Dimensional Array Often the data we want to process comes in the form of a table . The data in a two dimensional array must still all be of the same data type , but can have multiple rows and columns . The two-dimensional array to the right shows the characters from Scooby Doo along with their associated colour and their species. Each value in the array is represented by an index still, but now the index has two values . For example [3] [0] is 'Daphne'. We measure row first , then column . Searching a two-dimensional array: To print a specific data element you can just use the index number like Daphne above. To search for a specific value you will need two for loops, one for the row and another for the values of each row. The example to the right is looking for the value of 'Velma' and when it is round it prints the associated data from the whole row. Example code for printing: Output: Example code for searching: Output: Records Unlike arrays, records can store data of different data types . Each record is made up of information about one person or thing. Each piece of information in the record is called a field (each row name). Records should have a key field - this is unique data that identifies each record . For example Student ID is a good key field for a record on students as no two students can have the same Student ID. Data files are made up of records with the same structure. It would be most efficient for the fields in a record to be stored next to each other so that the data can be read into the record data structure in memory for processing by the CPU. In an exam you may be asked to state and design a data structure for a given scenario. If the data structure can hold values of the same data type you should draw an array , usually a 2D array for multiple rows and columns. Remember that a record is required to store values of different data types . Example questions: "A video gamer has recorded their three lap times in four Mario Kart courses." " State and design the most suitable data structure for this data." A two-dimensional array is most suitable because only one data type ( real ) is stored. "A vet surgery stores data on all dogs and cats including the animal's name, age (in years), weight (in kg) and whether or not it has been vaccinated." " State and design the most suitable data structure for this data for four animals ." A record is most suitable because the data structure requires different data types . Q uesto's Q uestions 5.1 - Data Structures: 1. Give two differences between static and dynamic data structures . [ 4 ] 2. Describe the differences between a list , array and record . [ 3 ] 3. A one-dimensional array looks like this: TigerBreeds("Sumatran","Indian","Malayan,"Amur") Write the code to: a. Print the element with the index of 3. [ 2 ] b. Change Indian to South China. [ 2 ] c. Remove the Amur element. [ 2 ] d. Search through the array for 'Malayan'. [ 2 ] 4. State and design the most suitable data structure for these scenarios: a. For each book in a bookshop, the staff need to record the title, author, number of pages and whether or not it is a signed copy. Include data for three books. [ 3 ] b. Four dieters are recording how many kilograms they have lost each month for 5 months. [ 4 ] 5. Design a file that stores the first initial, surname, age and hair colour of each member of a family. [ 8 ] Designing Data Structures Data is stored in files when it needs to be kept after the program has stopped running . To learn how to write code for file handling (e.g. opening, writing to, reading from and closing files) in Python click here . Designing a file requires more than just the field name (e.g. Name) and data values (e.g. Rebecca). The data type (e.g. string) and any validation checks (e.g. format check) should also be considered. Below is an example file design for a bakery. Designing Files 4.8 Compression Theory Topics 6.1 - Operating Systems

  • OCR CTech IT | Unit 1 | 5.4 - Physical Security | CSNewbs

    Learn about methods of physically protecting data such as biometric devices, RFID and tokens, privacy screens and shredding. Based on the 2016 OCR Cambridge Technicals Level 3 IT specification. 5.4 - Physical Security Exam Board: OCR Specification: 2016 - Unit 1 RFID & Tokens Radio-frequency identification (RFID) uses electromagnetic fields to attach tags to physical objects . RFID tags can be embedded within 'dumb' objects such as clothing, packages and even animals. RFID is used with security tokens (such as an ID keycard ) to permit the access of authorised people to certain areas. RFID can be used by IT companies to track equipment and manage access . Shredding This is the cutting up of documents (paper or CDs ) into small pieces so that they cannot be reassembled and read. Sensitive data on paper or optical disc should be shredded when no longer required. Locks A lock can be used to prevent access to server rooms or sensitive data stores . Only authorised personnel with the right key will have access. Physical Security Measures Biometrics Biometric devices require the input of a human characteristic (such a fingerprint , iris or voice scan ). The biometric data is checked against previously inputted data in a database . A match will allow access to the user. See more in section 1.1 . Privacy Screens These plastic screens are placed over a monitor to obscure the screen to anyone except the person sitting directly in front of them. This prevents shoulder surfing and prevents data from being read by unauthorised people nearby. Q uesto's Q uestions 5.4 - Physical Security: 1. Explain how locks can be used as a physical security method within an organisation. [2 ] 2. Explain what RFID is and how it can be used with tokens as a physical security method. [3 ] 3. Explain how biometric devices can be used as a physical security method. [3 ] 4. Explain how privacy screens are used to protect data. [2 ] 5. What is the purpose of shredding ? [2 ] 5.3 - Threats Topic List 5.5 - Digital Security

  • Python | 4b - Mathematical Operators | CSNewbs

    Learn how to use mathematical operators in Python. Try practice tasks and learn through text and images. Perfect for students learning GCSE Computer Science in UK schools. 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 each 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 ➡

  • 2.1 - Programming Techniques | OCR A-Level | CSNewbs

    Learn about programming constructs such as sequence, iteration and branching, recursion, local and global variables, modularity, functions and procedures, parameter passing by value and by reference, Integrated Development Environment (IDE) tools and object-oriented techniques. Based on the OCR H446 Computer Science A-Level specification. Exam Board: OCR A-Level Specification: Computer Science H446 2.1 - Programming Techniques Watch on YouTube : Programming constructs Recursion Local & global variables Modularity Integrated development environment Object-oriented programming Programming Constructs Sequence , iteration and branching (also called selection ) are the three fundamental programming constructs used to build algorithms . Sequence means that instructions run in a specific order , one after another. Iteration is the repetition of a set of instructions , usually being count-controlled , such as for loops , or condition-controlled , such as while loops or do until loops . Branching (selection ) allows a program to choose between different actions based on a condition , using structures like if , elif , else or switch . YouTube video uploading soon Recursion Recursion is where a function calls itself to solve a problem by breaking it down into smaller , simpler versions of the same problem . Recursion is often used for tasks that naturally fit a 'divide and conquer ' structure , such as quicksort and merge sort algorithms. It is also used for depth-first tree traversals and solving mathematical problems like factorials or the Fibonacci sequence . Compared to iteration , recursion can produce clearer and more elegant solutions , but it may use more memory and can be less efficient if the recursion goes too deep or lacks a proper base case (stopping condition ) , potentially running out of memory . YouTube video uploading soon Local & Global Variables Local variables are created inside a function or block and can only be accessed there , which makes programs safer and easier to debug because changes to the variable cannot affect other parts of the program ; however, they cannot store values that need to be shared across multiple functions . Global variables are declared outside all functions and can be accessed anywhere in the program , making them useful for storing information that many parts of the program need , but they can lead to errors if different functions accidentally change them and can make the program harder to maintain . YouTube video uploading soon Modularity Modularity is the practice of breaking a program into smaller , self-contained parts so each section can be developed , tested and understood independently . Functions and procedures are modular units of code: a function returns a value , while a procedure performs a task without returning a value . When data is passed into a subroutine , it can be passed by value , where a copy of the data is sent so the original cannot be changed , or passed by reference , where the subroutine receives direct access to the original data , allowing it to be modified . YouTube video uploading soon Integrated Development Environment An Integrated Development Environment (IDE ) is software that provides the tools a programmer needs to write , test and debug code in one place . It typically includes an editor for writing and formatting code , syntax highlighting to make keywords and errors easier to spot , and auto-completion to speed up coding . For debugging , an IDE often provides error diagnostics that highlight mistakes , a run-time environment to execute the program , and tools like breakpoints and step-through execution that allow the programmer to pause the program and inspect variables to find and fix bugs more easily . YouTube video uploading soon Object-Oriented Programming Object-oriented techniques are a way of designing programs by modelling them as collections of objects , each representing something with its own data and behaviours . These objects are created from classes , which act like blueprints describing the attributes (data ) and methods (actions ) an object will have . It uses key principles such as encapsulation (keeping an object’s data and methods together and protected ), inheritance (allowing classes to share and reuse features ) and polymorphism (enabling objects to behave differently ). These techniques make large programs easier to organise , maintain and extend by encouraging reusable , modular and well-structured code . YouTube video uploading soon This page is under active development. Check here for the latest progress update. Q uesto's K ey T erms Programming Constructs: sequence, iteration, selection (branching), if / elif / else, select (switch) case Recursion & Iteration: count-controlled loop, condition-controlled loop, recursion, base case Variables: local variable, global variable Modularity: function, procedure, parameter, pass by value, pass by reference Integrated Development Environment (IDE) Object Oriented Programming (OOP): class, object, method, attribute, inheritance, encapsulation, polymorphism D id Y ou K now? Roblox Studio is a free IDE for making Roblox games using the programming language Lua . With over 70m daily Roblox players , games built in Roblox Studio can reach a larger audience than many mainstream game engines . 1.1 - Computational Thinking A-Level Topics 2.2 - Computational Methods

  • 2.3 - Additional Programming Techniques - OCR GCSE (J277 Spec) | CSNewbs

    Learn about arrays, records and SQL (structured query language) including the SELECT, FROM and WHERE commands. Based on the J277 OCR GCSE Computer Science specification (first taught from 2020 onwards). Exam Board: OCR Specification: J277 2.3: Additional Programming Techniques Watch on YouTube : String Manipulation File Handling Arrays Subprograms Random Numbers SQL This section of the specification includes programming topics that are outlined in 1.2 (Designing Algorithms). You must have an understanding of more complex programming techniques , such as how to manipulate strings , handle files and use subprograms . The best practice for learning is to try the tasks in the Python pages on this website (see the link to the right). Visit the Python section of CSNewbs ---> Subprograms What is a subprogram? Large programs are often broken down into smaller subprograms (also called subroutines ). Each subprogram focuses on a specific function of the code, helping to decompose a complex problem into more manageable chunks . Defining subprograms A subprogram is defined (identified) using the def command in Python. A program may use many subprograms , which are usually defined at the start of the code . Calling subprograms Running a line of code that includes the name of a subprogram will call (activate) it. When called , the program will run the subprogram code before returning back to the line that called it . Subprograms are only run when called , so depending on decisions made, a program may end without calling every (or any) subroutine. Parameters A parameter is a value that is passed into a subprogram when it is called , allowing the value to be used within the subprogram . A subprogram may not use a parameter , e.g. multiply() , or one parameter , e.g. multiply(num) , or several e.g. multiply(num1,num2) . Any parameters must be identified when the subprogram is defined , e.g. def multiply(num): Return The return command will send a value back to the line the subprogram was called on, allowing it to be used there . For example, the 'quad' subprogram in the example below returns the value of the 'result' variable back to the main program, allowing it to be printed . A subprogram will end either by reaching the last line of code within it, or when it reaches a return command . Subprograms that return a value are called functions . Subprogram example This subprogram is defined using the identifier 'quad ' with a parameter named number . The subprogram is called in the main program, multiplies the number passed in as a parameter by 4 and returns a value back to the main program to be printed. def quad (number): result = number * 4 return result #Main Program number = int ( input ( "Enter a number: " )) print ( "The number quadrupled is" , quad(number)) Enter a number: 5 The number quadrupled is 20 Functions and Procedures There are two types of subprograms . A function is a subprogram that returns a value , using the return command, which allows the value to be used in the line of code the function was called in. The 'divide' function below returns the value of the variable 'total' to the main program to be printed. A procedure is a subprogram that does not return a value . Example of a Procedure def multiply (num): total = num * 2 print ( "The number doubled is" , total) #Main Program num = int ( input ( "Enter a number: " )) multiply(num) Enter a number: 4 The number doubled is 8 Example of a Function def divide (num): total = num / 2 return total #Main Program num = int ( input ( "Enter a number: " )) print ( "The number halved is" , divide(num)) Enter a number: 9 The number halved is 4.5 Advantages of using subprograms Subprograms break a complex program down into smaller parts , making it easier to design and test . Each subroutine can be tested separately and abstraction can be used to simplify a complicated problem . Using subprograms allows code to be easily reused in other programs , as it has already been written , making it quicker to develop new programs or build on existing work. Using subprograms avoids code repetition , as they can be called as many times as necessary . This makes programs shorter and quicker to develop , making them easier to maintain and debug . Work can easily be split up between team members to work on different subprograms at the same time . Array An array is a static data structure that can hold a fixed number of data elements . Each data element must be of the same data type i.e. real, integer, string. The elements in an array are identified by a number that indicates their position in the array. This number is known as the index. The first element in an array always has an index of 0 . You should know how to write pseudo code that manipulates arrays to traverse , add , remove and search for data . The following steps use Python as an example, although Python does not use arrays and uses a similar data structure called a list (that can change in size as the program runs ). See the 8a and 8b Python pages for tasks on how to use lists . What Traversing an Array To traverse (' move through ') an array a for loop can be used to display each data element in order. Example code for traversing: Output: 'Inserting' a value In an array the size is fixed so you cannot insert new values, but you can change the value of elements that already exist. Overwriting the fourth element (Daphne) with a new value (Laura) will change it from Daphne to Laura. Example code for inserting: Output: 'Deleting' a value In an array the size is fixed so you cannot delete values, but you can overwrite them as blank . Overwriting the second element (Shaggy) with a blank space makes it appear deleted. Example code for deleting: Output: Searching an Array For large arrays a for loop is needed to search through each element for a specific value . This example checks each name to see if it is equal to Velma. Example code for searching: Output: Two-Dimensional Array Often the data we want to process comes in the form of a table . The data in a two dimensional array must still all be of the same data type , but can have multiple rows and columns . The two-dimensional array to the right shows the characters from Scooby Doo along with their associated colour and their species. Each value in the array is represented by an index still, but now the index has two values . For example [3] [0] is 'Daphne'. Unless stated in an exam , measure row first , then column . Searching a two-dimensional array: To print a specific data element you can just use the index number like Daphne above. To search for a specific value you will need two for loops , one for the row and another for the values of each row . The example to the right is looking for the value of ' Velma ' and when it is found it prints the associated data from the whole row . Example code for printing: Output: Example code for searching: Output: Records Unlike arrays, records can store data of different data types . Each record is made up of information about one person or thing . Each piece of information in the record is called a field (each row name). Records should have a key field - this is unique data that identifies each record . For example Student ID is a good key field for a record on students as no two students can have the same Student ID. A 2D array may be used to represent database tables of records and fields . SQL SQL (structured query language ) is a language that can be used to search for data in a database . The format of an SQL statement is: SELECT field1, field2, field3… FROM table WHERE criteria Example of an SQL statement using the Cars table: SELECT Make, Colour FROM Cars WHERE Miles > 1000 AND Age > 8 Cars table SQL uses wildcards which are symbols used to substitute characters . The * symbol represents ALL fields . Example: SELECT * FROM Cars WHERE Colour = “blue” < Click the banner to try a self-marking quiz (Google Form) about records and SQL. Q uesto's Q uestions 2.3 - Additional Programming Techniques: 1a. Describe what the following terms mean: subprogram , parameter , function , procedure . [ 2 each ] 1b. Describe three advantages of using subprograms . [ 6 ] 2. Describe the differences between a 1D array , 2D array and record . [ 3 ] 3. A one-dimensional array looks like this: TigerBreeds["Sumatran","Indian","Malayan,"Amur"] Write the code to: a. Print the element with the index of 3. [ 2 ] b. Change Indian to South China. [ 2 ] c. Remove the Amur element. [ 2 ] d. Search through the array for 'Malayan'. [ 2 ] 4a. Use the Cars table above to write the SQL statement to display the make and miles for cars that are grey OR blue . [ 3 ] 4b. Write an SQL statement to display all fields for cars that are 10 years old or less . [ 3 ] 2.2 Data Types Theory Topics 3.1 - Defensive Design

  • Python Editor| CSNewbs

    A simple HTML and CSS editor using Code Minrror libraries. Learn how to create simple web pages using HTML. Try practice tasks and learn through text and images. Perfect for students learning GCSE Computer Science in UK schools. Simple HTML & CSS Editor This page is under active development.

  • 11 Graphical User Interface | CSNewbs

    Learn how to create and use a simple graphical user interface (GUI) in Python. Try practice tasks and learn through text and images. Perfect for students learning GCSE Computer Science in UK schools. Python 11 - GUI Graphical User Interface In Python, you don’t have just to use a text display; you can create a GUI (Graphical User Interface ) to make programs that look professional. This page demonstrates the basic features of Python’s built-in GUI named tkinter . You can add images, labels, buttons and data entry boxes to develop interactive programs . Hyperlinked sections covered on this page: Setup: Title, Size & Background Creating Elements: Labels, Entry Boxes, Buttons, Images, Message Boxes Displaying Elements: Pack, Place, Grid Inputs & Outputs GUI Tasks Setup Setup: Title, Size & Background Firstly, import the tkinter command and set tkinter.Tk() to a variable such as window . GUI code can be quite complicated with multiple elements so it is sensible to use a comment for each section. Setting the title , size and background colour of your window is optional but can be easily set up at the start of your code. The .geometry() command sets the size of the window. The first number is the width , and the second number is the height . The .configure() command can be used to set the background colour . For a full list of compatible colours, check here . import tkinter #Setting up the Window window = tkinter.Tk() window.title( "Graphical User Interface" ) window.geometry( "400x400" ) window.configure(background = "lightblue" ) import tkinter #Setting up the Window window = tkinter.Tk() window.title( "Example Number Two" ) window.geometry( "300x400" ) window.configure(background = "darkorchid3" ) Creating Elements Creating Elements: Labels, Entry Boxes, Buttons, Radio Buttons, Images, Message Boxes Labels label1 = tkinter.Label(window, text = "Hello there" ) label1 = tkinter.Label(window, text = "Hello there" , fg = "black" , bg = "lightblue" , font = ( "Arial" , 12)) Simple label with default formatting: Label with custom formatting: No elements will appear in your window until you write code to put them there. See the 'Displaying Elements' section further down. Entry (Text) Boxes Simple entry box with default formatting: entry1 = tkinter.Entry(window ) Entry boxes will appear blank , the 'Example Text' shown in the images has been typed in. Entry box with custom formatting: entry1 = tkinter.Entry(window, fg = "blue" , bg = "gray90" , width = 12, font = ( "Arial" ,12)) Buttons The command property of a button is a subroutine that will be called when the button is pressed . The subroutine must be written above the button creation code. def ButtonPress (): #Code here runs when the button is pressed button1 = tkinter.Button(window, text = "Click Me" , fg = "black" , bg = "gold2" , command = ButtonPress) Radio Buttons The Radiobutton element is a multiple-choice option button . A variable needs to be created to track which option has been selected, in this example it is ‘choice ’. Each radio button needs to be linked to the variable and given a unique value (e.g. 0, 1, 2). The radio button with the the value of 0 will be automatically selected when the window opens . Although not shown below, the .set() command can also be used to select a specific radio button , e.g. choice.set(2) . choice = tkinter.IntVar() radio1 = tkinter.Radiobutton(window, text = "Breakfast" , variable = choice, value = 0) radio2 = tkinter.Radiobutton(window, text = "Lunch" , variable = choice, value = 1) radio3 = tkinter.Radiobutton(window, text = "Dinner" , variable = choice, value = 2) Message Boxes You need to import messagebox from tkinter before you can use message boxes . You only need to do this once in your program and it sensible to have it at the very start after you import tkinter (and any other libraries). from tkinter import messagebox tkinter.messagebox.showinfo( "Information" , "Welcome to the program!" ) tkinter.messagebox.showerror( "Error" , "There is a problem with the program." ) if (tkinter.messagebox.askyesno( "Warning" , "Have you understood the instructions?" )) == True : tkinter.messagebox.showinfo( "Warning" , "Thank you for understanding." ) else : tkinter.messagebox.showinfo( "Warning" , "Please read the instructions again." ) Yes / No Message Box Clicking Yes (True ) Clicking No (False ) Images Tkinter supports the image file types .png and .gif . The image file must be saved in the same folder that the .py file is. Resize the image in separate image editing software such as Paint to a specific size . Tkinter does not support all image file types, such as .jpg. Use an application like Microsoft Paint to save an image with a different extension like .png. photo1 = tkinter.PhotoImage(file = "hamster.png" ) photoLabel1 = tkinter.Label(window, image = photo1) An image can be turned into a clickable button rather than a label. def ButtonPress (): #Code here runs when the button is pressed photo1 = tkinter.PhotoImage(file = "hamster.png" ) button1 = tkinter.Button(window, image = photo1, command = ButtonPress) photo1 = tkinter.PhotoImage(file = "hamster.png" ) window.iconphoto( True , photo1) The icon of the window can be changed to an image . Displaying Elements: Pack, Place and Grid Pack .pack() puts the element in the centre of the window, with the next packed element immediately below. window.mainloop() should always be your last line of code in every program, after you have packed, placed or gridded your elements. Displaying Elements labelAdd.pack() buttonAdd.pack() labelMinus.pack() buttonMinus.pack() window.mainloop() Place The .place() command allows an element to be placed in specific coordinates , using x (horizontal ) and y (vertical ) axes. labelAdd.place(x = 25, y = 15) buttonAdd.place(x = 12, y = 35) labelMinus.place(x = 90, y = 15) buttonMinus.place(x = 83, y = 35) window.mainloop() Grid The .grid() command is used to create a grid system to set the row and column . Remember Python starts counting at 0 . You can use padx and pady to add extra space (x is horizontal , y is vertical ). labelAdd.grid(row = 0, column = 0, padx = 10, pady = 5) buttonAdd.grid(row = 1, column = 0, padx = 10) labelMinus.grid(row = 0, column = 1, padx = 10, pady = 5) buttonMinus.grid(row = 1, column = 1, padx = 10) window.mainloop() Inputs & Outputs Inputs and Outputs .config to Change an Element .config() overwrites the property of an element. It can be used with elements such as labels and buttons to change how they appear. label1.config(text = "Warning!" ) The example below (not showing setup and packing) adds 1 to a total variable when the button is pressed . Config is used in two ways: to display the updated total and to change the background of the label to green. def AddOne (): global total total = total + 1 labelTotal.config(text = total, bg = "green" ) total = 0 buttonAdd = tkinter.Button(window, text = "Add" , command = AddOne) Below is a similar program in full that increases or decreases and displays a total when the buttons are pressed . #Setup import tkinter window = tkinter.Tk() total = 0 #Button Presses def AddOne (): global total total = total + 1 labelTotal.config(text = total) def MinusOne (): global total total = total - 1 labelTotal.config(text = total) #Create Elements labelTotal = tkinter.Label(window, text = total, font = ( "Arial" ,14)) buttonAdd = tkinter.Button(window, text = "+" , width = 6, bg = "green" , command = AddOne) buttonMinus = tkinter.Button(window, text = "-" , width = 6, bg = "red" , command = MinusOne) #Display Elements buttonAdd.pack() buttonMinus.pack() labelTotal.pack() window.mainloop() .get to Input a Value .get() returns the value of an element such as an entry box , label or the choice variable if using radio buttons . The value of the element should be stored in a variable so it can be used elsewhere, for example: name = entryName.get() number = int (entryNumber.get()) Use int when getting a value that is an integer : The full program example below checks that the values typed into the username and password entry boxes are correct . Error Messages #Setup import tkinter from tkinter import messagebox window = tkinter.Tk() window.title( "Login" ) #Button Presses def CheckDetails (): username = entryUsername.get() password = entryPassword.get() if username == "Bob Bobson" and password == "cabbage123" : tkinter.messagebox.showinfo( "Success" , "Welcome " + username) else : tkinter.messagebox.showerror( "Invalid ", "Those details are incorrect." ) #Create Elements labelUsername = tkinter.Label(window, text = "Username:" ) labelPassword = tkinter.Label(window, text = "Password" ) entryUsername = tkinter.Entry(window) entryPassword = tkinter.Entry(window) buttonLogin = tkinter.Button(window, text = "Login" , command = CheckDetails) #Display Elements labelUsername.grid(row = 0, column = 0) entryUsername.grid(row = 0, column = 1) labelPassword.grid(row = 1, column = 0) entryPassword.grid(row = 1, column = 1) buttonLogin.grid(row = 2, column = 0) window.mainloop() .bind for Key Presses (& Close Window) .get() will run a specific function when a certain key is pressed. The name of the key must be surrounded by < > brackets and speechmarks . Any associated subroutine of a key bind will need a parameter : event has been chosen and set to None . The code below closes the window using the .destroy() command when the Esc key is pressed. def Close (event = None ): window.destroy() window.bind( "" , Close) The code below will activate the button (and display a message box) by clicking on it but also by pressing the Enter ( Return ) key . def ButtonPress (event = None ): tkinter.messagebox.showinfo( "Success" , "The button was activated" ) button1 = tkinter.Button(window, text = "Press Me" , command = ButtonPress) window.bind( "" , ButtonPress) GUI Tasks GUI Programs to Make Making a program using a GUI can be overwhelming and you must decompose the problem - take it step by step : Import tkinter and create the window (set the title, size and background colour). Create the elements you will need such as labels , buttons and entry boxes . Put the components in the window using pack , place or grid . Write the subroutines for any button presses . These are written at the top of the program after the window setup. Consider your variables - do any need to be set at the start ? Have you made them global if they’re needed within a subroutine ? Put window.mainloop() as the final line of code, only have it once. Use #comments in your code to break up the different sections, the key four sections are shown below. #Setup #Button Presses #Create Elements #Display Elements GUI Task 1 (Random Number Generator ) Generate a random number between 1 and 100 when the button is pressed and display it in a label. Extension idea: Use entry boxes to allow the user to manually input the minimum and maximum value. Example solution: GUI Task 2 (Currency Exchange ) Enter a decimal value and convert it from British pounds to American dollars. You can search for the current exchange rate. Extension idea: Show the conversion rate for other currencies such as Euros and Japanese Yen. Example solution: GUI Task 3 (Random Quote Generator ) Create a list of quotes and use the choice command from the random library to select one to be displayed in a label when the button is clicked. Extension idea: Have a separate text box and button to add more quotes to the list. Example solution: GUI Task 4 (Colour Changer ) When the button is clicked change the background colour of the button with .config to the RGB colour code in the entry box. This should be # followed by 6 hexadecimal values (0-9, A-F). Extension idea: Have an error pop up in a message box if the colour code is incorrect - it must be exactly 7 characters long and start with a hashtag. Example solutions: GUI Task 5 (Class Captain Votes ) Use radio buttons to vote for different candidates in a class vote. Use an if statement when the button is pressed to check which radio button is selected using .get() and the variable you've assigned to the radio buttons ('choice' if you've followed the code in the radio buttons section on this page). Use .config to overwrite a label's value. Remember any variables you want to use in subroutines must be globalised. Extension idea: Stop the count after a certain number - e.g. 30 votes recorded. Example solution: ⬅ Section 10 Practice Tasks 12 - Error Handling ➡

© CSNewbs 2026

The written, video and visual content of CSNewbs is protected by copyright. © 2026
bottom of page