# Paper 2

***

## Local Variables

* Only accessible within a function
* Not visible outside the function
* Used to store temporary data or values

***

## Global Variables

* Accessible throughout the whole program and visible throughout the code
* Variable exists as long as the program is running
* Used to store values that need to be modified or accessed by the program

***

## Types of Test Data

There are 4 types (for more info go [here](https://hammaadmughal.gitbook.io/main/igcse-computer-science/miscellaneous-p2/validation-and-verification#test-data)):

1. Normal&#x20;
2. Abnormal
3. Extreme
4. Boundary

***

## Data Types

You can have a string, character, Boolean, integer, and a real number.

To define a string  ->  it's a group of characters consisting of letters, numbers, and special characters.\
To define a character  ->  it's a single character, or letter

{% hint style="info" %}
If asked to give an example of any of the above, make sure that your answer includes everything within the definition of that specific data type.

Example: if asked to give an example of a string. You must say (Variable2024!) to show that the string can include all of those characters. While if asked about a boolean, you can say either true or false.
{% endhint %}

In Python a real value, is equivalent to a float value.

***

## Functions

The main thing to note is the difference between defining and calling a function.

When you are defining a function, you are creating that function. It's where you specify what the functions should do.&#x20;

When you are calling a function, you are using the function you defined and you are telling the program to execute the code inside that function.

***

## Flowchart Symbols

Will most likely come up. Need to know the symbols mean and be able to explain what they do.\
All info about flowcharts can be found [here](https://hammaadmughal.gitbook.io/main/igcse-computer-science/miscellaneous-p2/flowchart-symbols).

***

## Types of Statements

1. Conditional Statements\
   Used to make decisions in a program (e.g. an if / case statement)
2. Iteration (or looping) Statements\
   Repeats a block of code multiple times (e.g. a for / while loop)
3. Assignment Statements\
   Where you are assigning a value to a variable (e.g. x = 5)
4. Input / Output Statements
5. Declaration Statements\
   You declare the data type of a constant or variable (e.g. string, integer)
6. Contol Transfer Statements\
   This is when you change the flow of a program (e.g. using break / return)
7. Function Call Statements
8. Exception Handling Statements\
   To deal with error handling (e.g. using try / catch)

***

## SQL Commands

Look through this list and understand what each one does. Revise [here](https://hammaadmughal.gitbook.io/main/igcse-computer-science/databases-p2/9.1-databases#sql).

***

## Types of Checks

This comes up frequently in exam questions. Read up on it [here](https://hammaadmughal.gitbook.io/main/igcse-computer-science/miscellaneous-p2/validation-and-verification).

***

## Definitions

**Pre-Condition Loop**\
Condition is evaluated before the loop is executed (e.g. a while loop).

**Post-Condition Loop**\
Condition is evaluated afterwards so the loop executes regardless of the condition (e.g. a repeat until loop).

**Constant**\
A value that is set once and cannot be changed during the execution of the program.\
Is used instead of a variable if the variable shouldn't change during the program's execution.

**Variable**\
A storage location in memory with a name that is used to hold data that can change during the program's execution.

**Array**\
A data structure that holds multiple values of the same data type indexed by position.

**Library Routines**\
A collection of standard programs available for immediate use.

**Subroutine**\
Performs a specific task and does not necessarily return a value (generally used to execute a set of instructions that are used frequently).\
It can be called when required and used by other programs.

**Abstraction**\
When you simplify a problem by removing unnecessary details from the problem and filtering out irrelevant characteristics from elements.

**Function**\
Performs a specific task and returns a value when called (generally used to perform calculations which are used later on in the code).

**Primary Key**\
The field that is used has to be a unique identifier or alphanumeric value.

***
