Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
4 views7 pages

Study Note

Uploaded by

jpj770897
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)
4 views7 pages

Study Note

Uploaded by

jpj770897
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/ 7

Computer Science STUDY NOTE

1. Decomposition - breaking down a complex problem or system into smaller, more manageable parts
2. Pattern recognition – looking for similarities among and within problems
3. Abstraction – focusing on the important information only, ignoring irrelevant detail
4. Algorithms - developing a step-by-step solution to the problem, or the rules to follow to solve the problem
Algorithm design techniques – Pseudocode, Flowchart, Structured diagrams, Structured English
Basic constructs of an algorithm – Sequence, Selection, Iteration

Transferable skill - Knowledge / experience of one programming language can be applied to an unknown
language. A learned / existing skill which can be applied to / used in a new situation / role

How transferable skills would help you work on the program

Able to recognize / understand in another language: Declaration / assignment / sequence / selection /


repetition (iteration) / Subroutines / Parameters passed between modules / program structure / Input and
Output

Benefits of Modularization /Decomposition /Stepwise refinement

1. Program code is easier to implement / manage


2. Modules may be given to different people to develop based on their expertise.
3. Program code easier to test/ debug/maintain
4. Encourages the re-usability of program code
5. Allows the subroutine to be called from many / multiple places
6. Subroutine may be (independently) tested and debugged
7. If the task changes the change needs to be made only once
8. Reduces unnecessary duplication / program lines

Drawbacks of Modularization/ Decomposition /Stepwise refinement


1. If a particular module gets delayed, it can delay the whole program.
2. Need to implement additional Code and testing strategies to combine modules. Ex: Module
integration testing. Which consume time and resources.
3. Smaller programs are difficult to decompose.
4. Need to implement thorough supervision during development to maintain the quality standards,
otherwise module might not be able to work as a whole program.

Stepwise refinement
Increase the level of detail of an algorithm / design
breaking down a problem / module / task into smaller parts steps, until steps are easier to solve // to be
directly translated into lines of code

Yasitha Senanayake 0773 891 892


Computer Science STUDY NOTE

Features of a high level language that support the modular approach

1. Using parameters
2. Functions
3. Procedures
4. Global / Local variables

Features than can be represented in a Structure chart

1. Module hierarchy
2. Module Selection
3. Module Iteration
4. Module Sequence
5. Module Parameter passing / Interface between modules

Types of Parameter parsing


By reference - The address of the variable is passed. Original value is changed when parameter
changed in called module.
By value - A copy of the variable itself is passed. Original value not changed when parameter changed in
called module.

why parameters are used with subroutines

1. To pass values to/from the subroutine


2. To produce re-useable code
3. To avoid global variables
4. To allow recursion

How structured programming languages support the implementation of sub-tasks.

Through the use of: Subroutines / Functions / Procedures / Parameters / Methods

Text File
Reason for selecting text file over an array to store data is: Array is temporary data structure. Text File is
used to store data permanently.

Text file handling modes:


WRITE MODE – Open the text file to write from the beginning
APPEND MODE – Open the READ MODE - Data will be read
text file to write from the end of the file. (Suitable for file with existing data)

Yasitha Senanayake 0773 891 892


Computer Science STUDY NOTE

Example description of reading a text file


LOOP through the file until EOF ()
READ text line from Text file in a loop
EXTRACT File data in a loop
CLOSEFILE text file

A special character is inserted between data items before the line is written to the file
Ex : EmpID # EmpName # EmpSalary

 We use character separators to identify data items in a string uniquely.


 To provide a separator (or implied) between the data items
 Algorithm to extract / locate individual items from a line of text is simplified
 The special character does not appear in the data

Suggest a suitable separator character. Give the reason for your choice
Any character Ex: colon, space or any alpha-numeric
Reason: character is not in the text information strings

Pseudocode includes features that make it easier to read and understand.

1. Keywords in capitals
2. White Space / blank lines / grouping
3. Comments
4. Sensible function names
5. Indentation
6. Meaningful identifier names

Advantages of storing the strings in an array rather than as separate variables

1. Same data type using a single identifier


2. More efficient coding
3. Less declaration statements needed
4. Access of individual elements (using subscript / index)
5. Ability to iterate through the data // easier to search / sort the data
6. Code easier to understand / maintain / modify

DECLARE <ArrayIdentifier> : ARRAY [<lowerBound : UpperBound>] OF <Data Type> - 1D Array declaration


DECLARE <ArrayIdentifier> : ARRAY [<lowerBound1 : UpperBound1> , <lowerBound2 : UpperBound2>] OF
<Data Type>

Ex : DECLARE Membership : ARRAY [1:3000] OF Student


1 : LowerBound
3000: UpperBound
Membership [10] : Is Index / Subscript of the array(value inside the square brackets)

Yasitha Senanayake 0773 891 892


Computer Science STUDY NOTE

Technical terms for the minimum and maximum values the subscript may take in an array
Lower Bound
Upper Bound

Features provided by an IDE that assist in the initial detection of errors

1. (Dynamic) syntax checking


2. Highlighting undeclared variables
3. Identification of syntax errors
4. Type checking
5. Parameter checking
6. Identification of unused variables
7. Pretty printing
8. Auto-indentation

Features of a typical IDE for program presentation

 Pretty print / Colour-coding of keywords / variables


 (Auto) indentation
 (Auto) Expansion / collapsing of data structures / code blocks // thumbnail overview

Features of a typical IDE that would help a programmer to debug a program

1. Single-stepping – to allow program statements to be executed one at a time


2. Breakpoints – to pause / stop the program at a specific line / statement
3. Variable / expression watch window – to monitor the value of variables / expressions as the
program is run
4. Syntax error highlighting

Yasitha Senanayake 0773 891 892


Computer Science STUDY NOTE

Sample efficient Bubble sort algorithm example


*Assume an Array with 1000 element.
PROCEDURE BubbleSort()
DECLARE Temp : STRING
DECLARE Swap : BOOLEAN
DECLARE UpperBound , X : INTEGER
UpperBound ← 999 //since array index count is from 0 to 999
REPEAT
Swap ← TRUE
FOR X ← 0 TO UpperBound
IF Array[X] > Array [X+1] THEN
Temp ← Array [X]
Array [X] ← Array [X+1]
Array [X+1] ← Temp
Swap ← FALSE
ENDIF
ENDFOR
UpperBound ← UpperBound - 1
UNTIL Swap = TRUE
ENDPROCEDURE

Description of an efficient bubble sort how it works

• Reduce the number of items to be checked by one after each pass


• Use a flag variable to stop the outer loop
• After no more swaps made on a single pass of the inner loop
• Resetting before the inner loop starts, and setting it whenever a swap is made

Yasitha Senanayake 0773 891 892


Computer Science STUDY NOTE

Types of Testing
White-box testing
Testing every path through the program, Tester can see the internal coding.
Uses testing technique: Dry –run (Walk Trough)
The process of checking the execution of an algorithm or program by recording variable values in a trace
table

Black-box testing
Comparing expected results with actual results when a program is run, Tester can’t see the internal coding.

Stub testing
1. Tests carried out before all the modules / subroutines have been written
2. Simple dummy module written to simulate actual model, replace the actual module if it delayed in
completion.
3. Contains an output statement or returns a fixed value to indicate that the call has been made

Integration Testing
Individually tested modules are joined into one program and tested to ensure the modules interact
correctly

Alpha Testing
Testing of software in-house by dedicated testers

Acceptance testing
Testing of software by customers before sign- off

Beta testing
Testing of software by a limited number of chosen users before general release

Yasitha Senanayake 0773 891 892


Computer Science STUDY NOTE

Types of maintenance
1. Corrective maintenance – Correcting identified errors
2. Adaptive maintenance – Amending a program to enhance functionality or in response to specification
changes/External environment changers.
3. Perfective maintenance – Modifying a program to improve performance or maintainability.

Types of Errors
1. Syntax errors – an error in which a program statement does not follow the rules of the language.
2. Logic errors – an error in the logic of the solution that causes it not to behave as intended.
3. Run-time error – an error that causes program execution to crash or freeze.

Types of test data


1. Normal Data –Data values that are acceptable , valid
2. Abnarmal Data - Data values that are NOT acceptable , Invalid
3. Boundry (Extream Data) – Data values that are at a boundry or an extream end of the range of
normal data.

Yasitha Senanayake 0773 891 892

You might also like