讲解COMP 1531、辅导blue-print、讲解Python语言、Python设计辅导

- 首页 >> Python编程

Name: _______________________________

Student ID:________________________________

Signature:________________________________

SEMESTER 2, 2018 EXAMINATIONS

COMP 1531

SOFTWARE ENGINEERING FUNDAMENTALS

(SAMPLE - PAPER)

1. TIME ALLOWED – 3 HOURS

2. READING TIME – 10 MINUTES

3. TOTAL NUMBER OF QUESTIONS – PART A (10), PART B (30), PART C (60)

4. ANSWER ALL QUESTIONS

5. TOTAL MARKS AVAILABLE – 100

6. MARKS AVAILABLE FOR EACH QUESTION ARE SHOWN IN THE EXAMINATION PAPER

7. NO MATERIALS MAY BE TAKEN INTO THE EXAMINATION ROOM

ALL ANSWERS MUST BE PROVIDED ONLINE EXCEPT WHERE THEY ARE EXPRESSLY REQUIRED

TO BE DONE IN A SEPARATE SHEET OF PAPER. PENCILS MAY BE USED ONLY FOR DRAWING,

SKETCHING OR GRAPHICAL WORK

Page 2

PART A (Multiple Choice) – 10 marks

NOTE: ANSWER THE QUESTIONS IN THIS SECTION BY BLACKENING THE CORRESPONDING

SQUARE ON THE MULTIPLE-CHOICE SHEET SUPPLIED WITH PENCIL. EACH QUESTION IS

WORTH 1 MARK. EACH QUESTION HAS ONLY ONE CORRECT RESPONSE.

1. Which of the following is not true in relation classes and objects?

a. Two object instances from the same class share the same properties, behaviour and

object identity

b. Objects have state but classes don’t

c. An object is said to be instantiated from a class as an instance of the class

d. A class is a blue-print to logically group objects that share the same semantics,

properties and behaviour from which an object is created

e. An object is allocated memory when it is created, but a class is not allocated memory

when it is created.

2. Choose the correct response for the following statement.

___________ is not a valid practice to ensure high quality in XP projects

a. pair programming, where the roles of the partners change frequently

b. simple design and refactoring of code

c. open work space

d. test-driven development

f. long cycles of development

3. Which of the following is true about software design?

a. Low coupling occurs when one module A depends on the internal workings of another

module B and is affected by internal changes to module B

b. Coupling is defined as the the degree to which all elements of a component or class

work together as a functional unit

c. High cohesive classes are easier to maintain

d. Good software design aims for building a system with high coupling, low cohesiveness

e. Low coupling leads to eventual software rot

4. Choose the incorrect statement.

a. Assertions should be used for checking pre-conditions, post-conditions and programinvariants

b. Assertions should be used for validating user-provided input

c. Assertions can be turned off globally in production to optimise code

d. The code snippet below is an incorrect use of asserts in Python

if not isinstance(x, int):

Page 3

raise AssertionError("not an int")

e. Asserts are useful to check the correctness of your code

5. Which of the following statements is incorrect about Single Responsibility Principle

(SRP)?

a. Business context is the driving force to coining SRP

b. SRP implies just do “one” thing

c. The objective of SRP is to achieve low coupling and high cohesion

d. In the context of SRP, a responsibility is defined as a reason for change

e. Every class should have only one responsibility

Page 4

Part B (Short Answer) – 15 marks

Question 1 (6 marks)

In the context of software development life-cycle, different methodologies can be used to

develop software applications. Identify and describe THREE differences between traditional

Waterfall and Agile software development methodologies

Question 2 (6 marks)

(a) An application is required to perform a variety of tasks of varying complexity on a data

stream in parallel. Suggest a suitable architecture for this application and why (3 marks)

(b) (3 marks)

Name the architectural style used in each of the following applications

a. Real-time updates on stock prices, weather updates, sporting results

b. Traditionally, the updates for any Windows device were delivered directly from

Microsoft's Windows Update servers. While this is the most secure way of getting untampered

files, it's not the fastest delivery method that you can use. Windows 10

computers and devices can connect to each other and get updates not only from

Microsoft’s dedicated servers, but also from other Windows 10 devices that have

already downloaded parts of the updates.

c. A radio station where people tune into their favourite programs

d. Amazon web services

e. ls marks | grep student_id

f. Napster

Question 3 (6 marks)

(a) Convert the following ER design fragments into a relational data model expressed as

a box-and-arrow diagram:

Page 5

(b) The following two ER diagrams give alternate design choices for depicting Person and

their addresses, one with Address as an attribute, the other with Address as an entity.

Assume we have another entity type ElectricCompany. Only one of these companies

supply power to each home address. Which ER representation is suitable and why? (

3 marks)

Page 6

Part C – 50 marks

Question 1 (15 marks)

Consider the following requirement for a field user-name: “the length of the user-name >=1

and <=25 and not contain a space”.

(a) Design a function validate_user_name() that takes in as input a user-name and

performs the above validation. If the validation fails, the function should throw a userdefined

exception, “UserInputError”. The skeleton code for this function is provided

here. Complete the function and add the user-defined exception to be raised in the

event of an invalid user input

(b) Identify the equivalence classes of inputs for testing the above function and list the

corresponding test-cases

(c) Implement the test-cases above using pytest.

Question 2 (15 marks)

(a) (2 marks)

Provide an example of a static UML diagram and why is this diagram said to be static?

(b) (2 marks)

In the context of a UML class diagram, describe the meaning of a composition relationship

between two classes and give an example.

Read the following case-study and answer questions (c) and (d).

A car washing company, Mega Car Wash, offers car washing services to customers. The

company has requested you to design a job management system that stores information of

the customers’ car washing jobs and notifies the user once the job for the user has been

completed. The job management system should be able to cater for the following

requirements:

1. The system must maintain a list of current jobs

2. For each job, the system should store an id, date and customer information.

3. Customer information should include the customer’s name and contact details.

4. After a job is completed:

the system must delete the job from its list of current jobs

the system must notify the customer through the contact details provided. A customer

can choose to receive the notification through an Email or SMS.

5. The system can add a job or delete an existing job.

6. The system can obtain details of a job, including its id, date and customer information.

(c) (6 marks)

Page 7

Draw a conceptual UML class diagram of the car wash system. The conceptual class

diagram needs to show class names, relationships, attributes and methods.

(d) (15 marks)

Map the class diagram to Python classes with their corresponding attributes and methods.

Implement the constructor for each class to be able to instantiate an appropriate object

instance. For all the other methods, you do not need to provide an implementation; only

the method signature needs to be defined. The implemented classes must conform to

OCP design principles.

END OF EXAM PAPER


站长地图