Search CSNewbs

226 items found for ""

  • Computer Science Newbies

    C omputer S cience Newb ie s Popular CSNewbs topics: Programming PYTHON GCSE Computer Science OCR GCSE Computer Science EDUQAS OCR Cambridge Technicals Level 3 IT You are viewing the mobile version of CSNewbs. The site may appear better on a desktop or laptop . Programming HTML CSNewbs last updated: Monday 26th September 2022 Thanks for over 259,000 visits to CSNewbs in the past year! About CSNewbs

  • 2.2 - Data Types - OCR (2020 Spec) | CSNewbs

    2.2: Data Types Exam Board: OCR Specification: 2020 What are the different data types? When programming, variables should be given appropriate data types . Character A single character , such as a letter, number or punctuation symbol. ​ Examples: T 8 ? String A sequence of characters , including letters, numbers and punctuation. ​ Examples: Harry Waters 14:50pm Ice Age 4 Integer A whole number . ​ ​ ​ Examples: 475 -8432 56732 Real Boolean A decimal number . ​ ​ Examples: 65.3 -321.1234 909.135 An answer that only has two possible values . ​ Examples: True / False Yes / No 0 / 1 Telephone numbers are always stored as a string , not an integer. Casting Converting the value of a variable from one data type into another is known as casting . ​ Python automatically assumes an input is a string so the int() command is used to cast an input into an integer . Other Python commands for casting include str() and float() . ​ For example: age = int(input("Enter your age: ") Q uesto's Q uestions 2.2 - Data Types: ​ 1. List the five data types , giving an example of each . [ 5 ] ​ 2. State which data type is most suitable for the following variables: a. Age [ 1 ] b. Surname [ 1 ] c. Height (in metres) [ 1 ] d. First Initial [ 1 ] e. Phone number [ 1 ] f. Right-Handed? [ 1 ] ​ ​ 3. Explain what casting is and give a programming situation in which it would be used . [ 2 ] 2.1 - Programming Fundamentals Theory Topics 2.3 - Additional Techniques

  • 2.3 - Units - OCR GCSE (2020 Spec) | CSNewbs

    2.3: Data Units Exam Board: OCR Specification: 2020 Why data must be stored in binary format How data needs to be converted into a binary format to be processed by a computer text file size = bits per character x number of characters All computer systems communicate , process and store data using binary . Binary is a number system consisting entirely of 0s and 1s . ​ Why do computers use binary? Computer systems consist of billions of tiny transistors which are switches that only have two values - on (1 ) or off (0 ). Therefore all data must be represented and processed in this way. ​ Everything that a computer needs to process must be converted into a binary format including text , images , videos and audio . 0010 1011 0101 0101 0110 0111 0101 0001 0101 0101 0101 0100 1010 1010 1010 1010 1111 1110 0010 1001 0100 1001 0010 0111 0111 0101 0011 1010 1000 0101 0110 0111 0000 1010 1010 0011 1101 1001 0010 1101 0010 0100 1001 0011 1010 1001 0101 0101 0010 0101 0111 0101 0101 1000 1011 0111 Units of Data Storage 0 / 1 All data in a computer system is made up of bits . ​ A single bit is a 0 or a 1 . 4 bits (such as 0101 or 1101) is called a nibble . 1,000 bytes is called a kilobyte . ​ A kilobyte can store a short email . A 8 bits is called a byte . A byte can store a single character . 1,000 kilobytes is called a megabyte . ​ A megabyte can store about a minute of music . 1,000 megabytes is called a gigabyte . ​ A gigabyte can store about 500 photos . 1,000 terabytes is called a petabyte . ​ A petabyte can store about 1.5 million CDs . 1,000 gigabytes is called a terabyte . ​ A terabyte can store about 500 hours of films . This video shows some real-world examples to help you understand the scale of the different data storage units . ​ Important note - this video was originally made for a different exam board and uses a scale of 1,024 between data units. ​ Technically 1,000 bytes is a kilobyte . 1,024 bytes is a kibibyte . ​ In the OCR GCSE exam you can use either 1,000 or 1,024 but as it is a non-calculator paper it makes sense to use 1,000 for simpler calculations . Calculating Data Capacity Requirements It is important to be able to calculate the required storage capacity for a given set of data . ​ Example: ​ A local DJ has a USB memory stick with a capacity of 32GB . There is currently only 9GB of space remaining . ​ Each song is 6MB . How many songs can be stored on the remaining space of the USB stick? ​ Solution: ​ Because each song is recorded in megabytes but the USB stick capacity is measured in gigabytes , the values must be converted into the same storage unit . ​ 9GB x 1000 = 9000MB ​ 9000MB ÷ 6MB = 1,500 songs Q uesto's Q uestions 2.3 - Data Units: ​ 1. Explain why computer systems use binary to represent data. [ 2 ] ​ 2. Put the following data storage units in order from smallest to largest : a . kilobyte - gigabyte - byte - megabyte - nibble - bit [3 ] b. gigabyte - petabyte - kilobyte - byte - terabyte - megabyte [ 3 ] ​ 3. A hard drive contains 25GB of remaining available storage space. Tim is an animator backing up video files. Each file is 200MB . How many files can he fit on the hard drive? [ 2 ] ​ 4. Samantha is a musician. She has compressed each song to 900KB . Her USB memory stick contains 1.2GB of free storage. How many songs can she fit on the USB stick? [ 2 ] ​ 5. A CD has a capacity of 650MB . How many 0.2GB audio files can be stored on the CD? [ 2 ] Watch on YouTube 2.2 - Secondary Storage Theory Topics 2.4a - Number Storage

  • 4.1 - Boolean Logic - OCR GCSE (2020 Spec) | CSNewbs

    4.1: Boolean Logic Exam Board: OCR Specification: 2020 What is a logical operator? Inside of each computer system are millions of transistors . These are tiny switches that can either be turned on (represented in binary by the number 1 ) or turned off (represented by 0 ). ​ Logical operators are symbols used to represent circuits of transistors within a computer. The three most common operators are: ​ NOT AND OR What is a truth table? A truth table is a visual way of displaying all possible outcomes of a logical operator. The input and output values in a truth table must be a Boolean value - usually 0 or 1 but occasionally True or False. NOT AND OR A NOT logical operator will produce an output which is the opposite of the input . ​ NOT is also known as Negation . ​ The symbol for NOT is ¬ An AND logical operator will output 1 only if both inputs are also 1 . ​ AND is also known as Conjunction . ​ The symbol for AND is ∧ An OR logical operator will output 1 if either input is 1 . ​ OR is also known as Disjunction . ​ The symbol for OR is ∨ NOT Logic Gate AND Logic Gate Symbol OR Logic Gate Symbol Truth Table Truth Table Truth Table Multiple Operators Exam questions could ask you complete truth tables that use more than one logical operator . Work out each column in turn from left to right and look carefully at which preceding column you need to use. NOT B A AND NOT B A OR (A AND NOT B) Logic Diagrams You may be asked in an exam to d raw a logic diagram when given a logical expression . ​ Draw any NOT symbols or expressions in brackets first. A logic diagram for C = ¬A ∧ B A logic diagram for D = C ∨ (A ∧ B) Q uesto's Q uestions 4.1 - Boolean Logic: ​ 1. Copy and complete the following truth tables: ​ ​ ​ 1b. Simplify the expression in the second truth table. ​ 2a. A cinema uses a computer system to monitor how many seats have been allocated for upcoming movies. If both the premium seats and the standard seats are sold out then the system will display a message. State the type of logical operator in this example. 2b. For the more popular movies, the cinema's computer system will also display a message if either the premium seats or the standard seats have exclusively been sold out. However, it will not output a message when both have been sold out. State the type of logical operator in this example. ​ 3. Draw a logic diagram for C = (¬B v A) ∧ A . 3.2 - Testing Theory Topics 5.1 - Languages & Translators

  • 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

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

    2.3: Additional Programming Techniques Exam Board: OCR Specification: 2020 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. What 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. 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” Q uesto's Q uestions 2.3a - Additional Programming Techniques: ​ 1. Describe the differences between a 1D array , 2D array and record . [ 3 ] ​ 2. 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 ] ​ 3a. Use the Cars table above to write the SQL statement to display the make and miles for cars that are grey OR blue . [ 3 ] 3b. 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

  • 1.2 - Designing Algorithms - OCR GCSE (2020 Spec) | CSNewbs

    1.2: Designing Algorithms Exam Board: OCR Specification: 2020 What is an algorithm? An algorithm is a set of instructions , presented in a logical sequence . ​ In an exam you may be asked to read and understand an algorithm that has been written. To prove your understanding you may be asked to respond by actions such as listing the outputs of the algorithm, correcting errors or identifying an error within it. ​ Programmers create algorithm designs as a method of planning a program before writing any code. This helps them to consider the potential problems of the program and makes it easier to start creating source code. There are two main methods of defining algorithms are pseudocode and flowcharts . In exams , OCR will display algorithms in their own 'OCR Exam Reference Language '. OCR Exam Reference Language T he OCR exams require specific questions to be written either in OCR Exam Reference Language (shown below) or a high-level programming language such as Python . Basic Commands Annotation // Comments are written using two slashes Assignment name = "Harold" age = 49 ​ Constants and Global Variables constant tax = 15 global name = "Admin" ​ Input / Output name = input ( "Enter your name") print ("Transaction Complete") ​ Casting str (29) int ("102") float (30) bool ("False") ​ Random Number number = random (1,100) Selection Selection (if - then - else) if firstname == "Steven" then​ print("Hello" + firstname) elif firstname == "Steve" then print("Please use full name") else print("Who are you?") end if ​ Selection (case select) switch day: case “Sat”: print(“It is Saturday”) case “Sun”: print(“It is Sunday”) default : print(“It is a Weekday”) endswitch Iteration Iteration (for loop) for i = 1 to 10 step 1 input item next i ​ Iteration (while loop) while firstname ! = "Steven" firstname = input("Try again:") endwhile ​ Iteration (do while loop) do firstname = input("Guess name:") until firstname == "Steven" String Handling Length of a String word = "dictionary" print(word.length ) outputs 10 ​ Substrings word = "dinosaurs" print(word.substring (2,3)) outputs nos print(word.left (3)) outputs din print(word.right (4)) outputs aurs ​ Concatenation name = "Penelope" surname = "Sunflower" print(name + surname) ​ String Cases phrase = "The Cat Sat On The Mat" print(phrase .lower ) print(phrase .upper ) ​ ASCII Conversion ASC ("C") returns 67 CHR (100) r eturns "d" File Handling File Handling - Reading Lines file1 = open ("Customers.txt") while NOT file1.endOfFile() print(file1.readLine() ) endwhile file1.close() ​ File Handling - Writing to a (New) File newFile ("paint.txt") file2 = open ("paint.txt") paint = input("Enter a paint colour:") file.writeLine (paint) file2.close() Arrays Declare Array array names[3] ​ array names = "Ella", "Sam", "Ali" ​ Declare 2D Array array grid[4,5] ​ Assign Values names[2] = "Samantha" grid[1,3] = "X" Flowcharts A flowchart can be used to visually represent an algorithm. ​ It is more likely you will need to be able to interpret a flowchart rather than draw one. ​ The flowchart symbols are: Algorithm Examples Below are two different methods for representing the same algorithm - a program to encourage people to buy items cheaply at a supermarket. The program allows the price of items in a supermarket to be entered until the total reaches 100. The total price and the number of items entered are tracked as the program loops. Once the total reaches 100 or more, an if statement checks how many items have been entered and a different message is printed if there are 20 or more items, 30 or more items or less than 20 items. Pseudocode // This is a program to see how many items you can buy in a supermarket before you spend over £100} ​ total = 0 itemsentered = 0 ​ while total < 100 itemprice = input ("enter the price of the next item") total = total + itemprice itemsentered = itemsentered + 1 endwhile ​ if itemsentered >= 20 then print ("You are on your way to saving money.") elif itemsentered => 30 then print ("You're a real money saver.") else print ("Look for better deals next time.") endif Flowchart Reading Algorithms In an exam you may be asked to read an algorithm and prove your understanding , most commonly by listing the outputs . ​ Start from the first line and follow the program line by line , recording the value of variables as you go . ​ When you encounter a for loop , repeat the indented code as many times as stated in the range . Example Algorithm: procedure NewProgram() ​ maxvalue = input() ​ for i = 1 to maxvalue output (i * i) ??????? ​ print("program finished") ​ endprocedure Example Questions: 1. List the outputs produced by the algorithm if the 'maxvalue' input is 5 . ​ 2. State the code that has been replaced by '???????' and what the code's purpose is. Example Answers: 1. Outputs: 1 4 9 16 25 program finished 2. Missing Code: next i Purpose: Moves the loop to the next iteration. Watch on YouTube Trace Tables Trace tables are used to track the value of variables as a program is run . ​ They can be used to manually track the values in order to investigate why the program isn't working as intended . ​ Each row in the trace table represents another iteration . Each column stores the value of a variable as it changes. See below how the trace table is updated for the simple algorithm on the left. num1 = 2 num2 = 5 ​ for i = 1 to 3 output (num1 + num2) num2 = num2 - 1 next i ​ print("complete") For most algorithms, not every variable will be updated in each iteration . ​ Values may not be entered in the order of the trace table either. For example, each iteration outputs num1 + num2 and then decreases the value of num2 by 1. Q uesto's Q uestions 1.2 - Designing Algorithms: ​ 1. What is the definition of an algorithm ? Name two ways an algorithm can be designed . [ 3 ] ​ 2. Using a high-level programming language such as Python , or the OCR Exam Reference Language , write an algorithm that inputs 6 decimal numbers and outputs the total , largest , smallest and average values. [ 8 ] ​ For example, entering 3.1 , 5.3 , 2.3 , 5.4 , 2.9 and 4.4 would output 23.3 (total), 5.4 (largest), 2.3 (smallest) and 3.9 (average). ​ 3. Draw and label the flowchart symbols . [ 6 ] ​ 4. Create a trace table for the NewProgram() algorithm in the Reading Algorithms section on this page. [ 7 ] 1.1 - Computational Thinking Theory Topics 1.3 - Searching & Sorting

  • 5.2 - Integrated Development Environment - OCR GCSE (2020 Spec) | CSNewbs

    Exam Board: OCR Specification: 2020 5.2: Integrated Development Environment An IDE (Integrated Development Environment ) provides programmers with the following facilities (tools ) to help create programs : Editor The editor is software that allows a programmer to enter and edit source code . ​ Editor features may include: ​ Automatic formatting (e.g. automatic indentation). Automatic line numbering (this helps to identify exactly where an error has occurred). Automatic colour coding (e.g. Python turns loop commands orange and print commands purple). Statement completion (e.g. offering to auto-complete a command as the user is typing.) Error Diagnostics & Debugger Break point The programmer selects a specific line and the program displays the variable value at that point . The code can then be executed one line at a time to find exactly where the error occurs. This process is called single-stepping . Variable Watch / Watch Window cost Displays the current value of a selected variable . ​ A variable can be watched line-by-line to see how the value changes . Trace Logs the values of variables and outputs of the program a s the code is executed line by line . Both tools are used to display information about an error when it occurs, such as the line it occurred on and the error type (e.g. syntax). These tools may also suggest solutions to help the programmer to find and fix the error. Compilers & Interpreters Both tools convert the source code written by a programmer into machine code to be executed by the CPU. A compiler converts the entire source code into executable machine code at once . After compilation, the program can be run again without having to recompile each time. ​ An interpreter converts source code into machine code line by line . An interpreter must reinterpret the code each time the program is required to run . See 5.1 for both types of translators. A runtime environment allows a program to run on a computer system. It checks for runtime errors and allows users to test the program . ​ A runtime error occurs as the program is being executed , such as dividing a number by zero . ​ A commonly used example is the Java Runtime Environment . This allows programmers to design a program on one platform ( using the programming language Java ) which allows the finished program to then be run on many others systems . ​ A runtime environment enables the tools above such as a trace and breakpoint to be used. Run Time Environment Q uesto's Q uestions 5.2 - Integrated Development Environment: ​ 1. Describe the purpose of each type of IDE tool : a. Editor b. Interpreter c. Compiler d. Error Diagnostics / Debugger e. Break point f. Variable Watch / Watch Window g. Trace h. Runtime Environment [ 2 each ] 5.1 - Languages & Translators Theory Topics

  • 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 Eduqas 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? CSNewbs.com 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) and the embedded Python editor can be accessed on trinket's website . 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: There are social media pages for CSNewbs but with busy times recently they are rarely updated : Privacy Policy

  • 3.2 - Testing - OCR GCSE (2020 Spec) | CSNewbs

    3.2: Testing Exam Board: OCR Specification: 2020 The main purpose of testing is to ensure that a program works correctly no matter what input has been entered by the user. Other reasons to test a program include ensuring the user requirements have been met , errors have been removed and the program doesn't crash while running .​ Types of Testing Iterative Testing Iterative testing takes place during program development . ​ The programmer develops a module , tests it and repeats this process until the module works as expected . Final Testing Final testing, also known as terminal testing , takes place after development and before the program is released to the end user. ​ This testing takes place once all modules have been individually tested to ensure the whole program works as originally expected. Programming Errors Syntax Error Logical Error A syntax error is a mistake in the grammar or spelling of the program. ​ A syntax error will prevent the program from being compiled . ​ Examples: Incorrect Spelling: pront ( "hello" ) Incorrect punctuation: print ( "hello" ( A logical error is a mistake made by the programmer - the program still works but displays the wrong output . ​ Examples: Incorrect calculation: total = num1 - num2 print (total) Incorrect variable printed: age = 16 name = "Steve" print ( "Nice to meet you" , age) Test Data Test data is used to test whether a program is functioning correctly . It should cover a range of possible and incorrect inputs , each designed to prove a program works or to highlight any flaws . Three types of test data are: ​ ​ Normal data - Sensible data that the program should accept and be able to process . Boundary data - Data at the extreme boundary of any data ranges. ​ Invalid (AKA Erroneous ) data - Data that the program cannot process and should not accept . Q uesto's Q uestions 3.2 - Testing: ​ 1. Give 3 reasons why programs are tested . [ 3 ] ​ 2. What is the difference between iterative and final testing ? [ 2 ] ​ 3a. What is a syntax error ? Give an example . [ 2 ] 3b. What is a logical error ? Give an example . [ 2 ] ​ 4. State and describe the three types of test data . [ 6 ] 3.1 - Defensive Design Theory Topics 4.1 - Boolean Logic

  • 3.1 - Defensive Design - OCR GCSE (2020 Spec) | CSNewbs

    3.1: Defensive Design Exam Board: OCR Specification: 2020 Defensive Design Considerations There are several things to consider when creating a program that is secure and robust , including: Anticipating Misuse Planning ahead to take steps against potential misuse (e.g Twitter preventing the same tweet sent twice in a row). Input Sanitisation Cleaning up data that has been input, (e.g. removing special characters to prevent a SQL injection). Validation Checking whether input data follows criteria and should be accepted. (e.g. length check on a password). Verification Checking whether data has been entered correctly (e.g. double entry). Authentication Ensuring only authorised users can gain access to a system (e.g. passwords) ​ Maintainable code Allowing other programmers to understand the code (e.g. comments, indentation, meaningful variable names). Input Validation Validation is a process to check that data is reasonable or sensible before it is accepted . Range Check Checks data is within a certain range . Age: 34 203 Type Check Checks data is a certain data type . Height (in cm): 182 Two metres Format Check Checks data is entered in a certain way . Date of Birth (DD/MM/YYYY) 25/03/2001 25th March 01 Presence Check Lookup Table Length Check Checks that data has actually been entered and not left blank . A table of acceptable entries , also known as a list . Checks the length of the input is within a certain amount. Password: fluffythecat123 Telephone Number 08323877319 07383 Maintainability Programs should be written in a way that makes maintaining and understanding them as straightforward as possible. Examples of making a program maintainable include: Using subprograms to reuse code and make them easier to test . This is called modularisation . Appropriate variable names , using a naming convention , ensure the purpose of a variable is immediately understood. Using indentation to improve readability and clearly show each ‘block’ of code. Comments enable a programmer to understand the purpose of each line of code. Crucial when working in a team . Using constants is another method of improving maintainability. This keeps the program code consistent , which makes it easier to read and debug a program. Q uesto's Q uestions 3.1 - Defensive Design: ​ 1. Describe the different considerations a programmer should make for a defensive design . [ 6 ] ​ 2. Describe the each validation check and give a suitable example . [ 12 ] ​ 3. Explain the different ways a program can be maintained . [ 5 ] 2.3 Additional Programming Theory Topics 3.2 - Testing

  • 8.2 - Understanding Algorithms - Eduqas GCSE (2020 Spec) | CSNewbs

    8.2: Understanding Algorithms Exam Board: Eduqas / WJEC Specification: 2020 + What is an algorithm? An algorithm is a set of instructions , presented in a logical sequence . ​ In an exam you may be asked to read and understand an algorithm that has been written. To prove your understanding you may be asked to respond by actions such as listing the outputs of the algorithm, correcting errors or identifying an error within it. ​ Programmers create algorithm designs as a method of planning a program before writing any code. This helps them to consider the potential problems of the program and makes it easier to start creating source code. There are two main methods of defining algorithms : Defining Algorithms - Pseudocode & Flowcharts Pseudocode Pseudocode is not a specific programming language but a more general method of describing instructions . It should be unambiguous, and it should not resemble any particular kind of programming language (e.g. Python or Java), so it can theoretically be turned into working code in any language. ​ Generally, pseudocode can be written in any way that is readable and clearly shows its purpose. However, the Eduqas exam board advises that pseudocode for the programming exam should follow the conventions below : Annotation { Write your comment in curly brackets} ​ Define data type price is integer firstname is string ​ Declare a variable's value set price = 100 set firstname = "Marcella" ​ Input / output output "Please enter your first name" input firstname Selection (must have indentation) if firstname = "Steven" then​ output "Hello" + firstname elif firstname = "Steve" then output "Please use full name" else output "Who are you?" end if ​ Iteration (while loop) while firstname ! = "Steven" output "Guess my name." input firstname repeat Iteration (for loop) for i in range 10 input item next i ​ Define a subroutine Declare Sub1 [Subroutine content indented] End Sub1 ​ Call a subroutine call Sub1 Flowcharts A flowchart can be used to visually represent an algorithm. The flowchart symbols are: Algorithm Examples Below are two different methods for representing the same algorithm - a program to encourage people to buy items cheaply at a supermarket. The program allows the price of items in a supermarket to be entered until the total reaches 100. The total price and the number of items entered are tracked as the program loops. Once the total reaches 100 or more, an if statement checks how many items have been entered and a different message is printed if there are 20 or more items, 30 or more items or less than 20 items. Pseudocode Flowchart {This is a program to see how many items you can buy in a supermarket before you spend over £100} ​ total is integer, itemsentered is integer, itemprice is integer set total = 0 set itemsentered = 0 ​ while total < 100 output "enter the price of the next item" input itemprice total = total + itemprice itemsentered = itemsentered + 1 repeat if itemsentered >= 20 then output "You are on your way to saving money." elif itemsentered => 30 then output "You're a real money saver." else output "Look for better deals next time." end if Reading Algorithms In an exam you may be asked to read an algorithm and prove your understanding , most commonly by listing the outputs . ​ Start from the first line and follow the program line by line , recording the value of variables as you go . ​ When you encounter a for loop , repeat the indented code as many times as stated in the range . Example Algorithm: Start NewProgram ​ i is integer maxvalue is integer ​ input maxvalue ​ for i = 1 to maxvalue output (i * i) ??????? ​ output 'program finished' ​ End NewProgram Example Questions: 1. List the outputs produced by the algorithm if the 'maxvalue' input is 5 . ​ 2. State the code that has been replaced by '???????' and what the code's purpose is. Example Answers: 1. Outputs: 1 4 9 16 25 program finished 2. Missing Code: next i Purpose: Moves the loop to the next iteration. Watch on YouTube Q uesto's Q uestions 8.2 - Understanding Algorithms: ​ 1a. Read the algorithm shown on the left and list all outputs in the correct order if the inputs are 2 for height and 72 for weight . ​ 1b. Give the code that is missing from line 25 . 8.1 - Programming Principles Theory Topics 8.3 - Writing Algorithms