1.1. Programming
1.1. Programming
3.1.1 Programming
Concise Notes
www.pmt.education
Specification:
www.pmt.education
3.1.1.3 Arithmetic operations
Be familiar with and be able to use:
● addition
● subtraction
● multiplication
● real/float division
● integer division, including remainders
● exponentiation
● rounding
● truncation
www.pmt.education
3.1.1.7 String-handling operations in a programming language
Be familiar with and be able to use:
● length
● position
● substring
● concatenation
● character → character code
● character code → character
● string conversion operations
www.pmt.education
3.1.1.13 Local variables in subroutines
Know that subroutines may declare their own variables, called local
variables, and that local variables:
● exist only while the subroutine is executing
● are accessible only within the subroutine
Be able to use local variables and explain why it is good practice to do
so.
www.pmt.education
Data Types
Data / Time A way of storing a point in time, many different formats are
used.
www.pmt.education
Programming Concepts
Variable declaration Creating a variable for the first time, giving it a name
and sometimes a data type.
Nested Structures
● Selection structures and iteration structures can be nested
● One structure is placed within another
● This can easily be identified by different levels of indentation in code
● Indentation makes the code easier for humans to understand
www.pmt.education
Arithmetic Operations
Operation Description
Integer Division The same as real / float division, but just the whole number
part is given.
Relational Operations
Operation Example
Equal to 12 = 12
www.pmt.education
Boolean Operations
String-handling operations
Function Description
www.pmt.education
String conversions
Exception handling
● Once an exception has been thrown, the computer has to handle the exception to
avoid crashing.
● It does this by:
○ Pausing execution of the program
○ Saving the current volatile state of the program on the system stack
○ Running a section of code called a catch block
● Once the exception has been handled, the program uses the system stack to
restore its previous state before resuming execution.
Subroutines
www.pmt.education
Functions and Procedures
Parameters of subroutines
● A local variable can only be accessed from the subroutine within which it is declared
● Local variables only exist in the computer’s memory when their parent subroutine is
executing
● Local variables are more memory efficient than global variables
Global variables
www.pmt.education