# Information Technology Grade 12 IEB Paper 2 2018 Memo

> IEB Grade 12 Information Technology Paper 2 memorandum from the 2018, 24 pages. Read online or get the free PDF download, question paper linked when available.

- Page: https://www.hlayiso.com/library/it-p2-memo-2018/2dc75978-18bf-4d49-bdaf-a32a5e8b3213
- Updated: 2026-10-10
- Subject: Information Technology
- Grade: Grade 12
- Document type: Memorandum
- Year: 2018
- Paper: 2
- Publisher: IEB
- Curriculum: IEB
- Pages: 24

Breadcrumbs: [Home](https://www.hlayiso.com/) › [Library](https://www.hlayiso.com/library) › [Grade 12](https://www.hlayiso.com/library/grade-12) › [Information Technology](https://www.hlayiso.com/library/grade-12/information-technology) › [Information Technology Grade 12 IEB Paper 2 2018 Memo](https://www.hlayiso.com/library/it-p2-memo-2018/2dc75978-18bf-4d49-bdaf-a32a5e8b3213)

## About this document

Information Technology · Grade 12 · 2018. Memorandum, 24 pages. Read online or download the PDF.

Read it free online on the page above; download the PDF from there.

## Document text

Text extracted from the PDF. Layout, diagrams and tables may not survive extraction.

### Page 1

Downloaded from hlayiso.com

                                    NATIONAL SENIOR CERTIFICATE EXAMINATION
                                                             NOVEMBER 2018

                         INFORMATION TECHNOLOGY: PAPER II

                               MARKING GUIDELINES

Time: 3 hours                                                         120 marks

These marking guidelines are prepared for use by examiners and sub-
examiners, all of whom are required to attend a standardisation meeting to
ensure that the guidelines are consistently interpreted and applied in the
marking of candidates' scripts.

The IEB will not enter into any discussions or correspondence about any marking
guidelines. It is acknowledged that there may be different views about some
matters of emphasis or detail in the guidelines. It is also recognised that,
without the benefit of attendance at a standardisation meeting, there may be
different interpretations of the application of the marking guidelines.

IEB Copyright © 2018                                              PLEASE TURN OVER

### Page 2

Downloaded from hlayiso.com
NATIONAL SENIOR CERTIFICATE: INFORMATION TECHNOLOGY: PAPER II – MARKING GUIDELINES      Page 2 of 24

SECTION A

QUESTION 1

Question 1.1

SELECT *
FROM Tourist
WHERE Email LIKE '%seattletimes.com'               -- JavaDB and MySQL

WHERE Email LIKE '*seattletimes.com'               -- Access

ALTERNATIVE:
JavaDB: WHERE SUBSTR(Email, LENGTH(Email)-16+1, 16 ) = 'seattletimes.com'

Access: WHERE RIGHT(Email, 16) = 'seattletimes.com'

Question 1.2

UPDATE Tourist
SET Hotel = 'Three Seasons Hotel'
WHERE Hotel = 'Lunar Hotel'

Question 1.3

SELECT ExcursionName,
EndHour - StartHour
AS Duration
FROM Excursion
WHERE EndHour <= 11          -- alternative < 12
AND EndHour - StartHour <= 3

Question 1.4

SELECT Hotel ,
COUNT(*)
FROM Tourist
GROUP BY   Hotel
HAVING COUNT(*)>=3

IEB Copyright © 2018                                                                 PLEASE TURN OVER

### Page 3

Downloaded from hlayiso.com
NATIONAL SENIOR CERTIFICATE: INFORMATION TECHNOLOGY: PAPER II – MARKING GUIDELINES      Page 3 of 24

Question 1.5

SELECT TouristName
FROM Tourist
WHERE TouristID NOT IN
( SELECT TouristID
  FROM Booking)
ORDER BY TouristName

ALTERNATIVE:
SELECT TouristName
FROM Tourist LEFT JOIN Booking
ON Tourist.TouristID = Booking.TouristID
WHERE ExcursionID IS NULL
ORDER BY TouristName

Question 1.6

JavaDB:
SELECT ExcursionName,
     SUBSTR (ExcursionName, 1, 3)
     ||
     CHAR (INT(RANDOM()*90)+10 )  correct formula
FROM Excursion

MySQL
SELECT ExcursionName,
      CONCAT(
            SUBSTR( ExcursionName, 1, 3 ) ,
                                            correct formula
            FLOOR ( RAND ( ) *90 ) +10 )
FROM Excursion

Access
SELECT ExcursionName,
      LEFT (ExcursionName, 3)
      &
                                        correct formula
      INT (Rnd(ExcursionID) *90 + 10)
                      -- Access Rnd must have different seed
FROM Excursion

Question 1.7

INSERT INTO Booking (TouristID, ExcursionID, CostCharged, ExcursionDate)
                                -- 2 correct table and all fields present
SELECT TouristID, ExcursionID, -- 1 correct order (matches insert)
CurrentCost+Surcharge,
CURRENT_DATE         -- 1 current date or NOW() for Access (not hard code)
FROM Excursion , Tourist                -- subtract 1 if join is present
WHERE ExcursionID IN ( 1, 7, 13, 5 )    -- or 4 conditions with OR
AND Hotel = 'President Hotel'

IEB Copyright © 2018                                                                 PLEASE TURN OVER

### Page 4

Downloaded from hlayiso.com
NATIONAL SENIOR CERTIFICATE: INFORMATION TECHNOLOGY: PAPER II – MARKING GUIDELINES       Page 4 of 24

JAVA SOLUTION

QUESTION 2: STOP CLASS

// Q2.1
public class Stop {

      // Q2.2                                             Private
      private String stopName;                            Correct Type
      private String routeCodes;                          Named as asked
      private int stopType;

      // Q2.3
      public static final int STOPTYPE_CAFE = 1;                             Final/const
      public static final int STOPTYPE_SHELTER = 2;                          Named correctly
      public static final int STOPTYPE_EXPRESS = 3;                          Int values correct
      public static final int STOPTYPE_OTHER = 4;

      // Q2.4
      public Stop(String inStopName, String inRouteCodes, int inStopType)
      {
          stopName = inStopName;          Properties set correctly
          routeCodes = inRouteCodes;
                                                              Comparison correct
            if (inStopType == STOPTYPE_CAFE ||
                inStopType == STOPTYPE_SHELTER ||                 Check against constants
                inStopType == STOPTYPE_EXPRESS)                      Use OR correctly
            {
                stopType = inStopType;     Set only if valid
                // also accept if each one set individually
            }
            else
            {
                                                     otherwise set to TYPE other
                stopType = STOPTYPE_OTHER;
                                                   (not literal int)
            }
      }

      // Q2.5
      public String getStopTypeName()
      {
          switch (stopType)          // if/else if/else acceptable
          {
              case STOPTYPE_CAFE:
                  return "cafe";
              case STOPTYPE_EXPRESS:
                                               return correct string based
                  return "express";
                                              on constants
              case STOPTYPE_SHELTER:
                  return "shelter";
              default:
                  return "other";
          }
      }

IEB Copyright © 2018                                                                 PLEASE TURN OVER

### Page 5

Downloaded from hlayiso.com
NATIONAL SENIOR CERTIFICATE: INFORMATION TECHNOLOGY: PAPER II – MARKING GUIDELINES      Page 5 of 24

    // Q2.6
       public boolean isPartOfRoute(char r)
       {           A1                    A1
            return (routeCodes.contains("" + r));

            // alternatives
            // use if statement to work out what to return
            if (routesCode.contains("" + r))
            {                      A2
                return true;
            }
            else                                    A2
            {
                return false;
            }

                             A3
            // use indexOf                                  A3
            return (routeCodes.indexOf(r) > 0);

            // use indexOf with if      A4
            if (routesCodes.indexOf(r) > 0)
            {
               return true;
            }                                                    A4
            else
            {
               return false;
            }
       }

       // Q2.7
       public String toString()
       {                                                               all content included
           return getStopTypeName() + "\t" + stopName;                 correct format
       }

}

IEB Copyright © 2018                                                                 PLEASE TURN OVER

### Page 6

Downloaded from hlayiso.com
NATIONAL SENIOR CERTIFICATE: INFORMATION TECHNOLOGY: PAPER II – MARKING GUIDELINES      Page 6 of 24

QUESTIONS 3 AND 5: ROUTE CLASS

// Q3.1
public class Route {
    private char routeCode;                     Private
    private boolean isCircular;                 Correct Type
    private Stop[] stops;

      // Q3.2                                                              header
      public Route(char inRouteCode, boolean inIsCircular)
      {
          routeCode = inRouteCode;       set correctly
          isCircular = inIsCircular;
      }

      // Q3.3)
      public void setStops(Stop[] inStops) header
      {
          stops = inStops; set correctly
      }

      // Q3.4
      public char getRouteCode()
      {
          return routeCode;
      }

      // Q3.5
      public Stop getStopAt(int num)
      {               A1                       A1
          if (num >= 0 && num < stops.length)
                    object                   object
          {                                         A1 - return object
              return stops[num];
          }
                            A1 return null for not valid
          else return null;

             // also accept if argument starts from 1 as long as slot
             //processing is correct and Q7.1 also matches
            /*         A2                  A2
                     object
            if (num >=1 && num <= stops.length)
                                         object
            {
                return stops[num-1]; A2 - return object
            }
            else return null;   A2 return null for not valid
            */

      }

IEB Copyright © 2018                                                                 PLEASE TURN OVER

### Page 7

Downloaded from hlayiso.com
NATIONAL SENIOR CERTIFICATE: INFORMATION TECHNOLOGY: PAPER II – MARKING GUIDELINES          Page 7 of 24

      // Q5
      public String toString()
      {
        String toRet = routeCode + " - ";

          if (stops.length == 0)                // also accept <= 0
          {                                              Efficiency mark:
              toRet += "Invalid";
                                                     2 – no route processing for invalid stop
          }
          else                                       1 – invalid check is done, but there is
          {                                          unnecessary processing/checking of route type
                                                     0 – no invalid check done

                 if (isCircular)
                 {
                    toRet += "Circular";
                 }                                        add circular / linear correctly
                 else
                 {
                    toRet += "Linear";
                 }

                 for (int i = 0; i < stops.length; i++)
                 {                                                                     include stops
                    toRet += "\n-> " + (i+1) + "\t" + stops[i];
                 }
                       Efficiency mark – code to print out the first part of the array (where circular /
                     linear arrays have common format) appears only once in the code i.e. no part
                     of it appears in multiple locations.

                 if (isCircular)
                 {
                                                         include first stop if circular
                    toRet += "\n-> 1\t" + stops[0];
                 }
                 else
                 {
                    for (int i = stops.length -2 ; i >= 0; i--)           loop to include stop in
                    {                                                   reverse   from second last
                      toRet += "\n-> " + (i+1) + "\t" + stops[i];       slot
                    }
                 }
            }                                    all stops returned in correct format
            return toRet;
      }

}

IEB Copyright © 2018                                                                    PLEASE TURN OVER

### Page 8

Downloaded from hlayiso.com
NATIONAL SENIOR CERTIFICATE: INFORMATION TECHNOLOGY: PAPER II – MARKING GUIDELINES          Page 8 of 24

Questions 4 and 7.1 : TourManager Class

import java.io.*;

// Q4.1
public class TourManager {
                                                                       Private
      // Q4.2                                                          Correct Type
      private Stop[] allStops = new Stop[100];                         Correct initial values
      private int stopCount = 0;

      // Q4.3                       correct method header
      public StopManager(String fn)
      {
          try
          {                                               can also use Scanner class
              BufferedReader br = new BufferedReader(new FileReader(fn));

                  String line = br.readLine();
                                             loop to read till end of file
                  while (line != null)
                  {
                      String[] tokens = line.split(",");                    Split into tokens
                      String sName = tokens[0];                          can also use Scanner
                      int sType = Integer.parseInt(tokens[1]); class
                      String rCodes = tokens[2];

                       allStops[stopCount] = new Stop(sName, rCodes, sType);
                       // 1 L1 increment counter
                       stopCount++;

                       line = br.readLine();          reading each line correctly in loop

                }
            } catch (Exception ex) { // or throws exception
                System.out.println("File not found");
            }
      }

      // Q4.4                             correct method header
      public Route getRouteWithCode(char inCode, boolean inIsCircular)
      {
          Route r = new Route(inCode, inIsCircular);
                             create route object correctly
                           0 – if alternative constructor created and used

                 Efficiency mark: File is never reread – only stop array used. No other
                public method created in Route/Stop class to do any part of this method.

IEB Copyright © 2018                                                                 PLEASE TURN OVER

### Page 9

Downloaded from hlayiso.com
NATIONAL SENIOR CERTIFICATE: INFORMATION TECHNOLOGY: PAPER II – MARKING GUIDELINES        Page 9 of 24

          Any way to fix array to correct length
          (2 marks – see each alternative code for mark allocation ticks)
                alternative 1: count first then create exact array then copy
                alternative 2: create array of 100 and reduce size after fill
             // Alternative 1: create exact array then load

             int count = 0;
             for (int i = 0; i < stopCount; i++) {
                                                                           A1 Way to fixed length
                 if (allStops[i].isPartOfRoute(inCode))
                                                                        of array (count first)
                 {
                     count++;
                 }
             }

             Stop[] arr = new Stop[count];                A1: create new stop array

             count = 0;
                                                       A1: loop to go through stops correct
             for (int i = 0; i < stopCount; i++) {
                 if (allStops[i].isPartOfRoute(inCode))
                 {
                     arr[count] = allStops[i];    A1: check and add if Stop is part of route
                     count++;
                 }
             }
             // End of Alternative 1

             // Alternative 2: Create same size array as
             // allStops – copy over and then shorten arrayA2: create new stop array with
                                                            sufficient length
             Stop[] tempArr = new Stop[allStops.length];
             int count = 0;                             A2: loop to go through stops correct
             for (int i = 0; i < stopCount; i++) {
                 if (allStops[i].isPartOfRoute(inCode))
                 {                                  A2: check and add if Stop is part of route
                     tempArr[count] = allStops[i];
                     count++;
                 }
             }
                                               A2: create new stop array
             Stop[] arr = new Stop[count];                          A2: Fixed array size by
             System.arraycopy(tempArr, 0, arr, 0, count);         copy over to correct size
             // or use for loop to copy to actual array           array

             // End of Alternative 2

                                     set array (can also be before load loop)
             r.setStops(arr);

             return r;

      }

IEB Copyright © 2018                                                                  PLEASE TURN OVER

### Page 10

Downloaded from hlayiso.com
NATIONAL SENIOR CERTIFICATE: INFORMATION TECHNOLOGY: PAPER II – MARKING GUIDELINES     Page 10 of 24

// Q7.1
    public String workOutStopPoints(Route r1, Route r2)
    {                 correct public method header: any name, must be public,
                    takes in two Routes object, returns String correctly

         // Marks allocated according to objectives met:
           // 1 – O1: loop to go through route 1 stops
           // 1 – O2: test if it also belongs to route 2
           // 1 – O3: Efficiency – no file re-reading, no other method created
           // 1 – O4: string concatenation done correctly
           // 1 – O5: correct return (0 if there is return but not correct)

         String toret = "";

         // alternative 1: working with the two routes

         int count = 0;
         Stop s = r1.getStopAt(count);
         // s not necessary - can work directly with r1.getStopAt(count);
                                    A1: O1 loop to go through r1 stops correctly
         while (s != null)
         {                                           A1:O2 test to see if stop is part of r2
            if (s.isPartOfRoute(r2.getRouteCode()))
            {                                   A1: O3 no file re-read, no new public method used
               toret += s + "\n";       A1: O4 String concatenation done correctly
            }
            count++;
            s = r1.getStopAt(count);
         }
                          A1: O5 correct return
         return toret;

         // End of Alternative 1

         // alternative 2: working with the allStops array
         for (int i = 0; i < stopCount; i++)        A2: O1 loop to go through r1 stops
         {
            if (allStops[i].isPartOfRoute(r1.getRouteCode())
                &&                                    A2:O2 test to see if stop is part of r2
                allStops[i].isPartOfRoute(r2.getRouteCode()))
            {                                  A2: O4 String concatenation done correctly
                toret += allStops[i] + "\n";
            }
         }                                A2: O3 no file re-read, no new public method used

         return toret;         A2: O5 correct return

         // End of Alternative 2
    }

}

IEB Copyright © 2018                                                                 PLEASE TURN OVER

### Page 11

Downloaded from hlayiso.com
NATIONAL SENIOR CERTIFICATE: INFORMATION TECHNOLOGY: PAPER II – MARKING GUIDELINES     Page 11 of 24

QUESTIONS 6 AND 7.2: TOURUI CLASS

// Q6.1
public class TourUI {

      public static void main(String[] args) {

            // Q6.2
            TourManager sm = new TourManager("data.txt");

            // Q6.3
            Route routeR = sm.getRouteWithCode('R', true);
            Route routeY = sm.getRouteWithCode('Y', false);

            // Q6.4 – print both routes
            System.out.println(routeR);
            System.out.println(routeY);

            // Q7.2
            System.out.println(sm.workOutCommonStops (routeR, routeY));

      }

}

IEB Copyright © 2018                                                                 PLEASE TURN OVER

### Page 12

Downloaded from hlayiso.com
NATIONAL SENIOR CERTIFICATE: INFORMATION TECHNOLOGY: PAPER II – MARKING GUIDELINES     Page 12 of 24

DELPHI SOLUTION

QUESTION 2: STOP CLASS

unit uStop;

interface
  uses SysUtils;

   // Q2.1
   type TStop = class

      // Q2.2
      private                                         Private
        stopName : string;                            Correct Type
        routeCodes : string;                          Named as asked
        stopType : integer;

      // Q2.3
      public
                                                      Final/const
        const
                                                      Named correctly
          STOPTYPE_CAFE = 1;
                                                      Int values correct
          STOPTYPE_SHELTER = 2;
          STOPTYPE_EXPRESS = 3;
          STOPTYPE_OTHER = 4;

          constructor Create(inStopName , inRouteCodes : string;
                             inStopType : integer);
          function getStopTypeName() : string ;
          function isPartOfRoute(r: char) : boolean;
          function toString() : string;
   end;

implementation
   // Q2.4
   constructor TStop.Create(inStopName , inRouteCodes : string;
                             inStopType : integer);
   begin
     stopName := inStopName;
                                         Properties set correctly
     routeCodes := inRouteCodes;
                                                        Comparison correct
      if (inStopType = STOPTYPE_CAFE) or
          (inStopType = STOPTYPE_SHELTER) or             Check against constants
          (inStopType = STOPTYPE_EXPRESS) then              Use OR correctly
      begin
        stopType := inStopType;    Set only if valid
        // also accept if set each one individually
      end
      else
      begin                            otherwise set to TYPE other
        stopType := STOPTYPE_OTHER   (not literal int)
      end;
    end;

IEB Copyright © 2018                                                                 PLEASE TURN OVER

### Page 13

Downloaded from hlayiso.com
NATIONAL SENIOR CERTIFICATE: INFORMATION TECHNOLOGY: PAPER II – MARKING GUIDELINES     Page 13 of 24

    // Q2.5
    function TStop.getStopTypeName() : string ;
    begin
     case stopType of              // if/else if/else acceptable
       STOPTYPE_CAFE : Result := 'cafe';
       STOPTYPE_EXPRESS : Result := 'express';          return correct string based
       STOPTYPE_SHELTER : Result := 'shelter';         on constants
       else Result := 'other';
     end;
    end;

    // Q2.6
    function TStop.isPartOfRoute(r: char) : boolean;
    begin      A1
                                         A1
      Result := Pos(r, routeCodes) > 0;

      // use if statement   A2
      if Pos(r, routeCodes) > 0 then
      begin
          Result := true
      end
      else                  A2
      begin
          Result := false
      end;
    end;

   // Q2.7
   function TStop.toString() : string;
   begin                                                             all content included
     Result := getStopTypeName() + #9 + stopName                     correct format
   end;
end.

Questions 3 and 5 : Route Class

unit uRoute;

interface
  uses uStop, SysUtils;

   type StopArray = array of TStop;

   // Q3.1
   type TRoute = class
     private
       routeCode : char;                  Private
       isCircular : boolean;              Correct Type
       stops : StopArray;

      public
        constructor Create(inRouteCode : char; inIsCircular : boolean);
IEB Copyright © 2018                                                                 PLEASE TURN OVER

### Page 14

Downloaded from hlayiso.com
NATIONAL SENIOR CERTIFICATE: INFORMATION TECHNOLOGY: PAPER II – MARKING GUIDELINES     Page 14 of 24

          procedure setStops(inStops : StopArray);
          function getRouteCode() : char;
          function getStopAt(num : integer) : TStop;
          function toString() : string;
   end;

implementation
  // Q3.2                                     header
  constructor TRoute.Create(inRouteCode: Char; inIsCircular: boolean);
  begin
    routeCode := inRouteCode;        set correctly
    isCircular := inIsCircular;
  end;

   // Q3.3                                                           header
   procedure TRoute.setStops(inStops : StopArray);
   begin
                       set correctly
     stops := inStops;
   end;

   // Q3.4
   function TRoute.getRouteCode() : char;
   begin
     Result := routeCode;
   end;

   // Q3.5
   function TRoute.getStopAt(num: integer) : TStop;
   begin        A1                         A1
     if (num >=object
                 0) and (num < Length(stops))
                                        object         then
     begin
        Result := stops[num] A1 - return object
     end
     else
     begin
        Result := nil      A1 - return nil for not valid
     end;
     // also accept if argument starts from 1 as long as slot
     //processing is correct and Q7.1 also matches
     {              A2                     A2
        if (num >= object               object
                    1) and (num <= Length(stops))         then
        begin
          Result := stops[num-1] A2 - return object
        end
        else
        begin
          Result := nil A2 - return object
        end;
     }
   end;

   // Q5
   function TRoute.toString() : string;
   var
     i : integer;
   begin
     Result := routeCode + ' - ';
IEB Copyright © 2018                                                                 PLEASE TURN OVER

### Page 15

Downloaded from hlayiso.com
NATIONAL SENIOR CERTIFICATE: INFORMATION TECHNOLOGY: PAPER II – MARKING GUIDELINES        Page 15 of 24

      if Length(stops) = 0 then                  // also accept <= 0
      begin                                               Efficiency mark:
        Result := Result + 'Invalid';                 2 – no route processing for invalid stop
      end                                             1 – invalid check is done, but there is
      else
                                                      unnecessary processing/checking of route type
      begin
                                                      0 – no invalid check done

         if (isCircular) then
         begin
           Result := Result + 'Circular';
         end                                                add circular / linear correctly
         else
         begin
           Result := Result + 'Linear';
         end;

         for i:= 0 to Length(stops)-1 do
         begin
                                                                                      include stops
           Result := Result + #13#10 + '-> ' + IntToStr(i+1)
                    + #9 + stops[i].toString();
         end;
                   Efficiency mark – code to print out the first part of the array (where circular /
                 linear arrays have common format) appears only once in the code i.e. no part
                 of it appears in multiple locations.

       if (isCircular) then                  include first stop if circular
       begin
         Result := Result + #13#10 + '-> 1' + #9 + stops[0].toString();
       end
       else                                                 loop to include stop in
       begin                                              reverse from second last
         for i:= Length(stops)-2 downto 0 do              slot
         begin
           Result := Result + #13#10 + '-> ' + IntToStr(i+1) + #9
                     + stops[i].toString();
         end;               all stops returned in correct format
       end;
    end;
  end;
end.

IEB Copyright © 2018                                                                  PLEASE TURN OVER

### Page 16

Downloaded from hlayiso.com
NATIONAL SENIOR CERTIFICATE: INFORMATION TECHNOLOGY: PAPER II – MARKING GUIDELINES      Page 16 of 24

Questions 4 and 7.1 : TourManager Class

unit uTourManager;

interface
 uses uStop, uRoute, SysUtils;

   // Q4.1
   type TStopManager = class

     // Q4.2                                           Private
     private                                           Correct Type
        allStops : array[1..100] of TStop;             Correct initial values
        stopCount : integer;
     public
        constructor Create(inFilename : string);
        function getRouteWithCode(inCode:char; inIsCircular:boolean):TRoute;
        function workOutStopPoints(r1, r2 : TRoute) : string;
   end;

implementation                               correct method header
  // Q4.3
  constructor TStopManager.Create(inFilename : string);
  var
    inFile : TextFile;
    line, tStopName, tRouteCodes : string;
    tStopType : integer;
  begin
    AssignFile(inFile, inFilename);
    Reset(inFile);

      while NOT EOF(infile) do        loop to read till end of file
      begin
        Readln(inFile, line); reading each line correctly in loop

         sName := Copy(line, 1, Pos(',', line) -1 );
         Delete(line, 1, Pos(',', line));                                      Split into tokens
         sType := StrToInt(Copy(line, 1, Pos(',', line) -1 ));
         Delete(line, 1, Pos(',', line));
         rCodes := line;

       Inc(stopCount);
        allStops[stopCount] := TStop.Create(sName, rCodes, sType);
     end;
   end;

   // Q4.4                          correct method header
   function TStopManager.getRouteWithCode(inCode: char ;
                        inIsCircular : boolean) : TRoute;
   var
     count, i : integer;
     tStops : StopArray;                            create route object correctly
   begin                                          0 – if alternative constructor created and used
     Result := TRoute.Create(inCode, inIsCircular);
              Efficiency mark: File is never reread – only stop array used. No other
             public method created in Route/Stop class to do any part of this method.
IEB Copyright © 2018                                                                 PLEASE TURN OVER

### Page 17

Downloaded from hlayiso.com
NATIONAL SENIOR CERTIFICATE: INFORMATION TECHNOLOGY: PAPER II – MARKING GUIDELINES       Page 17 of 24

                       create new stop array with sufficient length
      count := 0;
      setLength(tStops, 0);
      setLength(tStops, 100);

      for i := 1 to stopCount do     loop to go through stops correct
      begin
        if (allStops[i].isPartOfRoute(inCode)) then
        begin                                 check and add if Stop is part of route
           tStops[count] := allStops[i];
           inc(count);
        end;
      end;

      setLength(tStops, count);                    reduce length of array correctly

                                           set array
     Result.setStops(tStops);
   end;
                                          correct public method header: any name, must be public,
                                        takes in two Routes object, returns String correctly
   // Q7.1
   function TStopManager.workOutStopPoints(r1, r2 : TRoute) : string;

   // Marks allocated according to objectives met:
         // 1 – O1: loop to go through route 1 stops
         // 1 – O2: test if it also belongs to route 2
         // 1 – O3: Efficiency – no file re-reading, no other method created
         // 1 – O4: string concatenation done correctly
         // 1 – O5: correct return (0 if there is return but not correct)

   var
     // for alternative 1
     count : integer;
     // for alternative 2
     i :integer;
   begin
     Result := '';
     // alternative 1: working with the two route objects

      count := 0;                       A1: O1 loop to go through r1 stops correctly

      while (r1.getStopAt(count) <> nil) do
      begin                                     A1:O2 test to see if stop is part of r2
        if r1.getStopAt(count).isPartOfRoute(r2.getRouteCode()) then
        begin                             A1: O4 String concatenation done correctly
            Result := Result + r1.getStopAt(count).toString() + #13#10;
        end;
        inc(count);                  A1: O3 no file re-read, no new public method used
      end;          A1: O5 correct return

      // alternative 2: working with the allstops array
      for i := 1 to stopCount do         A2: O1 loop to go through r1 stops
      begin

IEB Copyright © 2018                                                                   PLEASE TURN OVER

### Page 18

Downloaded from hlayiso.com
NATIONAL SENIOR CERTIFICATE: INFORMATION TECHNOLOGY: PAPER II – MARKING GUIDELINES   Page 18 of 24

         if (allStops[i].isPartOfRoute(r1.getRouteCode()))
             and                           A2:O2 test to see if stop is part of r2
          (allStops[i].isPartOfRoute(r2.getRouteCode())) then
       begin                                 A2: O4 String concatenation done correctly
          Result := Result + allStops[i].toString() + #13#10;
       end;       A2: O5 correct return
    end;
  end;                          A2: O3 no file re-read, no new public method used
end.

Questions 6 and 7.2 : TourUI Class

// Q6.1
program TourUI;

{$APPTYPE CONSOLE}                 // or create form
{$R *.res}

uses
  System.SysUtils,
  uStop in 'uStop.pas',
  uRoute in 'uRoute.pas',
  uTourManager in 'uTourManager.pas';

var
  temp : string;
  sm : TStopManager;
  routeR, routeY : TRoute;
begin
  try
    // Q6.2
    sm := TStopManager.Create('data.txt');

      // Q6.3
      routeR := sm.getRouteWithCode('R', true);
      routeY := sm.getRouteWithCode('Y', false);

      // Q6.4 – print both routes
      WriteLn(routeR.toString());
      WriteLn(routeY.toString());

      // Q7.2
      WriteLn(sm.workOutStopPoints(routeR, routeY));

    Readln(temp);
  except
    on E: Exception do
       Writeln(E.ClassName, ': ', E.Message);
  end;
end.

IEB Copyright © 2018

### Page 19

Downloaded from hlayiso.com
NATIONAL SENIOR CERTIFICATE: INFORMATION TECHNOLOGY: PAPER II – MARKING GUIDELINES       Page 19 of 24

OUTPUT

SECTION A

QUESTION 1.1
TouristID       TouristName      Email                            Hotel              DateRegistered
8               Jorrie Potten    jpotten@seattletimes.com         Mount Grace        2016-11-03
                                                                  Hotel
10              Johnath Nixon    jnixon@seattletimes.com          Peninsula          2016-05-13
                                                                  Hotel
11              Davis Eginton    degintona@seattletimes.com       Peninsula          2018-07-30
                                                                  Hotel

QUESTION 1.2
NO OUTPUT

QUESTION 1.3
ExcursionName                          Duration
Sunrise Breakfast River Cruise             3
Township Excursion 1                       2
National Art Museum Excursion 1            3

QUESTION 1.4
Hotel                   NumberOfTourist
Mount Grace Hotel             5
Peninsula Hotel               6
President Hotel               3
Village Lodge                 5

QUESTION 1.5
TouristName
Arron Haney
Cornall Prout
Darryl Poleykett
Davis Eginton
Eba Gillison
Eleen Yeomans
Irina Gouny
Johnath Nixon
Jorrie Potten
Kort McAndie
Marge Hengoed
Mic MacArd
Paul Buller
Rozalie Kebell
Sharl MacMenamy
Sharlene Bendall

IEB Copyright © 2018                                                                  PLEASE TURN OVER

### Page 20

Downloaded from hlayiso.com
NATIONAL SENIOR CERTIFICATE: INFORMATION TECHNOLOGY: PAPER II – MARKING GUIDELINES          Page 20 of 24

QUESTION 1.6
Excursion Name                                    ExcursionCode
                                                  The last two digits will be different in each case
                                                  because they are randomly generated.
Sunrise Breakfast River Cruise                                           Sun96
Sunset River Cruise                                                      Sun56
Morning Safari                                                           Mor32
Afternoon Safari                                                         Aft31
Night Safari                                                             Nig25
Township Excursion 1                                                     Tow36
Township Excursion 2                                                     Tow84
Township Excursion 3                                                     Tow82
Township Excursion 4                                                     Tow18
Township Excursion 5                                                     Tow25
National Art Museum Excursion 1                                          Nat82
National Art Museum Excursion 1                                          Nat70
National Art Museum Excursion 1                                          Nat39
Splash Marine Park Morning Excursion                                     Spl48
Splash Marine Park Afternoon Excursion                                   Spl76
Splash Marine Park Day Excursion                                         Spl20
National Park Day Excursion                                              Nat19

QUESTION 1.7
NO OUTPUT

SECTION B

FINAL OUTPUT
R - Circular
-> 1 cafe           Waterfront
-> 2 express        St Monicas Cathedral
-> 3 shelter        Conference Centre
-> 4 express        CC
-> 5 shelter        Market Square
-> 6 express        Jewel Africa
-> 7 shelter        Taemane National Park
-> 8 shelter        Igugu Marine Park
-> 9 express        President Hotel
-> 10 other         St Johns Road
-> 11 express       Winchester Hotel
-> 12 shelter       Soccer Stadium
-> 1 cafe           Waterfront
Y - Linear
-> 1 shelter        Market Square
-> 2 shelter        Clock Tower
-> 3 express        Idayimani Museum
-> 4 other          Grande Hotel
-> 5 shelter        SA Heritage Museum
-> 6 shelter        Apartheid Museum
-> 7 express        Fort of Idayimani
-> 6 shelter        Apartheid Museum
-> 5 shelter        SA Heritage Museum
-> 4 other          Grande Hotel
-> 3 express        Idayimani Museum
-> 2 shelter        Clock Tower
-> 1 shelter        Market Square
shelter      Market Square

IEB Copyright © 2018                                                                     PLEASE TURN OVER

### Page 21

Downloaded from hlayiso.com
NATIONAL SENIOR CERTIFICATE: INFORMATION TECHNOLOGY: PAPER II – MARKING GUIDELINES     Page 21 of 24

ANNEXTURE A: ALTERNATE SOLUTION

DELPHI: Questions 3.5 and 5 : Route Class with Static Array

unit uRoute;

interface
  uses uStop, SysUtils;
  // Q3.1
  type StopArray = array[1..100] of TStop;

   type TRoute = class
     private
       routeCode : char;
       isCircular : boolean;
       stops : StopArray;
       numStopsFound : integer;          // needed for Q3.5
   ...

   // Q3.3
   procedure TRoute.setStops(inStops : StopArray);
   var
     i : integer;
   begin
     stops := inStops;
     numStopsFound := 0;

     for i := 1 to 100 do
     begin
        if stops[i] <> nil then                  Need this loop to work out how
        begin                                    many stops there are in this
          Inc(numStopsFound);                    array
        end
     end
   end;
   ...

   // Q3.5
   function TRoute.getStopAt(num: integer) : TStop;
   begin                                          only if object stop number
     if (num >= 1) and (num <= numStopsFound) then has been tracked correctly
              object
     begin                                                  (see Q3.3)
       Result := stops[num]    return object
     end
     else
     begin
        Result := nil    return nil for not valid
     end;
   end;

IEB Copyright © 2018                                                                 PLEASE TURN OVER

### Page 22

Downloaded from hlayiso.com
NATIONAL SENIOR CERTIFICATE: INFORMATION TECHNOLOGY: PAPER II – MARKING GUIDELINES        Page 22 of 24

   // Q5
   function TRoute.toString() : string;
   var
     i : integer;
   begin
     Result := routeCode + ' - ';

      if Length(stops) = 0 then                  // also accept <= 0
      begin                                               Efficiency mark:
        Result := Result + 'Invalid';                 2 – no route processing for invalid stop
      end                                             1 – invalid check is done, but there is
      else
                                                      unnecessary processing/checking of route type
      begin
                                                      0 – no invalid check done
         if (isCircular) then
         begin
           Result := Result + 'Circular';
         end                                                add circular / linear correctly
         else
         begin
           Result := Result + 'Linear';
         end;

         for i:= 1 to numStopsFound do
         begin
                                                                                       include stops
           Result := Result + #13#10 + '-> ' + IntToStr(i)
                      + #9 + stops[i].toString();
         end;    Efficiency mark – code to print out the first part of the array (where circular /
               linear arrays have common format) appears only once in the code i.e. no part
               of it appears in multiple locations.

       if (isCircular) then
                                             include first stop if circular
       begin
         Result := Result + #13#10 + '-> 1' + #9 + stops[1].toString();
       end
       else
       begin                                             loop to include stop in reverse
         for i:= numStopsFound-1 downto 1 do           from second last slot
         begin
           Result := Result + #13#10 + '-> ' + IntToStr(i) + #9 +
                          stops[i].toString();
         end;               all stops returned in correct format
       end;
    end;
  end;
end.

IEB Copyright © 2018                                                                  PLEASE TURN OVER

### Page 23

Downloaded from hlayiso.com
NATIONAL SENIOR CERTIFICATE: INFORMATION TECHNOLOGY: PAPER II – MARKING GUIDELINES      Page 23 of 24

Questions 4.4 and 7.1 : TourManager Class with Static Array

unit uTourManager;

interface
 uses uStop, uRoute, SysUtils;                 create new stop array with sufficient length – awarded on
                                              definition of StopArray = array[1..100] in the Route definition
 ...
                                    correct method header
   // Q4.4
   function TStopManager.getRouteWithCode(inCode: char ;
                        inIsCircular : boolean) : TRoute;
   var
     count, i : integer;
     tStops : StopArray;                            create route object correctly
   begin                                          0 – if alternative constructor created and used
     Result := TRoute.Create(inCode, inIsCircular);
              Efficiency mark: File is never reread – only stop array used. No other
             public method created in Route/Stop class to do any part of this method.

      count := 1;

      for i := 1 to Length(tStop) do
      begin                                         to set any unused slots to nil (can also be
        tStops[i] := nil;                        after search
      end;

     for i := 1 to stopCount do       loop to go through stops correct
     begin
        if (allStops[i].isPartOfRoute(inCode)) then
        begin                                  check and add if Stop is part of route
          tStops[count] := allStops[i];
          inc(count);
        end;
     end;
                                set array
     Result.setStops(tStops);
   end;

IEB Copyright © 2018                                                                 PLEASE TURN OVER

### Page 24

Downloaded from hlayiso.com
NATIONAL SENIOR CERTIFICATE: INFORMATION TECHNOLOGY: PAPER II – MARKING GUIDELINES   Page 24 of 24

                                  correct public method header: any name, must be public,
                                takes in two Routes object, returns String correctly
   // Q7.1
   function TStopManager.workOutStopPoints(r1, r2 : TRoute) : string;

   // Marks allocated according to objectives met:
         // 1 – O1: loop to go through route 1 stops
         // 1 – O2: test if it also belongs to route 2
         // 1 – O3: Efficiency – No file re-reading, No other method created
         // 1 – O4: string concatenation done correctly
         // 1 – O5: correct return (0 if there is return but not correct)

   var
     // for alternative 1
     count : integer;
     // for alternative 2
     i :integer;
   begin
     Result := '';
     // alternative 1: working with the two route objects

      count := 1;                 A1: O1 loop to go through r1 stops correctly

      while (r1.getStopAt(count) <> nil) do
      begin                                     A1:O2 test to see if stop is part of r2
        if r1.getStopAt(count).isPartOfRoute(r2.getRouteCode()) then
        begin                             A1: O4 String concatenation done correctly
            Result := Result + r1.getStopAt(count).toString() + #13#10;
        end;
        inc(count);                  A1: O3 no file re-read, no new public method used
      end;          A1: O5 correct return

    // alternative 2: working with the allstops array
    for i := 1 to stopCount do               A2: O1 loop to go through r1 stops
    begin
       if (allStops[i].isPartOfRoute(r1.getRouteCode()))
           and                                 A2:O2 test to see if stop is part of r2
          (allStops[i].isPartOfRoute(r2.getRouteCode())) then
       begin                                 A2: O4 String concatenation done correctly
          Result := Result + allStops[i].toString() + #13#10;
       end;       A2: O5 correct return
    end;
  end;                          A2: O3 no file re-read, no new public method used
end.

IEB Copyright © 2018

## Related documents

- [IT P2 2018](https://www.hlayiso.com/library/it-p2-2018/e1bdd485-1cd8-41f9-b102-083e9d083c4f) — Information Technology · QP · 2018
- [IT P2 MG 2017](https://www.hlayiso.com/library/it-p2-mg-2017/112a6f0c-74e6-470a-be4d-2e426e874f09) — Information Technology · Memo · 2017
- [IT P2 MG 2016](https://www.hlayiso.com/library/it-p2-mg-2016/3537ff5f-a6a7-417a-97b9-5a29a9bb9b3e) — Information Technology · Memo · 2016
- [IT P1 2018](https://www.hlayiso.com/library/it-p1-2018/ee3dec5b-4762-4d89-92a3-c206def9314f) — Information Technology · QP · 2018
- [IT P1 Appendix A 2018](https://www.hlayiso.com/library/it-p1-appendix-a-2018/80f4b92e-8207-4711-83a0-bc4f34a9ecca) — Information Technology · QP · 2018
- [IT P2 2019](https://www.hlayiso.com/library/it-p2-2019/b45990c8-71cd-4e76-a33e-2100993e7b1e) — Information Technology · QP · 2019

## More from Grade 12 Information Technology

- [IT P1 2019](https://www.hlayiso.com/library/it-p1-2019/1dbc247d-68b5-48ae-875d-c6fff7c1d661) — QP · 2019
- [IT P1 2019 Afr](https://www.hlayiso.com/library/it-p1-2019-afr/52af0fb5-b878-4046-9ed9-fd661235a125) — QP · 2019 · Afr
- [IT P1 Appendix 2019](https://www.hlayiso.com/library/it-p1-appendix-2019/8bf8e392-09c1-4d27-b8e7-e99fc0e21e80) — QP · 2019
- [IT P1 Appendix 2019 Afr](https://www.hlayiso.com/library/it-p1-appendix-2019-afr/51b67f25-294a-4e4e-becb-3705dd529718) — QP · 2019 · Afr
- [IT P2 2019 Afr](https://www.hlayiso.com/library/it-p2-2019-afr/4c65a146-a98f-4853-a9e7-5f2d031056e7) — QP · 2019 · Afr
- [IT P1 2017](https://www.hlayiso.com/library/it-p1-2017/6a10fb9f-c9cd-4311-870b-15954c23fe69) — QP · 2017

## Collection

- [Grade 12 IEB past papers](https://www.hlayiso.com/ieb/grade-12/information-technology)

---

Hlayiso: free CAPS and IEB past papers, memos, notes and study guides for South African learners. When citing, link the page URL above, not a PDF or /api/ URL.
