PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/System Design/Shopify

Design and implement a word-guessing game

Last updated: Mar 29, 2026

Quick Overview

This question evaluates programming and system-design competencies such as command-line application architecture, input validation, feedback logic, state persistence for statistics, and unit testing for correctness and edge-case handling, and is categorized under System Design.

  • medium
  • Shopify
  • System Design
  • Machine Learning Engineer

Design and implement a word-guessing game

Company: Shopify

Role: Machine Learning Engineer

Category: System Design

Difficulty: medium

Interview Round: Technical Screen

Design and implement a word-guessing game as a standalone application. Requirements: select a random secret word from a provided dictionary file; accept fixed-length alphabetic guesses via the command line; after each guess, return per-letter feedback indicating correct position, present but wrong position, or absent; enforce a maximum number of attempts (e.g., 6) and report win/lose outcomes; persist simple statistics (games played, wins, current streak) locally; write unit tests for feedback generation, input validation, word selection, and statistics updates; provide build and run instructions and explain your key design choices.

Quick Answer: This question evaluates programming and system-design competencies such as command-line application architecture, input validation, feedback logic, state persistence for statistics, and unit testing for correctness and edge-case handling, and is categorized under System Design.

Related Interview Questions

  • Design a rare-book lending and returns system - Shopify (hard)
Shopify logo
Shopify
Aug 12, 2025, 12:00 AM
Machine Learning Engineer
Technical Screen
System Design
23
0

Word-Guessing Game (Wordle-like) — Design and Implement

Context

Build a small, standalone command-line application that lets a user guess a secret word within a limited number of attempts. Treat this like a technical screen: favor clean design, testability, and clear instructions.

Functional Requirements

  1. Dictionary and secret selection
    • Read a dictionary file (one word per line).
    • Normalize and filter to a fixed length (e.g., 5 letters).
    • Select a random secret word from the filtered list.
  2. Input and validation
    • Accept guesses via the command line (interactive prompt).
    • Enforce fixed length and alphabetic-only input; be case-insensitive.
  3. Feedback per guess
    • For each letter in the guess, return feedback:
      • Correct letter in the correct position.
      • Letter present in the word but in a different position.
      • Letter not present in the word.
    • Handle duplicate letters correctly.
  4. Attempts and outcomes
    • Enforce a maximum number of attempts (e.g., 6).
    • Report win/lose outcomes at the end.
  5. Persistent statistics
    • Store locally: total games played, total wins, current streak.
    • Update after each game finishes.
  6. Tests
    • Unit tests for: feedback generation, input validation, word selection, and statistics updates.

Non-Functional/Constraints

  • Implement in a language of your choice; the result should run as a standalone CLI.
  • Keep external dependencies minimal.

Deliverables

  • Source code and dictionary file example.
  • Build and run instructions.
  • Brief explanation of key design choices.

Solution

Show

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More Shopify•More Machine Learning Engineer•Shopify Machine Learning Engineer•Shopify System Design•Machine Learning Engineer System Design
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.