UNIVERSITY EXAMINATIONS

EXAM ELABORATIONS Sep 3, 2025
Loading...

Loading document viewer...

Page 0 of 0

Document Text

COS3711

EXAM PACK

+27 81 278 3372 1 / 4

[TURN OVER]

UNIVERSITY EXAMINATIONS

September/October/November 2021

COS3711

Advanced Programming

80 Marks

Duration 2 Hours

EXAMINERS:

FIRST: DR CL PILKINGTON

SECOND: MR K HALLAND

EXTERNAL: DR L MARSHALL (UNIVERSITY OF PRETORIA)

This paper consists of 5 pages.Instructions

  • You may type your answers in a word processor (and then print to PDF for submission) or
  • handwrite your answers (and then scan to PDF).

  • Answer all questions. Please answer questions in order of appearance.
  • The mark for each question is given in brackets next to each question.
  • Note that no pre-processor directives are required unless specifically asked for.
  • Students must upload their answer scripts in a single PDF file (answer scripts must not be
  • password protected or uploaded as “read only” files)

  • NO emailed scripts will be accepted.
  • Students are advised to preview submissions (answer scripts) to ensure legibility and that the
  • correct answer script file has been uploaded.

  • Students are permitted to resubmit their answer scripts should their initial submission be
  • unsatisfactory. However, only three submissions are allowed.

  • Incorrect file format and uncollated answer scripts will not be considered.
  • Incorrect answer scripts and/or submissions made on unofficial examinations platforms will not
  • be marked and no opportunity will be granted for resubmission.

  • Mark awarded for an incomplete or illegible scanned submissions will be the student’s final mark.
  • No opportunity for resubmission will be granted.

  • Submissions will only be accepted from registered student accounts.
  • Students who have not utilised invigilation or proctoring tools (IRIS) will be subjected to
  • disciplinary processes.

  • Students suspected of dishonest conduct during the examinations will be subjected to
  • disciplinary processes. UNISA has a zero tolerance for plagiarism and/or any other forms of academic dishonesty.

  • Students are provided one hour to submit their answer scripts after the official examination time.
  • Submissions made after the official examination time will be rejected by the examination regulations and will not be marked.

  • Students experiencing network or load shedding problems are advised to apply, together with
  • supporting evidence, for an aegrotat within 3 days of the examination session.

  • Students experiencing technical problems should contact the SCSC on 080 000 1870 or email
  • Examenquiries@unisa.ac.za or refer to Get-Help for the list of additional contact numbers.Communication received from your myLife account will be considered.Remember to complete the Honesty Declaration when s ubmitting your answers. By submitting your answers you are confirming that your submission is your own, unaided work.

  • / 4

2 COS3711

September/October/November 2021

[TURN OVER]

All businesses need to manage their communication, and the simplified scenario used in this examination is based on communication strategies. The idea is that a user can select a type of communication channel and have a message sent out on that channel at some specific point in time. The application itself allows the user to set up the required options and just the strategy and message will be displayed for the purposes of a brief history of messages sent – See Figure 1.

Figure 1. App window.

Question 1 [15 marks]

Apply the strategy design pattern to the scenario above that would also adhere to the following requirements.

  • There are currently 3 basic strategies/channels for communication: Signal, SMS, and
  • WhatsApp. Your design should include a strategy for each channel.

  • All that is needed to create one of these is a type name.
  • Once an appropriate type has been created, a setUp() function would be used to populate
  • object instance data members, and the communicate() function used to process the required communication.

A CommunicationStrategy UML class diagram has already been drawn up – see Figure 2.Note that you may abbreviate this class name to ComStrat in your answers.

Figure 2. UML class diagram

  • / 4

3 COS3711

September/October/November 2021

[TURN OVER]

1.1 Considering the scenario given and design decisions listed above, draw a UML class diagram for the strategy pattern. You should include the necessary classes, class attributes, class constructors and operations, and class relationships to make it clear you understand how data will be managed and passed betw een classes. Label all relationships indicated; however, you do not have to include the Client/GUI class nor indicate access specifiers.[You may use a software tool to create the UML class diagram. If you are hand drawing this answer, you can use an underline to indicate italics in the UML class diagram.] (11)

1.2 The provided UML class diagram included some of the text in italics. What does this indicate? (1)

1.3 Describe what the function of the communicate() function would be in this design pattern? (2)

1.4 The decision has been taken to initially host this application using cloud computing.Would you recommend a public or private cloud model? (1)

Question 2 [33 marks]

This question relates to the code for creating and setting up of the required strategies.

The setUp() function in the CommunicationStrategy class (see Figure 2) is used to populate the data members in an instance object. This function does the following.• It first checks that the user code meets a particular pattern.• If the user code does not meet requirements, the function returns false. If the user code does, the function returns true.• Additionally, if the user code meets requirements,

  • all data member values are populated, and
  • a signal (created()) is emitted that sends the communication strategy type and the
  • message (separate by a colon) as a QString. See the viewing window in Figure 1.

2.1 Write the code for the class definition for the CommunicationStrategy class (that is, what would be in the header file). Ensure that all functionality shown in Figure 2 and that given above is included. (7)

2.2 Write the regular expression that can be used to check whether a string meets the

following requirements:

• The first character should be a G, K, or W (for Gauteng, KwaZulu-Natal and Western Cape).• The second character could be any uppercase alphabetic character.• This should be followed by one or more lowercase alphabetic characters or digits.• The final character should be the same as the first character. (6)

2.3 Write the code for bool CommunicationStrategy::setUp(QString uc, QDate Time dt, QString m) . Use the information you have so far in this question to guide you, where the regular expression in 2.2 will be used to check the user code.

  • / 4

Download Document

Buy This Document

$30.00 One-time purchase
Buy Now
  • Full access to this document
  • Download anytime
  • No expiration

Document Information

Category: EXAM ELABORATIONS
Added: Sep 3, 2025
Description:

COS3711 EXAM PACK +27 81 278 3372 [TURN OVER] UNIVERSITY EXAMINATIONS September/October/November 2021 COS3711 Advanced Programming 80 Marks Duration 2 Hours EXAMINERS: FIRST: DR CL PILKINGTON SECON...

Get this document $30.00