Solutions
Solutions
• Non-Functional Requirement (NFR): The system must process and confirm slot reservations
in under 2 seconds (Quality Attribute: Performance / Responsiveness).
2. FR: Functional behavior; defines an explicit operational capability accessible to the end user.
Information Hiding Rationale: By exposing an abstract BOOLEAN state interface, the upper Business
Logic layer remains fully isolated from lower hardware configuration metrics such as target electronic
voltages (0V vs 12V) or physical register flags.
1
Question 3: System Resilience & Logic Auditing (5 Marks)
(a) Failure Identification (2 Marks)
1. Synchronous Blocking: The SYNC call halts execution on the thread, making the remote system
vulnerable to complete freezes if network latency spikes.
2. Infinite Busy-Wait (Retry Storm): The CONTINUE structure re-fires identical request payloads
immediately during server overloads without incorporating delays, actively exacerbating the target
server’s failure state.
2
(c) Senior QA Audit Log Table (2 Marks)
3
Question 5: AI-Assisted Engineering & Golden Prompt Crafting (4
Marks)
Examples :
- Example 1: Input booking is $500 . Payment succeeds on try #1. System sets
booking status to ’ CONFIRMED ’ and returns success .
- Example 2: Input booking is $1200 . System sets status to ’ PENDING_APPROVAL ’
and forwards transaction to the Manager Audit Queue without attempting
immediate payment .
Negative Constraints :
1. Do NOT log raw credit card numbers or CVV codes within any system audit
trails or error logging outputs .
2. Do NOT allow unapproved bookings over $1 ,000 to bypass the validation
workflow under any edge - case failure conditions .
FUNCTION t e s t _ a l l o c a t e _ c o r e s _ b o u n d a r y _ m a x () :
# Establish mathematical constraint before implementation code exists
EX PE CT _R AI SE _E RR OR = False
TRY :
a l l o c a t e _ c o m p u t e _ c o r e s (8)
CATCH ValueError :
EX PE CT _R AI SE _E RR OR = True
ASSERT EXP EC T_ RA IS E_ ER RO R == False
4
Question 7: Traceability Matrices & Process Violations (4 Marks)
(a) Use Case Cumulative Weight Calculations (1.5 Marks)
• UC-A (Inbound Log) = PW(REQ-1) + PW(REQ-5) → 5 + 3 = 8
• Rationale: UC-C possesses the highest aggregate Priority Weight (Total PW = 9). Delivering
high-weight components first ensures engineering teams maximize early product lifecycle value
deployment.
• Consequence: It incorporates unverified engineering code logic loops that have no requirement
documentation backings and zero testing coverage, creating budget waste and introducing un-
known surface defects.
5
EJUST — CSE322/CSE323 Software Engineering
Mock Final Examination — Answer Key
Total Marks: 100
• FR: The system shall allow students to order meals via a mobile app and unlock designated lockers
using a QR code. [2.5]
• NFR: The system shall maintain locker temperature between 2°C and 8°C for cold meals and above
60°C for hot meals (Food Safety / Reliability). [2.5] Grading note: NFR must be a quality attribute
(safety, performance, usability, reliability). “Use QR code” or “send email” are FR, not NFR.
1.2 [6 marks]
1.3 [4 marks]
Rationale: Hides PWM duty cycles, heating/cooling element voltages, thermistor resistance values, and
H-bridge polarity. Business Logic only specifies the target temperature; implementation details remain
concealed. [4] Acceptable alternative: FUNCTION set_locker_climate(mode: ENUM {HEATING, COOLING,
OFF}) if rationale clearly states hidden hardware details. A Boolean alone is insufficient here because
climate control is not binary.
1.4 [5 marks]
• Primary: Student [1]. Rationale: Initiates core goals (orders meal, requests pickup) and is the
main beneficiary. [0.5]
• Supporting: Cafeteria Staff [1]. Rationale: Responds to orders by preparing and loading meals;
secondary actor. [0.5]
• Offstage: Payment Gateway / Banking API [1]. Rationale: External system essential for billing
but not directly controlled or interacted with by the primary workflow. [1] Common mistake:
Omitting Offstage actor scores partial only.
Generated by [Link]
Exercise 2: System Resilience & Logic Auditing [20 marks]
2.1 [8 marks]
1. Synchronous Blocking [2]. The CALL_PAYMENT_GATEWAY_SYNC blocks the calling thread until the
gateway responds, rendering the UI / order queue unresponsive during payment. [2]
2. Infinite Busy-Wait / Retry Storm [2]. The WHILE True loop retries immediately (CONTINUE) on
timeout without exponential backoff or a bounded attempt limit, overwhelming the gateway and
wasting client resources. [2] Grading: “Slow code” or “it might crash” earns 0. Must name the
precise anti-pattern and explain thread/server consequences.
REQ-1 5 X X
REQ-2 4 X
REQ-3 3 X
REQ-4 2 X X
Total PW 7 9 5
• UC-1: 5 + 2 = 7 [2]
• UC-2: 5 + 4 = 9 [2]
• UC-3: 3 + 2 = 5 [2]
Generated by [Link]
and food safety, the two most critical requirements. [2] Trap: Students who compute single-requirement
PW or omit the stakeholder-value justification score partial.
3.2 [5 marks]
3.3 [5 marks]
Generated by [Link]
And the incident is escalated to cafeteria staff
Grading: Happy path alone = Satisfactory. All three scenarios with correct Given/When/Then syntax =
Excellent.
4.2 [4 marks]
• “fast pickup” → “QR scan-to-door-unlock time � 3 seconds at the 95th percentile under
normal load.” [2]
• “secure storage” → “Lockers remain locked until a single-use, SHA-256-hashed QR code
is scanned; QR expires 15 minutes after meal readiness.” [2] Any quantifiable, testable
metric accepted. Vague replacements earn 0.
4.3 [4 marks]
4.4 [4 marks]
• Persona: A malicious student who shares their QR code screenshot on social media before using
it. [1]
• Hidden Requirement: QR codes must be cryptographically bound to the student’s session/
device and invalidated immediately upon first scan to prevent replay attacks. [1.5]
• Edge Case: Two students present the same QR code simultaneously at different lockers; the system
must reject the second scan and flag the account. [1.5]
Generated by [Link]
• Negative Constraint [2]
5.2 [8 marks]
def test_discount_boundary_25_percent():
# Mathematical boundary: 25% is the maximum allowed discount
assert calculate_final_price(100.00, 25) == 75.00
“Do NOT silently clamp invalid discount_percent values to 25 or round them down; explicitly
raise ValueError for any input outside the inclusive range 0–25.”
5.3 [4 marks]
Calculations:
Evaluation: Does not match the 70/20/10 pyramid. Unit tests are below 70% and integration tests
exceed 20%.
Risk: The test suite will have slow feedback, higher maintenance cost, and integration tests may mask
missing unit-level coverage for individual modules, allowing defects to persist in isolated logic. [1]
Generated by [Link]
EJUST · Spring 2026 CSE322 — Answer Key (Instructor Only)
Common trap: Students write two FRs (e.g. “verify ID” and “log dispensing”)
and label one as NFR. Logging is a Technical Service / FR, not a quality attribute.
1
EJUST · Spring 2026 CSE322 — Answer Key (Instructor Only)
Classic trap: send audit log placed in Business Logic “because security policy
requires logging.” The instructor’s rubric explicitly classifies logging as Technical
Services — it is infrastructure, not a domain rule. Deduct 1 mark if justification is
absent or wrong.
Explanation: The Business Logic layer only needs to express “dispense” or “do
not dispense.” The motor direction (CLOCKWISE) and duration (duration ms) are
hardware implementation details hidden inside the connector’s body.
Mark allocation:
• 2 marks — correct Boolean parameter hiding hardware specifics.
• 2 marks — clear explanation of what is hidden and why.
2
EJUST · Spring 2026 CSE322 — Answer Key (Instructor Only)
Trap: Students who write only “it’s slow” or “it might crash” receive 0 marks.
The instructor requires: precise name + system-level consequence. Also: missing
the missing-error-handling failure is very common — only 1 failure identified ⇒
maximum 2/6.
3
EJUST · Spring 2026 CSE322 — Answer Key (Instructor Only)
WAIT (2 ˆ attempt )
CONTINUE
ELSE :
# 3. Non - transient error - fail immediately
RETURN " PAYMENT_ERROR : " + RESULT . status
4
EJUST · Spring 2026 CSE322 — Answer Key (Instructor Only)
backing.
• Introduces unverified complexity/bugs into the system with zero test coverage.
Major trap for (a): Students who assign only one requirement per UC compute
UC-1 = 6 instead of 11. This is the deliberate multi-mapping trap — award
maximum 1/3 if all UCs are computed as single-requirement. Trap for (d): “Gold
Plating” alone earns 0.5/1. Must include at least one harm.
5
EJUST · Spring 2026 CSE322 — Answer Key (Instructor Only)
Trap: Gherkin scenarios covering only the happy path score Satisfactory (3/6
maximum). The instructor’s rubric explicitly requires failure paths. Missing And
clauses for audit logging ⇒ deduct 0.5 marks. For (c), “response should be fast” as
a replacement is still vague ⇒ 0 marks.
Role: You are a senior backend engineer building safety-critical healthcare logic.
Context: I am building a rate-limiting module for a Hospital Medication
Dispensing System. A nurse’s account must be automatically locked after
repeated failed dispense requests.
Example 1: If a nurse exceeds 3 failed login attempts, set account status to
LOCKED and record the event timestamp.
Example 2: If account status is LOCKED, reject all dispense requests for 10
minutes and return a RATE LIMIT EXCEEDED error code.
Task: Generate the function rate limit nurse(nurse id) that locks an ac-
count after 5 consecutive failed dispense requests within a 10-minute sliding
window.
Negative Constraint: Do NOT log, store, or transmit any biometric data
(fingerprints, facial features) in the audit trail or any log output. Only the nurse
ID and event timestamp may be recorded.
6
EJUST · Spring 2026 CSE322 — Answer Key (Instructor Only)
Trap: Writing the test after describing the implementation ⇒ violates TDD
philosophy; deduct 0.5 marks. Boundary padlock testing 499 instead of exactly
500 ⇒ wrong boundary; deduct 0.5 marks. Missing the “raises error” assertion in
Threshold/Extreme padlocks ⇒ deduct 0.5 marks each.
7
CSE322/CSE323 — Software Engineering
Final Mock Examination — Answer Key
Spring 2026 | Total Marks: 100
Nurse Primary Initiates vital sign Uses bedside tablet to view vitals and
monitoring; main respond to alerts
beneficiary of
real-time data
Pager Gateway / Supporting Responds to alerts Receives and acts on threshold breach
Doctor generated by the notifications
system
Hospital Administrator Offstage Has stake in Reviews weekly reports for regulatory
/ Regulator compliance and compliance; affected by data quality
trend reports; never
interacts directly
with the system
Marking: 1 mark per correct actor + type + rationale. Deduct 1 mark if Offstage is missing or
misclassified.
“The system shall display real-time vital signs (heart rate, blood oxygen, blood pressure) on the
bedside tablet when a nurse selects a patient.”
Justification: Describes what the system does. If removed, the system cannot perform its core function.
(1 mark for correct FR, 1 mark for justification)
“The system shall maintain 99.9% uptime during network outages by caching vital signs locally on
the bedside tablet for up to 4 hours.”
Justification: Describes how well the system performs (availability/ reliability). The system still
“works” without it, but poorly. (1 mark for correct NFR, 1 mark for justification)
• “Heart rate readings shall update on the tablet within 2 seconds of sensor capture.” (Performance)
• “All patient data shall be encrypted using AES-256 at rest and TLS 1.3 in transit.” (Security)
Generated by [Link]
1.3 Layered Architecture Assignment (4 marks)
Marking: 1 mark per correct assignment + rationale. Deduct 0.5 if rationale is vague.
Marking:
• Action: “I accidentally tapped the wrong patient ID at 3 AM and saw another patient’s vitals for
5 seconds before the screen corrected itself.”
• Hidden Requirement: REQ: Strict Patient Identity Verification — system must confirm
patient ID match before displaying vitals.
• Action: “I tried to access the vitals of a celebrity patient not assigned to my ward.”
• Hidden Requirement: REQ: Role-Based Access Control (RBAC) — nurses can only view
patients in their assigned ward.
• Action: “The Wi-Fi went down and I couldn’t see any vitals for 30 minutes.”
Generated by [Link]
• Hidden Requirement: REQ: Local Data Caching with Sync Queue — tablet must cache
last-known vitals and queue updates for reconnection.
• Action: “I intercepted unencrypted vital sign packets between tablet and server.”
• Hidden Requirement: REQ: End-to-End Encryption for Vital Data Streams — all real-time
data must be encrypted in transit.
Marking: 1 mark per valid persona + hidden requirement pair. Must have at least 4. Deduct 0.5 if
requirement is too vague.
Marking: 2 marks per failure (1 for precise name, 1 for systemic consequence). Accept “Infinite Retry
Loop” as equivalent to “Infinite Busy-Wait.”
IF [Link] == "SUCCESS":
RELEASE_PILLS(pill_count)
RETURN "SUCCESS"
ELSE IF [Link] == "DB_TIMEOUT":
Generated by [Link]
IF i == MAX_RETRIES:
RETURN "FAILURE: Pharmacy DB unreachable after 3 attempts"
WAIT(BACKOFF_MS * (2 ^ (i - 1))) // Exponential back-off
CONTINUE
ELSE IF [Link] == "NOT_FOUND":
RETURN "ERROR: Prescription not found"
ELSE:
RETURN "ERROR: Unexpected status"
Marking:
Asynchronous Call (ASYNC/ Prevents thread blocking so the dispenser remains responsive to
AWAIT) other patients during slow DB operations
Exponential Back-Off Prevents Retry Storm by increasing delay between retries,
reducing load on the failing pharmacy DB
Bounded Retry (Circuit Breaker Limits resource consumption and provides a definitive failure
precursor) point so the system can escalate instead of waiting forever
Marking: 1 mark per pattern name + 1 mark per correct problem description. Accept “Bounded Retry”
or “Retry Limit.”
Requirement PW UC-1: Book Appt UC-2: Start Video UC-3: Process Payment
REQ-1: Patient 5 X X
Authentication
REQ-2: 4 X
Calendar
Availability
Check
Generated by [Link]
Table 5 – continued
Requirement PW UC-1: Book Appt UC-2: Start Video UC-3: Process Payment
REQ-3: 5 X
PCI-DSS
Payment
Compliance
REQ-4: HIPAA 3 X X
Session
Encryption
REQ-5: 2 X
Recording
Consent
Capture
Implement UC-2 (Start Video) first. It has the highest Total PW (10), meaning it delivers the
most critical stakeholder value by addressing authentication, encryption, and consent — all high-risk
compliance requirements.
Marking: Deduct 1 mark per use case if multi-requirement mappings are missed. Deduct 1 mark if
decision lacks stakeholder-value justification.
Marking: 0.5 marks per vague term identified. 1 mark per measurable replacement + standard. Deduct
0.5 if standard is mismatched or missing.
Generated by [Link]
Given the patient has a confirmed appointment for today at 14:00
And the doctor has started the video session
When the patient clicks the "Join Consultation" button
And the patient grants camera and microphone permissions
Then the patient is connected to the video call
And the session timer begins counting
And the chat panel is displayed
Marking: 1 mark for correct Given/When/Then structure. 1 mark for realistic happy path. 1 mark for
at least one And clause. 1 mark for completeness.
Marking: 1 mark for correct Given/When/Then structure. 1 mark for realistic failure path. 1 mark for
at least one And clause. 1 mark for completeness.
Trap: Failure path that only says “error message shown” without system behaviour loses 2 marks.
1. Wastes engineering resources on unverified, unrequested functionality that could have been
spent on validated requirements.
2. Introduces unverified complexity and potential bugs into a system that was not designed
to host a chatbot, risking stability of core features.
3. Pollutes the traceability matrix by creating a feature with no requirement backing, no Priority
Weight, and no test coverage, making the project un-auditable.
Marking: 1 mark per distinct, systemic harm. “It’s not in the requirements” alone earns 0.5 marks.
“The chatbot has no requirement ID, no Priority Weight, and no mapped use case, so it cannot be
traced, tested, or justified — regardless of perceived user benefit.”
Marking: Must explicitly mention traceability matrix, requirement backing, or Priority Weight. Generic
“it’s not needed” earns 0 marks.
Generated by [Link]
Exercise 4: AI-Assisted Engineering & Prompt Crafting (16 marks)
4.1 Golden Prompt Construction (10 marks)
ROLE: You are a senior backend engineer writing robust Python functions
for a healthcare appointment system.
EXAMPLE 1 — Confirm:
Input: { "patient_id": "P123", "response": "CONFIRM", "appointment_id": "A456" }
Output: { "status": "CONFIRMED", "action": "none", "notify_doctor": false }
EXAMPLE 2 — Cancel:
Input: { "patient_id": "P123", "response": "CANCEL", "appointment_id": "A456" }
Output: { "status": "CANCELLED", "action": "release_slot", "notify_doctor": true }
NEGATIVE CONSTRAINT: Do NOT log the patient's phone number, appointment ID,
or any PHI (Protected Health Information) in plaintext audit logs. Use
anonymised patient tokens only.
EDGE CASE CAGE — BOUNDARY PADLOCK: The function must correctly handle
exactly 3 consecutive no-shows (flag account) vs 2 no-shows (do not flag yet).
Marking:
Generated by [Link]
Weakness What Is Missing Why It Matters
Marking: 2 marks per weakness (1 for identification, 1 for explanation). Accept any three valid weak-
nesses.
def test_calculate_copay_tier_c_boundary():
# Tier C = 50% patient responsibility
result = calculate_copay(insurance_tier="C", base_cost=200)
assert result == 100 # 50% of 200 = 100
Marking:
def test_boundary_tier_c_exactly_50_percent():
# Boundary: Tier C pays exactly 50%
result = calculate_copay(insurance_tier="C", base_cost=100)
assert result == 50 # Exactly at the 50% boundary
Marking: 2 marks for testing exact boundary. 2 marks for clear assertion.
Generated by [Link]
def test_threshold_invalid_tier_e():
# Threshold: One step beyond valid tier set (A, B, C, D)
try:
calculate_copay(insurance_tier="E", base_cost=100)
assert False, "Should have raised ValueError for invalid tier"
except ValueError:
pass # Expected
Marking: 2 marks for testing one beyond valid set. 2 marks for correct exception handling.
def test_extreme_negative_base_cost():
# Extreme: Negative cost is physically impossible
try:
calculate_copay(insurance_tier="B", base_cost=-9999)
assert False, "Should have raised ValueError for negative cost"
except ValueError:
pass # Expected
Marking: 2 marks for extreme/invalid input. 2 marks for correct exception handling.
“Do NOT silently clamp, round, or default invalid insurance_tier values. Any tier outside {A, B,
C, D} or any negative base_cost MUST raise a ValueError immediately. Do NOT return 0, null, or
any default value for invalid inputs.”
Marking:
Verification asks: “Did we build the system correctly?” — does the code match the specification?
Evidence: All unit tests pass, including Boundary, Threshold, and Extreme padlocks. The cal-
culate_copay function correctly implements the tier percentages and raises ValueError for invalid
inputs, matching the specification exactly.
Validation asks: “Did we build the correct system?” — does it solve the real patient billing
problem?
Additional evidence needed: - User acceptance testing with hospital billing staff confirming the
copay calculations match real insurance contracts
Generated by [Link]
• User acceptance testing with hospital billing staff confirming the copay calculations match real
insurance contracts
• End-to-end test: a patient books an appointment, insurance is verified, and the billed copay
matches their Explanation of Benefits (EOB)
• Playwright E2E test showing the patient portal displays the correct copay before confirming
the appointment
Marking: 1 mark for correct definition. 1 mark for at least one concrete validation activity beyond unit
tests.
• Excellent (90–100): All artefacts produced, precise vocabulary, systemic reasoning, no vague
adjectives, all traps avoided.
• Good (75–89): Most artefacts produced, minor vocabulary slips, one trap triggered.
• Satisfactory (60–74): Some artefacts missing, conceptual understanding present but imprecise,
2+ traps triggered.
• Needs Improvement (<60): Major gaps in artefacts, confused FR/NFR, missed code failures,
Zero-Shot prompts, happy-path-only Gherkin.
Generated by [Link]
Department of Computer Science and Software Engineering
Egypt-Japan University of Science and Technology (E-JUST)
• The Architectural Correction: Abstract the transitions out by using a localized state factory
lookup matrix or passing handling controls back up to the master context controller class wrapper.
1
Question 2: White-Box Testing & Cyclomatic Complexity Analysis (6
Marks)
(a) Control Flow Graph Mapping (2 Marks)
• Node 1: Entry point and parameter initialization block.
• Node 8: Dead-code evaluation block: zone id == "ZONE A" AND weight kg <= 100.
• Statement Coverage Failure: Standard statement coverage purely checks whether lines exe-
cute. If code execution routes around the dead branch block entirely, statement metric tracking
can report 100% validation coverage while hiding dead logic loops completely.
2
(b) Quantified QA Pipeline Policy Gate Specification (2.5 Marks)
Test Metric Category Operational Acceptance Target Binary Failure Condition Rule
Security Scan Compliance 0 Open Critical CVE Flaws (OWASP) REJECT if any Severity Level ≥ 8.0 exists.
Code Coverage Bounds Minimum 85% Branch Test Coverage REJECT if deployment suite falls below 85%.
Performance Bounds API Endpoint Latency ≤ 200 ms REJECT if 95th-percentile exceeds 200 ms under tes
• **DAST (Dynamic Analysis):** Evaluates a running system instance externally by injecting mock
malicious runtime payloads to expose operational attack surfaces.
• **Scenario Match:** The vulnerability was identified using a **SAST** architecture component
during compilation.
3
Question 4: Software Configuration Management & Branching Topolo-
gies (6 Marks)
(a) Branching Topologies Comparison (2 Marks)
• **GitFlow:** Features multiple long-lived development streams (features, releases, develop) which
accumulate large code diffs over time, increasing the risk of massive merge conflicts.
• **Trunk-Based Development:** Mandates that all developers merge short-lived feature updates
back into a single central branch (the trunk) multiple times a day. This isolates changes to small
increments and prevents code streams from diverging.
• Continuous Deployment Utility: This allows code to be merged safely into the main line and
deployed to production inactive. The logic remains dormant until the configuration flag is flipped
to active in production, separating code deployment from feature release.
”We cannot accept or integrate the unestimated maps engine modification mid-sprint. Our
historical engineering data establishes a firm velocity boundary of exactly 30 story points
per sprint. Pushing unplanned workload injections into an active sprint violates our quality
rules, introduces code defects, and causes sprint overload failures, as evidenced in Sprint 03.
This emergency feature must instead be formally sized, added to the product backlog, and
prioritized for inclusion in Sprint 05 planning based on our sustainable capacity thresholds.”
4
CSE322/CSE323 – Mock Final Examination II Answer Key – Spring 2026
Rationale: Hides camera-specific details (frame resolution, OCR confidence thresholds, neural-
network model identifiers, raw pixel data). Business Logic only receives a structured occupancy
report; implementation details remain concealed. [4]
Acceptable alternative: FUNCTION query_occupancy(zone_id: STRING) RETURNS INTEGER
if rationale clearly states hidden camera/OCR internals.
- Hides DB schema [2]. Independent team only needs the signature and pre/post-conditions. [2]
- Pre/post-conditions present and non-trivial [1].
1
CSE322/CSE323 – Mock Final Examination II Answer Key – Spring 2026
2. Infinite Busy-Wait / Retry Storm [2]. The WHILE True loop retries immediately (CONTINUE)
on “PLATE_NOT_FOUND” without exponential backoff or a bounded attempt limit, over-
whelming the OCR service and potentially burning out the barrier motor through repeated
activation attempts. [2]
Grading: “It’s slow” or “it might crash” earns 0. Must name the precise anti-pattern and explain
thread/system consequences.
- Use of ASYNC / AWAIT [3] - Bounded retry (MAX_ATTEMPTS) [3] - Exponential backoff
(not fixed delay) [3] - Graceful physical fallback (manual override mode) [3]
2
CSE322/CSE323 – Mock Final Examination II Answer Key – Spring 2026
3
CSE322/CSE323 – Mock Final Examination II Answer Key – Spring 2026
Grading: Happy path alone = Satisfactory. All three scenarios with correct Given/When/Then
syntax = Excellent.
• “safe payment” → “All payment card data is encrypted using AES-256 at rest and
TLS 1.3 in transit; CVV is never stored.” (PCI-DSS) [2]
Any quantifiable, testable metric with a cited standard accepted. Vague replacements earn 0.
Notation accuracy is explicitly graded. Missing return values or incorrect operation names penal-
ized.
• Hidden Requirement: The system must validate that the recognized plate matches the
reservation’s registered vehicle type (e.g., sedan vs. truck) to prevent plate-cloning fraud.
[1.5]
• Edge Case: A fraudster photographs a valid driver’s plate and displays it on a tablet at the
gate; the system must detect the lack of a physical vehicle via ultrasonic or LIDAR presence
sensors. [1.5]
4
CSE322/CSE323 – Mock Final Examination II Answer Key – Spring 2026
- Role + Context [2] - Two worked examples (Few-Shot) [3] - Task definition [1] - Negative
Constraint [2]
• Boundary Padlock:
def t e s t _ b o u n d a r y _ e x a c t l y _ 1 5 _ m i n u t e s () :
assert v a l i d a t e _ e n t r y _ w i n d o w (
datetime (2026 ,6 ,9 ,10 ,0) , datetime (2026 ,6 ,9 ,10 ,15)
) == 15.0
[2]
• Threshold Padlock:
def t e s t _ t h r e s h o l d _ 1 6 _ m i n u t e s () :
with pytest . raises ( ValueError ) :
validate_entry_window (
datetime (2026 ,6 ,9 ,10 ,0) , datetime (2026 ,6 ,9 ,10 ,16)
)
[2]
• Extreme Padlock:
def t e s t _ e x t r e m e _ 2 4 _ h o u r s () :
with pytest . raises ( ValueError ) :
validate_entry_window (
datetime (2026 ,6 ,9 ,10 ,0) , datetime (2026 ,6 ,10 ,10 ,0)
)
[2]
“Do NOT return the absolute time difference for invalid entries; explicitly raise Val-
ueError for any current_time outside the reservation window ± 15 minutes.”
5
CSE322/CSE323 – Mock Final Examination II Answer Key – Spring 2026
Evaluation: Does not match the 70/20/10 pyramid. Unit tests are critically below 70%
and integration tests severely exceed 20%.
Risk: The test suite will have slow CI/CD feedback, fragile cross-module tests that break on
internal refactoring, and insufficient isolation of individual component defects, allowing bugs to
propagate undetected into integration. [1]
6
Answer Key — Mock Final Exam
Q1
a) FR: System shall allow students to submit exams online.
b) NFR: Response time ≤ 2 seconds (Performance).
c) Primary: Student Supporting: Authentication Service Offstage: University Ad-
ministration
d) Replace with: Response time ≤ 2 seconds at 95th percentile
Q2
a) validate exam submission → Business Logic log exam activity → Technical Services
trigger camera → Hardware
b) FUNCTION set proctoring(enabled: BOOLEAN)
c) Logging is cross-cutting infrastructure used by all layers → Technical Services
Q3
a) - Synchronous Blocking - Infinite Busy-Wait (Retry Storm)
b)
FUNCTION submit_exam(data):
MAX = 3
FOR i FROM 1 TO MAX:
RESULT = AWAIT SEND_TO_SERVER_ASYNC(data)
IF [Link] == "SUCCESS":
RETURN RESULT
ELSE IF [Link] == "BUSY":
WAIT(5)
CONTINUE
ELSE:
RETURN "ERROR"
RETURN "TIMEOUT_FAILURE"
Q4
a) UC-A = 5 + 3 = 8 UC-B = 4 = 4 UC-C = 4 + 2 = 6
b) None
c) UC-A → highest PW → delivers maximum stakeholder value first
Q5
a) Given student is logged in When student submits exam Then exam is stored success-
fully
1
b) Given student is logged in When submission fails due to network Then system
retries and shows error after limit
c) Submission time ≤ 2 seconds
Q6
a) ASSERT check attempts(3) == LOCKED
b) Boundary: attempts = 3 → LOCKED Threshold: attempts = 4 → LOCKED
Extreme: attempts = 100 → LOCKED
c) Do NOT silently ignore invalid attempt counts
Q7
Role: You are a backend engineer
Context: Exam submission system with retry logic
Example 1: If attempts ¡ 3 → retry with delay
Example 2: If attempts 3 → return failure
Task: Generate submission retry logic
Negative Constraint: Do NOT block thread with synchronous calls