This repository contains solutions to three technical tasks focused on chatbot design, performance testing optimization, and systematic debugging. Below is an overview of each solution and how to navigate this repository.
- Chatbot Flow Design
- Performance Testing Exercise
- Systematic Debugging Exercise
- Repository Structure
- GitHub URL
A multi-step chatbot flow designed to collect user information while minimizing attributes and handling edge cases. Key features:
- Attributes Used:
isReturningUser
,userAge
,lifestyleFlags
(encoded 3 booleans),promoCodeValid
, etc. - Excluded Attributes:
debugMode
,mysteryFlag
,serviceTimeRange
(redundant or irrelevant). - Logic: Validates inputs (e.g., age ≥ 0), handles under-18 consent, and encodes lifestyle flags into a 3-bit binary.
- Pseudo-Code: See Solution Details.
- Input validation and re-prompting.
- Branching logic for product/service selection.
- Regex validation for promo codes (
[A-Z]{3}\d{4}[!@#$%^&*]{2}[a-z]{3}
).
Select 2 out of 6 test cases for an ATM system to maximize functionality coverage.
- Optimal Pair: TC2 (Check Balance → Change PIN) + TC5 (Deposit → Transfer with Discount).
- Covered Functionalities:
- F1 (Discount), F2 (Balance), F3 (Change PIN), F5 (Transfer), F6 (Deposit).
- Uncovered Functionality: F4 (View Statements).
Debugging inconsistent discounts for promo code SAVE20
in an online bookstore.
- Replicate the Issue: Tested with members/non-members and varying order totals.
- Code Review: Found membership discounts overriding
SAVE20
. - Root Cause: Flawed conditional logic prioritizing member status over promo codes.
- Fix: Enforced promo code priority and added unit tests.
# Fixed discount logic
def apply_discount(order_total, promo_code, is_member):
if promo_code == "SAVE20":
return order_total * 0.8 # 20% discount enforced
elif is_member:
return order_total * 0.9 # Fallback member discount