GCSE
Computer Science
-
Introduction to GCSE Computer Science -
1.1 Systems Architecture -
1.2 Memory and Storage -
1.3 Computer Networks, Connections and Protocols -
1.4 Network Security -
1.5 Systems Software -
1.6 Ethical, Legal, Cultural and Environmental Impacts of Digital Technology -
2.1 Algorithms -
2.2 Programming Fundamentals -
2.3 Producing Robust Programs -
2.4 Boolean Logic -
2.5 Programming Languages and Integrated Development Environments
1. Computer Systems
2.2.3 Additional Programming Techniques
In this lesson, we will learn advanced programming techniques that will greatly strengthen your coding skills.
String Manipulation
String manipulation involves modifying, combining, or extracting parts of strings. Some essential string operations include:
- Concatenation: Combining two or more strings to create a new string.
- Slicing: Extracting a portion of a string using index positions or ranges.
- Length: Finding the length of a string.
- Case Conversion: Changing the case of a string.
- ASCII Conversion (Character to Number and Vice Versa).
Example
Python & OCR Pseudocode:
first_name = "John"
last_name = "Doe"
full_name = first_name + " " + last_name # Combines the two strings
print(full_name) # Output: John Doe
Example
Python:
subject = "ComputerScience"
substring = subject[3:8] # Extracts characters from index 3 to 7
print(substring) # Output: puter
OCR Pseudocode:
subject = "ComputerScience"
substring = subject.substring(3,5) // Output: "puter" as it starts at index 3 (using zero-indexing) and continues for 5 chars
print(substring)
Example
Python:
text = "ComputerScience"
length = len(text) # Finds the length of the string
print(length) # Output: 15
OCR Pseudocode:
subtext = "ComputerScience"
length = text.length
print(length) // Output: 15
Example
Python:
text = "Hello World"
uppercase_text = text.upper() # Converts to uppercase
lowercase_text = text.lower() # Converts to lowercase
print(uppercase_text) # Output: HELLO WORLD
print(lowercase_text) # Output: hello world
OCR Pseudocode:
text = "Hello World"
uppercase_text = text.upper
lowercase_text = text.lower
print(uppercase_text) // Output: HELLO WORLD
print(lowercase_text) // Output: hello world
Example
Python:
ascii_value = ord('A') # Converts character 'A' to ASCII
character = chr(97) # Converts ASCII value 97 to character
print(ascii_value) # Output: 65
print(character) # Output: a
OCR Pseudocode:
ascii_value = ASC("A")
character = CHR(97)
print(ascii_value) // Output: 65
print(character) // Output: a
Continue the lesson
This section is available to learners with course access. Continue learning with Knowness to unlock the full explanation, examples, revision tools, and progress tracking.
The remaining lesson content includes further guided explanation, important learning points, and supporting interactive material designed to help you understand and revise this topic.
Unlock this topic to view the full activity, worked examples, common mistakes, and additional revision support.
More content available
Knowness lessons are structured to build understanding step by step. Create an account or upgrade your access to continue from this point.
This preview does not include the hidden lesson text, answers, explanations, or embedded interactions.
Continue learning with Knowness
Sign up to access the full lesson, predicted grades, revision tools, progress tracking, and more.
Create a free accountString Manipulation
- Concatenation combines two or more strings into one.
- Slicing extracts parts of a string using indexes.
- Length gives the total number of characters in a string.
- Case Conversion changes strings to uppercase or lowercase.
- ASCII Conversion uses ord() and chr() to convert between characters and ASCII codes.
File Handling Operations
- Files can be opened, read, written to, and closed using commands in pseudocode and Python.
- Python uses "r" to read, "w" to write, and "a" to append to files.
- The with open(...) structure in Python automatically closes the file after use.
Records
- Records store related data under one structured entry (e.g., a row in a table).
- Each field stores one specific attribute (like Name, Age, etc.).
- Commonly used in databases and DBMS for organising complex data.
SQL for Data Retrieval
- SELECT picks which columns to display.
- FROM specifies which table to get data from.
- WHERE filters data based on conditions.
Arrays
- 1D arrays are simple lists.
- 2D arrays represent grid-like structures (like tables).
- Arrays are fixed-length, meaning they can't dynamically resize.
- 2D arrays can mimic database tables with rows as records and columns as fields.
Subprograms: Functions and Procedures
- Functions return a value and are used for calculations.
- Procedures perform actions but don’t return anything.
- Local variables exist only inside subprograms.
- Global variables exist outside and can be accessed inside subprograms.
- Arrays can be passed to and returned from subprograms.
- Use functions to avoid repetition and keep code clean and structured.
Random Number Generation
- Python uses the random module to generate integers (randint) and reals (uniform).
- Don’t forget to import random at the start of your script.
- Useful in games, simulations, and other unpredictable scenarios.
