Software Engineering · Unit 3
System Modeling and Design
Exam-focused notes for System Modeling and Design (Software Engineering, BIT302): what the TU syllabus asks and how it has actually been tested, with 8 solved past questions from this unit.
System Modeling and Design in short
System modeling means building abstract views of a system using diagrams. Models help engineers understand, discuss and design a system before they build it.
What this unit covers
- Structural models and dynamic models
- Data-driven modeling
- Event-driven modeling
- UML diagrams and aggregation
- Use case diagrams
- Class diagrams
- Sequence diagrams
UML diagrams and aggregation
2082 · 10 marks
Develop use case diagram, class diagram, and sequence diagram of online entrance examination system. Make necessary assumptions.[10]
Show solved answerHide answer
Online Entrance Examination System - UML Diagrams
Note: No specific reference notes were found for this topic. The following answer is based on standard UML modeling principles as taught in Software Engineering courses for BSc CSIT, Tribhuvan University.
Assumptions Made
- The system allows students to register, log in, and attempt an online entrance exam.
- An admin manages questions, sets exam schedules, and views results.
- The system auto-evaluates answers and generates results.
- An examiner/teacher can add and manage questions.
- The exam has a timer; the system auto-submits when time expires.
1. Use Case Diagram
Actors
| Actor | Role |
|---|---|
| Student | Registers, logs in, takes exam, views result |
| Admin | Manages users, schedules exam, views reports |
| Examiner | Adds/manages questions |
| System (Timer) | Auto-submits exam on timeout |
Use Cases
+---------------------------------------------------------------+
| Online Entrance Examination System |
| |
| [Register] [Login] [Logout] |
| |
| [View Exam Schedule] [Start Exam] [Answer Questions] |
| |
| [Submit Exam] [View Result] [View Scorecard] |
| |
| [Add Questions] [Edit Questions] [Delete Questions] |
| |
| [Schedule Exam] [Manage Users] [Generate Report] |
| |
| [Auto Submit] (System/Timer) |
+---------------------------------------------------------------+
Student -----> Register
Student -----> Login
Student -----> View Exam Schedule
Student -----> Start Exam
Student -----> Answer Questions
Student -----> Submit Exam
Student -----> View Result
Student -----> View Scorecard
Examiner ----> Login
Examiner ----> Add Questions
Examiner ----> Edit Questions
Examiner ----> Delete Questions
Admin -------> Login
Admin -------> Schedule Exam
Admin -------> Manage Users
Admin -------> Generate Report
Admin -------> View Result
System ------> Auto Submit <<extends>> Submit Exam
Submit Exam <<includes>> Evaluate Answers
Start Exam <<includes>> Load Questions
Relationships Summary
Start ExamincludesLoad QuestionsSubmit ExamincludesEvaluate AnswersAuto SubmitextendsSubmit Exam(triggered when timer expires)View ScorecardextendsView Result
2. Class Diagram
+------------------+ +---------------------+
| User | | Exam |
+------------------+ +---------------------+
| - userID: int | | - examID: int |
| - name: String | | - title: String |
| - email: String | | - duration: int |
| - password: String| | - totalMarks: int |
| - role: String | | - scheduleDate: Date|
+------------------+ | - status: String |
| + login() | +---------------------+
| + logout() | | + startExam() |
| + register() | | + endExam() |
+------------------+ | + getQuestions() |
| +---------------------+
| |
_____|_____ _______|_______
| | | |
+-------+ +--------+ +----------+ +-----------+
|Student| | Admin | | Question | | Result |
+-------+ +--------+ +----------+ +-----------+
|-stuID | |-adminID| |-quesID | |-resultID |
|-grade | |-dept | |-quesText | |-stuID |
+-------+ +--------+ |-options[]| |-examID |
|+takeExam()|+scheduleExam()|correctAns||-score |
|+viewResult()|+manageUser()|+getAnswer()|+grade |
+-------+ +--------+ +----------+ +-----------+
|
+--------------------+
| ExamAttempt |
+--------------------+
| - attemptID: int |
| - stuID: int |
| - examID: int |
| - startTime: Time |
| - endTime: Time |
| - answers[]: String|
+--------------------+
| + submitAnswers() |
| + calculateScore() |
| + autoSubmit() |
+--------------------+
Relationships
| Relationship | Description |
|---|---|
User is parent of Student and Admin | Generalization |
Student takes Exam | Association (many-to-many) |
Exam contains Question | Composition (1 to many) |
ExamAttempt links Student and Exam | Association class |
ExamAttempt generates Result | Dependency |
3. Sequence Diagram
Scenario: Student Takes and Submits an Exam
Student LoginPage ExamController QuestionDB Timer ResultModule
| | | | | |
|--login()---->| | | | |
| |--authenticate()| | | |
| |<--success-----| | | |
|<--dashboard--| | | | |
| | | | | |
|--startExam()-> | | | |
| |--loadExam()-->| | | |
| | |--getQuestions()-> | |
| | |<--questionSet-| | |
| | |--startTimer()------------->| |
|<---------questions displayed--| | | |
| | | | | |
|--answerQuestion()------------>| | | |
| | |--saveAnswer()->| | |
| | | | | |
| | |<---timeExpired-------------| |
| | |--autoSubmit() | | |
|--submitExam()---------------->| | | |
| | |--calculateScore()--------------------->|
| | |<--score--------------------------------|
|<---------result displayed-----| | | |
| | | | | |
Reading the diagram: time runs downward, each vertical line is the lifetime of one object, and each horizontal arrow is a message. The student logs in through the login page, the exam controller loads the exam and pulls the question set from the question database, the timer is started, and answers are saved as they are given. Whichever happens first, the student submitting or the timer expiring, ends the attempt: autoSubmit() covers the timeout case, which is why the timer has its own lifeline. The result module then scores the attempt and the score is returned to the student.
Conclusion
The three diagrams describe the same online entrance examination system from three angles. The use case diagram is the behavioural outside view and fixes what the Student and the Admin can ask the system to do, the class diagram is the structural view and fixes the classes User, Student, Admin, Exam, Question, ExamAttempt and Result with their attributes, operations and relationships, and the sequence diagram is the interaction view and fixes the order in which those objects exchange messages while one exam is taken. Together they cover requirements, structure and behaviour, which is why UML models are normally drawn as a set rather than singly.
Sequence diagrams
2081 · 5 marks
Draw sequence diagram for online food ordering system where the user can choose foods of various restaurants and pay online. The system also provides discount of 10% if the total amount paid is more than Rs. 3000. The user if cancels the order within 30 minutes will be approved else the paid amount will not be refunded. [5]
Use case diagrams
2080 · 5 marks
Draw use case diagram for online voting system where the students can vote for their favorite teachers based on their performance. The teachers will be notified by the system about their status based on their votes. The system will generate the class routine by selecting teachers with respect to their votes. The routine will be sent to director, admin department, teachers, students and parents. [5]
Event-driven modeling
2079 · 10 marks
Describe event driven modeling. Explain the concept of event driven modeling with an example of your own.[10]
Structural models and dynamic models
2079 · 5 marks
Differentiate between structural model and dynamic model. Explain aggregation in UML. [5]
Class diagrams
2079 · 5 marks
Draw Class diagram for online voting system where user can vote the candidates. The system also generates the final result with respective vote counts as well. The user has to register and will be eligible only after proper validation. [5]
Show solved answerHide answer
Class Diagram for Online Voting System
Description of Classes and Relationships
The following class diagram represents an Online Voting System with registration, validation, voting, and result generation functionalities.
Class Diagram (UML Notation)
+------------------+ +----------------------+
| User | | Registration |
+------------------+ +----------------------+
| - userId: int |1 1 | - regId: int |
| - name: String |----------| - email: String |
| - email: String | | - password: String |
| - password: String| | - status: String |
| - isEligible: bool| +----------------------+
+------------------+ | + register(): void |
| + login(): bool | | + validate(): bool |
| + logout(): void | | + getStatus(): String|
| + viewResult():void| +----------------------+
+------------------+
|
| 1
|
| (after validation)
|
| *
+------------------+ +------------------+
| Vote | | Candidate |
+------------------+ +------------------+
| - voteId: int | * 1 | - candidateId:int|
| - userId: int |----------| - name: String |
| - candidateId:int| | - party: String |
| - voteTime:DateTime | - voteCount: int |
+------------------+ +------------------+
| + castVote():bool| | + getVoteCount() |
| + confirmVote() | | : int |
+------------------+ | + updateCount() |
| | : void |
| +------------------+
| |
| | 1
| |
| * | *
+------------------+ +------------------+
| Validation | | Result |
+------------------+ +------------------+
| - validationId | | - resultId: int |
| - userId: int | | - candidateId:int|
| - isVerified:bool| | - totalVotes: int|
+------------------+ | - rank: int |
| + checkEligibility| +------------------+
| (): bool | | + generateResult()|
| + verifyUser() | | : void |
| : bool | | + displayResult()|
+------------------+ | : void |
| + getWinner() |
| : Candidate |
+------------------+
Relationships Summary
| Relationship | Type | Multiplicity | Description |
|---|---|---|---|
| User -- Registration | Association | 1 to 1 | Each user must register once |
| Registration -- Validation | Dependency | 1 to 1 | Registration triggers validation |
| User -- Vote | Association | 1 to * | A user can cast one or more votes (one per election) |
| Vote -- Candidate | Association | * to 1 | Many votes belong to one candidate |
| Candidate -- Result | Association | 1 to * | Each candidate has result entries |
Key Design Points
- User registers through the Registration class and is validated before being marked eligible (
isEligible = true). - Validation class checks user credentials and eligibility before allowing voting.
- Vote class records each vote with timestamp, linking user and candidate.
- Candidate maintains a running
voteCountupdated on each vote. - Result class aggregates all votes and generates the final result with rankings and total vote counts.
0 · 5 marks
Draw a class diagram for online movie management system where the customer after registering in the system can book the ticket according to the date, hall number, seat number and movie name. The payment has to be made online. Customer will get e-ticket after payment. The customer can also rank the movie after watching in the system. [5]
Data-driven modeling
0 · 10 marks
Explain data driven modeling and event driven modeling with an example of your own.[10]
Make Unit 3 stick
Practice BIT302 with flashcards & quizzes