Sunday, September 19, 2021

A1 Introduction to Information Processing A2. Data Organisation and Data Control

 A1. Introduction to Information Processing

 

Learning Outcomes:

  • Define Information Age and discuss the importance of information literacy in a knowledge-based society.
    • How the development of technologies leads to the emergence of the Information Age, and how information can be flexibly and analytically converted into knowledge in modern society should be discussed

 

Information age

 

Large amount of information available in the internet.

Individuals have instant access to information.

Information can be flexibly and analytically converted into knowledge.

è Knowledge-based society

 

References:

https://www.igi-global.com/dictionary/information-age/14305

 

A2. Data Organisation and Data Control

 

Learning Outcomes:

  • Identify data, records, fields, files and databases in the hierarchical organisation of data.
  • Explain how records can be organised, stored and retrieved. State the advantages, disadvantages and applications of the two types of file access: direct access and sequential access.
  • Discuss the needs of data control.
  • Describe how errors can be detected by using validation and parity checking, and prevented by verification and validation

 

File organisation

  • Organize by name or date with good folder structure.

 

File access

  • Sequential access: e.g. magnetic tape. Data access starts from the beginning until the required information is found or till the end. Used for backup purpose as fast data access not important.
  • Direct access: e.g. Hard disk. Data access is almost instant. No need to start searching from the beginning.

 

Error

  • Error detection
    • Validation: see below
    • Parity check: parity bit added to a data. E.g. 1100001, a parity bit can be added such that the sum of all digits are even number. i.e. 11000011
  • Error prevention
    • Validation: see below, data rejected will not be used
    • Verification: check if the data entered is the same as the source document e.g. double entry (such as enter password twice), check by another person

  • Data Validation
    • Check whether the input data follows the pre-set rules. E.g. data type, range of integers allowed, format of the string, range of the date entered, parity check. Users will usually be prompted to re-enter the data that confines to the rules.

 

Relevant past paper:

DSE ICT Paper 1B(SP-2017): SP 5bi. PP 5a. 2014 1a. 2015 2aii, 5dii. 2016 1d. 2017 4b.

 

References:

https://www.microsoft.com/en-us/microsoft-365/business-insights-ideas/resources/11-ideas-for-how-to-organize-digital-files

https://www.ictlounge.com/html/serial_and_direct_data_access.htm

https://www.safe.com/what-is/data-validation/

https://www.precisely.com/blog/data-quality/data-validation-vs-data-verification

https://teachcomputerscience.com/verification/

Wednesday, September 8, 2021

Comprehesion-type questions

 Comprehesion-type questions

 

Learning Outcomes:

  • Represent algorithms with flowcharts or block diagrams.
  • Apply algorithms of counting, accumulating, swapping, searching, sorting and merging in writing programs.
    • The search algorithms included are linear search and binary search.
  • Construct lists, stacks and queues in terms of arrays.
    • Students should be able to create and manipulate linear linked lists, stacks and queues in terms of arrays.
  • Realise the importance of good programming styles.
    • Students should develop the habit of using meaningful variable names, comments, annotations, space and indentation.
  • Design sets of test data for program testing.
    • Test data for boundary cases has been discussed in the Compulsory Part.

 

Follow a flowchart

Relevant past paper:

DSE ICT Elect B(SP-2017):  2014 1b.

 

Searching

Linear/sequential search: check the items one by one. E.g. for data structure such as queue and linked list.

Binary search:  for data sorted in an array.

 

Relevant past paper:

DSE ICT Elect B(SP-2017):  2017 4dii,e.

 

Linked lists, stacks, queues

  • Linked lists: need to find an item by linear search. More flexible to add or remove an item.
  • Queues: first-in-first-out. Need to use head and tail indicator.
  • Stacks: last-in-first-out.

All data structure can have underflow errors/overflow errors if attempts to add items to a full list or to remove items from empty list.

 

Relevant past paper:

DSE ICT Elect B(SP-2017):  SP 2de. PP 2ab. 2012 2a. 2014 1ci,3. 2016 2ac. 2017 3ab.

CE CIT Elect A(2005-2011): 2005 4. 2006 4. 2008 2ab. 2009 3abce. 2010 1a. 2011 3a-d.

 

Good programming styles

  • Use of meaningful variable names, comments, annotations, space and indentation.
  • Use of constant: easy to change the value for use in other programs.

 

Relevant past paper:

DSE ICT Elect B(SP-2017):  2012 3b.

 

Test data

Useful set of test data should include:

  • Valid data: normal data and extreme case
  • Invalid data

 

Relevant past paper:

DSE ICT Elect B(SP-2017):  PP 3e. 2013 2e.

CE CIT Elect A(2005-2011): 2006 1c.

 

Manipulate arrays

Relevant past paper:

DSE ICT Elect B(SP-2017):  2014 2abci. 2015 3abii,iii.

 

Other questions

Relevant past paper:

DSE ICT Elect B(SP-2017):  SP 2a. 2013 4ab. 2015 4bc. 2016 3avd. 2017 4aci,di.

Monday, August 16, 2021

Pseudocode

Pseudocode

 

You may be required to write an algorithm using pseudocode or to interpret an algorithm written in pseudocode.

 

In general, a pseudocode is similar to program written in Pascal. So there is no need to ‘learn’ how to write if you know how to write in Pascal.


Some tips:

 

Pascal

Pseudocode

Loop

For i := 1 to n do

For i from 1 to n do

Assign

n := 1

n ß 1

Return a result from a function Sample

sample := true

Return true

Display on the screen

Writeln (a)

Display a

 

Relevant past paper:

Write pseudocode

DSE ICT Elect B(SP-2017):  PP 1ai. 2013 1biii. 2014 2cii. 2015 3bi,c,4d. 2016 2b,d,3b,4b. 2017 1bii, 4b,cii.

CE CIT Elect A(2005-2011): 2008 2c. 2009 3d. 2010 1bii,c. 2011 1bc,3eii.

 

Comprehension

DSE ICT Elect B(SP-2017):  SP 1. PP 1ab. 2012 1ab, 4b. 2013 1,2,3dii,iii. 2014 4ab. 2015 1abci,ii. 2016 1c,4a. 2017 2a-d.

CE CIT Elect A(2005-2011): 2007 1. 2010 1bi. 2011 1ad, 3ei.

Monday, August 2, 2021

Programming – Pascal: Essential skills 8

Programming – Pascal: Essential skills 8

Other commands

 

Random()

 

To generate different random numbers when the same program is run, use the command randomize.

Random(100) generates a number with a possible range of 0 – 99.

var

                a : integer;

begin

randomize;                         (* when the same program is run again, a different set of random number is generated *)

a := Random(100) + 1      (* possible values of a = 1-100 *)

end;

 

Trunc()

 

The function trunc() changes a real number into an integer by simply removing the decimal part.

e.g. trunc(2.99) becomes 2

 

Multiple select: case … of

 

Instead of using multiple if… statements, we can better organize the program by using case … of.

var

                a : integer;

being

                case a of

                                1..3 : writeln (‘less than 4’);

                                4..6 : writeln (‘between 4 and 6’);

                                7..9 : writeln (‘between 7 and 9’)

                else

                                Writeln (‘out of range’)

                end

end;


 

Relevant past paper:

DSE ICT Elect B(SP-2017):  2013 3di.

CE CIT Elect A(2005-2011): 2007 3ab. 2009 1ad, 4bi. 2010 3bcd.

Sunday, July 11, 2021

Programming – Pascal: Essential skills 7

 Programming – Pascal: Essential skills 7


Learning Outcomes:

  • Construct lists, stacks and queues in terms of arrays.
    • Students should be able to create and manipulate linear linked lists, stacks and queues in terms of arrays.

 

Data structure - Queue

 

Features of a queue:

  • First-in-first-out i.e. moving an item can only be from the front(head) and adding an item can only be to the end(tail).

A queue represented by an array:

  • Inconvenient to move every items forward when first item is removed. Pointers are used to represent the head and tail positions. I.e. head pointer moves to next location when first item is removed.
  • When more and more items are added and removed from the queue, the tail pointer reaches the end of the array. In order to fully utilize the array, the tail pointer move to the first position of the array for the queue to continue. In this way, the array is analogous to a circular array.
  • The queue size is limited by the size of the array.

 

One of the way to implement a queue:

var

                queue : array[0..2] of string;       (* array with 3 slots *)

                head, tail : integer;

begin

head := 0;

tail := 0;                (* when head = tail, queue is empty *)

                …

 

 

head = 0

head = 1

head = 2

Size of of the queue

head

tail

head

tail

head

tail

0

0

0

1

1

2

2

1

0

1

1

2

2

0

2

0

2

1

0

2

1

3

0

0 (3 mod 3)

1

1

2

2

 

Two ways to handle a ‘full’ array

  1. Use a counter to count the number of items in the queue. So even head = tail, we know the queue is not empty as counted by counter. (max number in the queue is 3)
  2. Avoid filling up the array. I.e. avoid the situation of head = tail when the queue is not empty. (max number in the queue is 2)

 

Relevant past paper:

DSE ICT Elect B(SP-2017):  2014 1cii,iii,d.

Friday, July 9, 2021

Programming – Pascal: Essential skills 6

 Programming – Pascal: Essential skills 6

 

Learning Outcomes:

  • Implement parameters passing in manipulating sub-programs.
    • The sub-programs are called by two parameters passing methods: call by value and call by reference.

  

Call-by-value/Call-by-reference

 

When using procedure or function, parameters may be passed into the called procedure / function. The original parameters may or may not be affected depending on call-by-value or call-by-reference.

 

Call-by-value:

var

                x, y : integer;      (* global variables *)

               

procedure add (a, b : integer);    (* a and b have their own memory address *)

begin

                a := a + 1;

                b := b + 1;

                write (a+b)

end;

 

begin

                x := 1;

                y := 2;

                add (x, y);            (* the use of this procedure does NOT affect the  value of x and y *)

                write (x + y)

end.

 

Output: 53

 

Call-by-reference:

(the only difference from the program above is the var in the procedure heading)

var

                x, y : integer;      (* global variables *)

               

procedure add (var a, b : integer);             (* a and b uses the memory address of x and y *)

begin

                a := a + 1;             (* x is now 2 *)

                b := b + 1;            (* y is now 3 *)

                write (a+b)

end;

 

begin

                x := 1;

                y := 2;

                add (x, y);            (* the use of this procedure AFFECTS the values of x and y *)

                write (x + y)

end.

Output: 55

 

Procedure and function

While a procedure is a subprogram which is quite similar to a usual program (see above), a function always returns a single result.

 

Procedure:

procedure add (a, b : integer);

…

 

Function:

function add (a, b : integer) : integer;

…

Having the extra part (: integer), it means this function is going to return an integer when called.

 

var

                x, y, sum : integer;

 

function add (a, b : integer) : integer;

begin

                add := a + b

end;

 

begin

                x := 1;

                y := 2;

                sum := add (x, y);              (* similar to using a built-in function *)

                write (sum)

end.

Output: 3

 

You can use call-by value or call-by-reference when using functions depending on the purposes of the function / program.

 

Relevant past paper:

DSE ICT Elect B(SP-2017): SP 3d. PP 3a-d. 2012 3ac, 4ai.

CE CIT Elect A(2005-2011): 2009 4bii,iii.


Sunday, June 27, 2021

Programming – Pascal: Essential skills 5

 Programming – Pascal: Essential skills 5

 

Learning Outcomes:

  • Manipulate text files through filehandling statements.
    • The manipulation involves file updating statements to delete, insert, append and amend records.
       

Text file handling


Read from file

var

                infile : text;         (* text file variable *)

                a : integer;

begin

                assign (infile, ‘yourfile.txt’);         (* step 1: associate the file with the variable *)

                reset (infile);                                      (* step 2: read from beginning *)

                while not eof (infile) do

                begin

                                readln (infile, a);                (* step 3: read the integer and put into a *)

                                writeln (a)                           (* write the content on the screen *)

                end;

                close (infile)                                         (* step 4: close the file properly *)

end;

 

 

Write into file

var

                infile : text;         (* text file variable *)

                a : integer;

begin

                assign (infile, ‘yourfile.txt’);         (* step 1: associate the file with the variable *)

                rewrite (infile);                                 (* step 2: create or erase the file for writing*)

                a := 1;

                writeln (infile, a);                               (* step 3: put the integer into the file *)

                close (infile)                                         (* step 4: close the file properly *)

end;

 

Relevant past paper:

DSE ICT Elect B(SP-2017):  PP 4cd. 2012 4aii.

CE CIT Elect A(2005-2011): 2005 2a. 2009 2abi. 2010 4a. 2011 4cd.

Syllabus comparison

 Syllabus comparison   DSE ICT 2025 New syllabus DSE ICT 2012-2024 CE CIT 2005-2011 CE CS 1994-2004 ...