Mind map
Section 5 - Programming
Map content
Section 5 - Programming
Strings
- String Manipulators
- x.upper
- Changes all characters in string x to upper case
- x.lower
- Changes all characters in string x to lower case
- x.length
- Returns the number of characters in string x
- x[i]
- Extracts the character in position i from string x
- x.subString(a,b)
- Extracts a string starting at position a with length b from string x
- x.upper
- String Manipulators
Arrays
- Arrays are used to store multiple data values
- An array is a data structore that can store a collection of data values all under one name
- Each piece of data in an array is called an element
- Each element can be accessed using its position or index in the array
- Arrays are most helpful when you have lots of related data that you want to store and it doesn't make sense to use separate variables
- Some languages require you to declare arrays before they are used
- One-dimensional arrays are like lists
- Creating arrays
- ARRAY array_name[x]
- array_name[0] = "Hello"
- This sets array_name's position 0 to "Hello"
- array_name would be the name you choose for the array
- x being the number of data pieces you need
- array_name[0] = "Hello"
- ARRAY array_name[x]
- Retrieving elements
- print(array_name[0])
- This will print what's in position 0 of the array_name array
- print(array_name[0])
- Changing Elements
- array_name[0] = "Bonjour"
- This will then change the data in position 0 to "Bonjour
- array_name[0] = "Bonjour"
- Creating arrays
- Two-dimensional arrays are like lists of lists
- The position of an element is written as [a, b] or [a][b]
- a represents the position of the one-dimensional list that the element is in
- b represents its position within that one-dimensional list
- Example
- trees = [["oak", "ash"], ["beech", "cedar"], ["pine", "elm"]]
- The position of an element is written as [a, b] or [a][b]
- Arrays are used to store multiple data values
File Handling
- Must start by opening the external file
- Example
- newFile = openRead("newFile.txt")
- newFile = openWrite("newFile.txt")
- newFile = openRead("newFile.txt")
- Example
- Once the file has been opened you can continue to write to it until you close it
- newFile.close()
- Must start by opening the external file
Storing Data
- Databases
- Databases store data in tables
- The columns of these tables are called fields
- The rows are called records
- A field is used to store a category
- A record will use the fields to store details about a specific item
- All data values in the same field must be the same data type
- But... data values in the same record can have different data types
- Most Databases use SQL (Structured Query Language)
- Create and Update tables
- CREATE TABLE
- This SQL statement will create a table with as many fields as you want
- Once a table has been created you can add records to it
- INSERT INTO
- This SQL statement will insert the data into the table
- INSERT INTO
- To update a table you shall use the Update
- UPDATE-SET-WHERE
- CREATE TABLE
- Create and Update tables
- Databases store data in tables
- Databases
Sub Programs
- Procedures and Functions will help to avoid repetition of code
- Procedures are a set of instructions in which are stored under one name
- Means if you want the program to do these instructions you just call the name
- Functions are similar, however they always return a value
- They can give your program more structure and readability while cutting the amount of code down
- Sometimes you'll encounter parameters and arguments
- Parameters
- Special values used to pass values into a sub program, for each parameter you have to specify a name, data type and default value
- Arguments
- The actual values that the parameters take when the sub program is called
- Parameters
- Procedures are a set of instructions in which are stored under one name
- Variables can be local or global
- Every variable has a scope
- Each scope will tell you which parts of the program the variable can be used within
- Local
- Can only be used within the structure they're declared in
- Global
- Can be used any time after their declaration
- Every variable has a scope
- Procedures and Functions will help to avoid repetition of code
Information
- Description
- Year 11 Computing Mind Map on Section 5 - Programming, created by Jake Bailey on 17/04/2018.
- Created by
- Jake Bailey
- Views
- 0
- Rating