0% found this document useful (0 votes)
20 views

PSEUDOCODE Summary

The document outlines essential pseudocode concepts required for IGCSE Computer Science syllabus 0478/0984, including input/output operations, variable declaration, selection statements, loops, procedures, functions, and array handling. It also covers standard algorithms such as linear search, binary search, and bubble sort, as well as string manipulation and file handling techniques. Each concept is illustrated with corresponding pseudocode examples for clarity.

Uploaded by

Arkar Htet Myat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

PSEUDOCODE Summary

The document outlines essential pseudocode concepts required for IGCSE Computer Science syllabus 0478/0984, including input/output operations, variable declaration, selection statements, loops, procedures, functions, and array handling. It also covers standard algorithms such as linear search, binary search, and bubble sort, as well as string manipulation and file handling techniques. Each concept is illustrated with corresponding pseudocode examples for clarity.

Uploaded by

Arkar Htet Myat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Summary of the pseudocode required for IGCSE Computer Science (syllabus 0478/0984) based on

the Cambridge curriculum.

1. **Input/Output**
- **INPUT**: Read data from the user

```pseudocode

INPUT variableName
```

- **OUTPUT**: Display data to the user

```pseudocode

OUTPUT variableName
```

2. **Variables**
- Declaring and assigning a variable

```pseudocode

variableName ← value
```

3. **Selection (IF Statements)**


- **IF-THEN-ELSE**: Conditional execution

```pseudocode

IF condition THEN
statement
ELSE
statement
ENDIF
```

- **IF-THEN (without ELSE)**:

```pseudocode

IF condition THEN
statement
ENDIF
```
4. **Loops**
- **FOR Loop**: Used for a fixed number of iterations

```pseudocode

FOR i ← 1 TO n
statement
NEXT i
```

- **WHILE Loop**: Used for a condition-controlled loop

```pseudocode

WHILE condition DO
statement
ENDWHILE
```

- **REPEAT UNTIL Loop**: Executes at least once and repeats until a condition is met

```pseudocode

REPEAT
statement
UNTIL condition
```

5. **Procedures and Functions**


- **PROCEDURE**: A subroutine without returning a value

```pseudocode

PROCEDURE procedureName(parameter1, parameter2, ...)


statement
ENDPROCEDURE
```

- **FUNCTION**: A subroutine that returns a value

```pseudocode

FUNCTION functionName(parameter1, parameter2, ...) RETURNS datatype


statement
RETURN value
ENDFUNCTION
```
6. **Arrays**
- Declaring and accessing arrays

```pseudocode

DECLARE arrayName[10]
arrayName[index] ← value
```

# Declare a one-dimensional array named 'Days'

# Initialize it with the names of the days of the week

DECLARE Days[7] AS STRING ← ["Monday", "Tuesday", "Wednesday", "Thursday",


"Friday", "Saturday", "Sunday"]

- Looping through an array

```pseudocode

FOR i ← 0 TO arraySize - 1
OUTPUT arrayName[i]
NEXT i
```

7. **Declaring a 2D Array**

To declare a 2D array, you specify both dimensions, for example:

```pseudocode

DECLARE arrayName[rows, columns]


```

Example for a 3x3 array:

```pseudocode

DECLARE matrix[3, 3]
```

# Declare a two-dimensional array named 'Readings'

# This array will hold 7 rows and 24 columns, each element of type FLOAT

DECLARE Readings[7, 24] AS FLOAT


8. **Accessing Elements in a 2D Array**

To access an element, you reference both the row and column index:

```pseudocode

matrix[row, column] ← value


```

Example of assigning a value:

```pseudocode

matrix[1, 2] ← 5
```

Example of retrieving a value:

```pseudocode

value ← matrix[1, 2]
```

9. **Looping Through a 2D Array**

You can use nested loops to iterate over the elements in a 2D array.

Example of printing all values in a 2D array:

```pseudocode

FOR i ← 0 TO 2
FOR j ← 0 TO 2
OUTPUT matrix[i, j]
NEXT j
NEXT i
```
10. **Standard Algorithms**
- **Linear Search**: Searching an array for a value

```pseudocode

FOR i ← 0 TO arraySize - 1
IF arrayName[i] = searchValue THEN
OUTPUT "Found at index ", i
EXIT
ENDIF
NEXT i
```

- **Binary Search**: Efficient search algorithm (only works on sorted arrays)

```pseudocode

low ← 0
high ← arraySize - 1
WHILE low ≤ high DO
mid ← (low + high) DIV 2
IF arrayName[mid] = searchValue THEN
OUTPUT "Found at index ", mid
EXIT
ELSEIF arrayName[mid] < searchValue THEN
low ← mid + 1
ELSE
high ← mid - 1
ENDIF
ENDWHILE
```

- **Bubble Sort**: A basic sorting algorithm

```pseudocode

FOR i ← 0 TO arraySize - 2
FOR j ← 0 TO arraySize - 2 - i
IF arrayName[j] > arrayName[j + 1] THEN
temp ← arrayName[j]
arrayName[j] ← arrayName[j + 1]
arrayName[j + 1] ← temp
ENDIF
NEXT j
NEXT i
```
11. **String Handling**
- Common string manipulation functions:

- **LEN(string)**: Returns the length of a string


- **LEFT(string, n)**: Returns the first n characters of a string
- **RIGHT(string, n)**: Returns the last n characters of a string
- **MID(string, start, n)**: Returns n characters starting from position
`start`

12. **File Handling**


- **OPEN**: Opening a file

```pseudocode

OPEN fileName FOR READ


OPEN fileName FOR WRITE
```

- **READ/WRITE**: Reading and writing from/to a file

```pseudocode

READ fileName
WRITE fileName, data
```

- **CLOSE**: Closing a file

```pseudocode

CLOSE fileName
```

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy