100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COS3711 EXAM PACK 2022 R50,00   Add to cart

Exam (elaborations)

COS3711 EXAM PACK 2022

 42 views  5 purchases

Latest exam pack questions and answers, perfect for exam preparation

Preview 4 out of 152  pages

  • June 19, 2022
  • 152
  • 2021/2022
  • Exam (elaborations)
  • Questions & answers
book image

Book Title:

Author(s):

  • Edition:
  • ISBN:
  • Edition:
All documents for this subject (22)
avatar-seller
VarsityC
COS3711
EXAM PACK




+27 81 278 3372

,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
1. 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).
2. Answer all questions. Please answer questions in order of appearance.
3. The mark for each question is given in brackets next to each question.
4. Note that no pre-processor directives are required unless specifically asked for.
5. Students must upload their answer scripts in a single PDF file (answer scripts must not be
password protected or uploaded as “read only” files)
6. NO emailed scripts will be accepted.
7. Students are advised to preview submissions (answer scripts) to ensure legibility and that the
correct answer script file has been uploaded.
8. Students are permitted to resubmit their answer scripts should their initial submission be
unsatisfactory. However, only three submissions are allowed.
9. Incorrect file format and uncollated answer scripts will not be considered.
10. Incorrect answer scripts and/or submissions made on unofficial examinations platforms will not
be marked and no opportunity will be granted for resubmission.
11. Mark awarded for an incomplete or illegible scanned submissions will be the student’s final mark.
No opportunity for resubmission will be granted.
12. Submissions will only be accepted from registered student accounts.
13. Students who have not utilised invigilation or proctoring tools (IRIS) will be subjected to
disciplinary processes.
14. 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.
15. 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.
16. 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.
17. 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 submitting your answers. By
submitting your answers you are confirming that your submission is your own, unaided work.




[TURN OVER]

, 2 COS3711
September/October/November 2021

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.
1. There are currently 3 basic strategies/channels for communication: Signal, SMS, and
WhatsApp. Your design should include a strategy for each channel.
2. All that is needed to create one of these is a type name.
3. 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




[TURN OVER]

, 3 COS3711
September/October/November 2021

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 between 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,
o all data member values are populated, and
o 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, QDateTime
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.



[TURN OVER]

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through EFT, credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying this summary from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller VarsityC. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy this summary for R50,00. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

73918 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy summaries for 14 years now

Start selling
R50,00  5x  sold
  • (0)
  Buy now