Uploaded by abdullah sajjad

2017287 final

advertisement
GIK Institute of Engineering Sciences and Technology, Topi
Spring 2020 (FCSE) Final
10th July 2020, 10:00 am – 01:00 pm
Course Code: CS 325
Course Name: Software Engineering
Instructor Name : Engr. Ahsan Shah
Student Name: Muhammad Kashif






Registration No: 2017287
Read each question completely before answering it.
In case of any ambiguity, you may make assumption. But your assumption should not contradict any
statement in the question paper.
This is open book exam.
Write the answer in the space below each question.
Section 3 will be evaluated against CLO1/PLO4
As the exam is online, I am expecting your responses on the same file as provided to you.
Time: 180 minutes.
Max Marks: 110 points
Section 1 (Objectives) [1 point each]
Will be conducted online in interactive session on MS team on 10th July, 2020 at 10:00 AM
(30 Marks)
Section 2 (Short Questions) [5 points each]
1. Most of the time sequence diagrams are just depicting the actual working of code, so why not we
just code up the algorithms? State solid reason for the sequence diagram modeling for any
software or program.
Sequence diagram is basically the part of interaction modeling, in which we are modeling the sequence of
interactions that take place during a particular use case. Sequence diagrams show the dynamic behavior of the
system describing the interactions between objects; when the system will perform its functionalities, how different
objects will interact with each other and what will be the sequence of those interactions. Development team
consists of many people, sequence diagrams are necessary so that development team can focus on just the
development part, rather than wasting time in the discussion that how the system will achieve the functionality
and how different objects will interact with each other. Sequence diagrams can be used in the testing of the
system functionalities. Sequence diagrams are important not only for developers but may also be used to
document how objects communicate in an existing system. This type of documentation is very useful when
moving a system to another organization or person.
2. In software engineering structural modeling is mostly done using the class diagram, state two
aspects of any system that are not covered up using the UML class diagram.
Firstly, Class diagrams focus on the static view of the system. Static models describe the structure of the system
in terms of object classes and relationships but no processing is shown in static models. Class diagrams doesn’t
show dynamic behavior of the system i.e. when system will perform its functionalities how different objects will
interact with each other and what will be the sequence of those interactions. Secondly, class diagrams don’t
explain the changes in state of a system i.e. how the system will respond to the external or internal events.
3. There is rule of thumb in software engineering that whenever you add people to any of the project at any
later stage, it will delay the delivery of your software. State at least two reasons on the mentioned
statement.
When new people are added to the ongoing project in later stage, it will delay the delivery of the software, since
they have to be introduced to the current situation of the project and they have to understand the structure of
project. In case of developers they have to understand the whole code base. Depending on the number of people
you add to the project, more people you add more time has to be spent to make them useful for the project. Also
in order to facilitate new people you’ll require people that are already working on the project to help them
understand the current situation of the project.
4. The concept of Test Driven Development is that you are writing test concurrently with development? State
two risks, when you are writing test after the completion of your product rather than using TDD.
The advantage of TDD is that your every code segment has at least one associated test, so all code written has
at least tested once. The first risk when you’re writing tests after the completion of the product is that there is still
a chance of skipping some code segments that hasn’t tested at least once. The second risk is that when you’re
testing after the completion of your product then there is a possibility that one error will mask the other errors. In
case of TDD you’re implementing the functionality after writing the tests, so you can’t ignore any errors. Also
testing after completion can be expensive in case when there are errors in some components and fixing those
errors will affect numerous other components.
5. We have the following use case diagram for Automated Teller Machine (ATM) followed by series of queries.
You have to sort out whether each query is true or false.
a. Transaction is super class to Withdrawal, Deposit and Invalid PIN.
False
b. There notation used to represent relationship between Transaction and Invalid PIN is
according to UML standards.
False
6. Give some solid reason that why we compare the dynamic behavior of any system to its
specification.
We should check that the software should conform to its specifications and the requirements of the
software are matching with the behavior of the software. Dynamic behavior is basically how system will
perform its functionalities and how the objects will interact with each other. So the reason why we
compare the dynamic behavior of the system to its specification is to check whether end behavior of
our system is matching the specifications or not.
7. Objects that are tangible are usually prone to wear and tear. Maintenance in those object is
required in case of wear and tear. Suppose there is software having no bugs in it, what is the
most important cause that required maintenance in such software?
As long as software is being used, it is continually changing and never stated as finished. Software
maintenance is always required for software not just to fix the bugs but there are several other
reasons maintenance is required for. Suppose there is software having no bugs in it, but it’ll still need
maintenance, e.g. maintenance is required in order to adapt to the environmental changes or the
changes in operating systems that’ll affect the functionality of your system. Maintenance may be
required while enhancing features to satisfy user needs.
8. In your opinion whether agile software development process support architecture/design phase or
contradict. In both cases you need to have solid reasons to defend your opinion.
In my opinion, Agile software development process support architecture/design phase because of two
main reasons. Firstly, in agile we are mostly dependent on the refactoring of the system, and
refactoring the whole system architecture is expensive because it affects many components of the
system and it is possible that refactoring process affects those components which we have already
developed and tested in first iteration. Secondly, the agile team may be distributed and there may be
less communications between them, so in order to bring them on the same page, architecture/design
phase is necessary. In that case, agile team will have the structure of the system and they will spend
most of their time in development rather than wasting their time in discussions.
Section 3 (Long Questions) [8 marks each]
1. Consider the following functionality of an online book shop:
Customers can search for books by Title and Category (some examples of categories are: Academia,
Novel, and History). On finding a product they need, they can add that book to their online cart for shopping.
Login is required for previous explained operation, and if they don’t have an account, first they have to
create an account to proceed further. The compulsory requirement of account is to have user name and
password but optionally they can add address and credit card information. The information of credit card
consists of the name, the credit card tag (Visa/MasterCard), number, and the expiry date. They can add as
many books to the shopping cart as they want, and they can also remove books. If they decide at some
point to check out the shopping cart, then they are asked to check the shipping address and credit card
information supplied, and if either of those was not supplied, they are asked to supply it. Next, they can
review the contents of the shopping cart, and if they agree, they can send the order. Then, the credit card
information is sent to the bank, and, if approved, the order is finalized. If the information was not approved,
then the customer is made aware of this, so he/ she can change the payment option. A delivery agent can
check the status of online orders, and process an order, meaning that it changes its status from “pending” to
“delivered”. Finally, the administrator is responsible for the book inventory. She can check the current
inventory, order new books from the supplier, and add books to the inventory.
A. Give structural model and logical view of above given scenario.
Figure 1: Class Diagram
Figure 2: Sequence Diagram
2. Consider the below given scenario of social media application and answer following questions:
Social media are the web based application used for social interaction. Let’s consider social media
application ABC having given functionalities.



User can send a friend request to any user.
User can follow any user whose follow option is available.
User can send messages to friends and followers.
For the security and privacy concerns, there is specific mechanism implemented. Whenever certain user
will send friend request to any user. The other user can have three options either to accept, reject or block
the user. On accept, the user is added to friend list of that user. On reject the user will be added to the list of
user who cannot resend the request to that specific user but still view the profile of that user. On block, the
user will be added to blacklist and will never access the profile of the user.
A.
B.
C.
D.
What architecture pattern you will use while developing the above given scenario.
Model above given scenario using block and line diagram.
What will be two advantages of the architecture pattern, you mention in answer to first question of
this case study.
What will be two disadvantages of the architecture pattern, you mention in answer to first question
of this case study.
A. Layered architecture
C. The advantages of Layered architecture are:
 Layered architecture supports incremental development of sub-systems. You can implement each layer
separately and then integrate it to the other layers. Thus, you can implement the system in incremental
fashion.
 Multi-level of security can be provided by using the Layered architecture.
 Layered architecture support reusability, e.g. you have an existing system and you want to change the
user interface of the system, you can replace the top GUI layer with the new one. Thus, new
functionality can be easily embedded into layered architecture.
D. The disadvantages of the layered architecture are:
 Layered architecture can face some performance issues due to high communications between layers
as there isn’t any mechanism through which first layer directly interacts with last layer.
 Clean separation of layers is difficult to implement therefore, a high-level layer may have to interact
directly with lower layers rather than through the layer immediately below it.
B.
Figure 3: Layered Architecture Block & Line Diagram
3. Earlier this year due to COVID-19 pandemic, all the universities have shifted to online learning system to
complete the ongoing semester. Now is time to conduct online exam for the students and for which scenario
is defined as under:
Instructor will send announcement for the exam including pattern and syllabus etc. to students, through
Learning Management system (LMS). After the announcement is done, teacher will prepare the exam
statement and schedule that exam on the LMS. Now to distribute the exam among students, either
instructor can send public link of exam, explicitly to student or LMS can notify students about the exam. In
both cases exam will be send to students and after the completion of exam, students has to submit exam
on LMS. Instructor and students, both will need authentication through username and password while
accessing LMS. Instructor can ask Teacher Assistant to mark exams collected on LMS. After marking is
done, TA can send marking sheet to instructor. Once markings are received, the instructor can submit
grades to examination branch.
Exam can only be conducted after taking the quality review of paper from the moderators.
A. Design the detailed Use Case diagram for the above given scenario.
B. Model the above given scenario using sequence diagram.
Figure 4: LMS Use Case Diagram
Figure 5: LMS Sequence Diagram
4. Consider the library management system as per described in case below:
Library has the facility to provide books, videos and CDs. Each of the library item is identified by its ID and
Name. The category of book that the library manage are (Academia, Novel and Science Fictions). In
addition to that books can have one or more authors associated with it. Videos can be of different
categories (Tutorials and Entertainment) with their associated producers. There can be one or more
producer to a single video in library. CDs can be composed only by one composer. Each of author,
producer and composer are identified by ID and Name. There are multiple copies exist for each of the
library item having copy number for reference. User can loan the book according to requirement. Reference
only copies are issued for limited hours while regular loan can be issued for larger window of time. There is
system through which user can ask for the loan of book and it will store the information of user and the copy
that is issued to the user. Each user has ID, Name, Address and Phone number as an information.
A. Model the UML class diagram for the above given scenario. Extending the class hierarchy without any need
will leads toward deduction of marks.
Figure 6: Library Management System Class Diagram
5. Let suppose you are designing a new programming language known as XProg. Your main concern is to
develop a compiler that can transform the instruction given in XProg syntax to machine specific code. There
are different steps involved in compilation of code. Exception and error handling is more important at each
stage. The compilation process is divided into three stages: The first stage consist of reading the source
file, parse it and form a syntax tree out of the source code. The second stage is basically converting the
source code to its intermediate form and do some code optimization (concept is same as C++ code is
converted into assembly language code). The third stage is basically total conversion of instruction received
in intermediate language to machine code.
A. What architecture pattern you will use while developing the above given scenario.
B. Identify different components and draw component diagram for the system.
C. Also describe what flexibilities the chosen architecture will provide while developing the above given
system.
D. What will be major advantage of the chosen architecture?
A. Pipe and Filter Architecture
C. Pipe and Filter architecture ensures loose coupling of components (Filters). Loose coupling allow
changes on individual filters be made easily without affecting other filters. This helps in development of
rapidly changing systems.
D. The major advantages of the pipe and filter architecture are maintenance and reusability. Also each filter
can be implemented as a separate task and can be executed in parallel with other filters. Each filter runs
independently of others only focusing on its input and output data.
B. Components:
 Lexical Analyzer takes input language tokens and converts them to an internal form.
 Syntax Analyzer takes the output of the Lexical Analyzer and generates syntax tree.
 Semantic Analyzer checks the syntax tree whether it is according to the rules of the
programming language XProg or not.
 Intermediate code generator generates an intermediate code of the source code. It is then
optimized.
 Code generator takes the optimized intermediate code and converts it into machine specific
code.
Figure 7: Component Diagram
Download